Contract Overview
Latest 25 from a total of 931 transactions
Contract Name:
SystemStaking
Compiler Version
v0.8.18+commit.87f61d96
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; struct BucketInfo { uint256 typeIndex; uint256 unlockedAt; // UINT256_MAX: in lock uint256 unstakedAt; // UINT256_MAX: in stake address delegate; } struct BucketType { uint256 amount; uint256 duration; uint256 activatedAt; } contract SystemStaking is ERC721, Ownable, Pausable { uint256 public constant UINT256_MAX = type(uint256).max; uint256 public constant UNSTAKE_FREEZE_BLOCKS = 51840; // (3 * 24 * 60 * 60) / 5; event BucketTypeActivated(uint256 amount, uint256 duration); event BucketTypeDeactivated(uint256 amount, uint256 duration); event Staked(uint256 indexed tokenId, address delegate, uint256 amount, uint256 duration); event Locked(uint256 indexed tokenId, uint256 duration); event Unlocked(uint256 indexed tokenId); event Unstaked(uint256 indexed tokenId); event Merged(uint256[] tokenIds, uint256 amount, uint256 duration); event BucketExpanded(uint256 indexed tokenId, uint256 amount, uint256 duration); event DelegateChanged(uint256 indexed tokenId, address newDelegate); event Withdrawal(uint256 indexed tokenId, address indexed recipient); modifier onlyTokenOwner(uint256 _tokenId) { _assertOnlyTokenOwner(_tokenId); _; } // token id uint256 private __currTokenId; // mapping from token ID to bucket mapping(uint256 => BucketInfo) private __buckets; // delegate address -> bucket type -> count mapping(address => mapping(uint256 => uint256)) private __unlockedVotes; // delegate address -> bucket type -> count mapping(address => mapping(uint256 => uint256)) private __lockedVotes; // bucket type BucketType[] private __bucketTypes; // amount -> duration -> index mapping(uint256 => mapping(uint256 => uint256)) private __bucketTypeIndices; constructor() ERC721("BucketNFT", "BKT") {} function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function unsafeInc(uint256 x) private pure returns (uint256) { unchecked { return x + 1; } } function unsafeDec(uint256 x) private pure returns (uint256) { unchecked { return x - 1; } } // bucket type related functions function addBucketType(uint256 _amount, uint256 _duration) external onlyOwner { require(_amount != 0, "amount is invalid"); require(__bucketTypeIndices[_amount][_duration] == 0, "duplicate bucket type"); __bucketTypes.push(BucketType(_amount, _duration, block.number)); __bucketTypeIndices[_amount][_duration] = __bucketTypes.length; emit BucketTypeActivated(_amount, _duration); } function deactivateBucketType(uint256 _amount, uint256 _duration) external onlyOwner { __bucketTypes[_bucketTypeIndex(_amount, _duration)].activatedAt = UINT256_MAX; emit BucketTypeDeactivated(_amount, _duration); } function activateBucketType(uint256 _amount, uint256 _duration) external onlyOwner { __bucketTypes[_bucketTypeIndex(_amount, _duration)].activatedAt = block.number; emit BucketTypeActivated(_amount, _duration); } function isActiveBucketType(uint256 _amount, uint256 _duration) external view returns (bool) { return _isActiveBucketType(_bucketTypeIndex(_amount, _duration)); } function numOfBucketTypes() public view returns (uint256) { return __bucketTypes.length; } function bucketTypes( uint256 _offset, uint256 _size ) external view returns (BucketType[] memory types_) { require(_size > 0 && _offset + _size <= numOfBucketTypes(), "invalid parameters"); types_ = new BucketType[](_size); for (uint256 i = 0; i < _size; i = unsafeInc(i)) { unchecked { types_[i] = __bucketTypes[_offset + i]; } } } // token related functions function blocksToUnstake(uint256 _tokenId) external view returns (uint256) { _assertOnlyValidToken(_tokenId); BucketInfo storage bucket = __buckets[_tokenId]; _assertOnlyStakedToken(bucket); return _blocksToUnstake(bucket); } function blocksToWithdraw(uint256 _tokenId) external view returns (uint256) { _assertOnlyValidToken(_tokenId); return _blocksToWithdraw(__buckets[_tokenId].unstakedAt); } function bucketOf( uint256 _tokenId ) external view returns ( uint256 amount_, uint256 duration_, uint256 unlockedAt_, uint256 unstakedAt_, address delegate_ ) { _assertOnlyValidToken(_tokenId); BucketInfo storage bucket = __buckets[_tokenId]; BucketType storage bucketType = __bucketTypes[bucket.typeIndex]; return ( bucketType.amount, bucketType.duration, bucket.unlockedAt, bucket.unstakedAt, bucket.delegate ); } function stake( uint256 _duration, address _delegate ) external payable whenNotPaused returns (uint256) { uint256 msgValue = msg.value; uint256 index = _bucketTypeIndex(msgValue, _duration); _assertOnlyActiveBucketType(index); _stake(index, _delegate); uint256 tokenId = __currTokenId; emit Staked(tokenId, _delegate, msgValue, _duration); return tokenId; } function stake( uint256 _amount, uint256 _duration, address[] memory _delegates ) external payable whenNotPaused returns (uint256 firstTokenId_) { require(_amount * _delegates.length == msg.value, "invalid parameters"); uint256 index = _bucketTypeIndex(_amount, _duration); _assertOnlyActiveBucketType(index); unchecked { firstTokenId_ = __currTokenId + 1; } for (uint256 i = 0; i < _delegates.length; i = unsafeInc(i)) { _stake(index, _delegates[i]); emit Staked(firstTokenId_ + i, _delegates[i], _amount, _duration); } return firstTokenId_; } function stake( uint256 _amount, uint256 _duration, address _delegate, uint256 _count ) external payable whenNotPaused returns (uint256 firstTokenId_) { require(_count > 0 && _amount * _count == msg.value, "invalid parameters"); uint256 index = _bucketTypeIndex(_amount, _duration); _assertOnlyActiveBucketType(index); unchecked { firstTokenId_ = __currTokenId + 1; } for (uint256 i = 0; i < _count; i = unsafeInc(i)) { _stake(index, _delegate); emit Staked(firstTokenId_ + i, _delegate, _amount, _duration); } return firstTokenId_; } function unlock(uint256 _tokenId) external whenNotPaused onlyTokenOwner(_tokenId) { BucketInfo storage bucket = __buckets[_tokenId]; _assertOnlyLockedToken(bucket); _unlock(bucket); emit Unlocked(_tokenId); } function unlock(uint256[] calldata _tokenIds) external whenNotPaused { uint256 tokenId; BucketInfo storage bucket; for (uint256 i = 0; i < _tokenIds.length; i = unsafeInc(i)) { tokenId = _tokenIds[i]; _assertOnlyTokenOwner(tokenId); bucket = __buckets[tokenId]; _assertOnlyLockedToken(bucket); _unlock(bucket); emit Unlocked(tokenId); } } function lock( uint256 _tokenId, uint256 _duration ) external whenNotPaused onlyTokenOwner(_tokenId) { BucketInfo storage bucket = __buckets[_tokenId]; _assertOnlyStakedToken(bucket); _lock(bucket, _duration); emit Locked(_tokenId, _duration); } function lock(uint256[] calldata _tokenIds, uint256 _duration) external whenNotPaused { uint256 tokenId; BucketInfo storage bucket; for (uint256 i = 0; i < _tokenIds.length; i = unsafeInc(i)) { tokenId = _tokenIds[i]; _assertOnlyTokenOwner(tokenId); bucket = __buckets[tokenId]; _assertOnlyStakedToken(bucket); _lock(bucket, _duration); emit Locked(tokenId, _duration); } } function unstake(uint256 _tokenId) external whenNotPaused onlyTokenOwner(_tokenId) { BucketInfo storage bucket = __buckets[_tokenId]; _assertOnlyStakedToken(bucket); require(_blocksToUnstake(bucket) == 0, "not ready to unstake"); _unstake(bucket); emit Unstaked(_tokenId); } function unstake(uint256[] calldata _tokenIds) external whenNotPaused { uint256 tokenId; BucketInfo storage bucket; for (uint256 i = 0; i < _tokenIds.length; i = unsafeInc(i)) { tokenId = _tokenIds[i]; _assertOnlyTokenOwner(tokenId); bucket = __buckets[tokenId]; _assertOnlyStakedToken(bucket); require(_blocksToUnstake(bucket) == 0, "not ready to unstake"); _unstake(bucket); emit Unstaked(tokenId); } } function withdraw( uint256 _tokenId, address payable _recipient ) external whenNotPaused onlyTokenOwner(_tokenId) { BucketInfo storage bucket = __buckets[_tokenId]; require(_blocksToWithdraw(bucket.unstakedAt) == 0, "not ready to withdraw"); _burn(_tokenId); _withdraw(bucket, _recipient); emit Withdrawal(_tokenId, _recipient); } function withdraw( uint256[] calldata _tokenIds, address payable _recipient ) external whenNotPaused { uint256 tokenId; BucketInfo storage bucket; for (uint256 i = 0; i < _tokenIds.length; i = unsafeInc(i)) { tokenId = _tokenIds[i]; _assertOnlyTokenOwner(tokenId); bucket = __buckets[tokenId]; require(_blocksToWithdraw(bucket.unstakedAt) == 0, "not ready to withdraw"); _burn(tokenId); _withdraw(bucket, _recipient); emit Withdrawal(tokenId, _recipient); } } function merge( uint256[] calldata tokenIds, uint256 _newDuration ) external payable whenNotPaused { require(tokenIds.length > 1, "invalid length"); uint256 amount = msg.value; uint256 tokenId; BucketInfo storage bucket; BucketType storage bucketType; for (uint256 i = tokenIds.length; i > 0; ) { i = unsafeDec(i); tokenId = tokenIds[i]; _assertOnlyTokenOwner(tokenId); bucket = __buckets[tokenId]; _assertOnlyStakedToken(bucket); uint256 typeIndex = bucket.typeIndex; address delegate = bucket.delegate; bucketType = __bucketTypes[typeIndex]; require(_newDuration >= bucketType.duration, "invalid duration"); amount += bucketType.amount; if (_isTriggered(bucket.unlockedAt)) { __unlockedVotes[delegate][typeIndex] = unsafeDec( __unlockedVotes[delegate][typeIndex] ); } else { __lockedVotes[delegate][typeIndex] = unsafeDec(__lockedVotes[delegate][typeIndex]); } if (i != 0) { _burn(tokenId); } else { bucket.unlockedAt = UINT256_MAX; _updateBucketInfo(bucket, amount, _newDuration); emit Merged(tokenIds, amount, _newDuration); } } } function expandBucket( uint256 _tokenId, uint256 _newAmount, uint256 _newDuration ) external payable whenNotPaused onlyTokenOwner(_tokenId) { BucketInfo storage bucket = __buckets[_tokenId]; _assertOnlyLockedToken(bucket); uint256 typeIndex = bucket.typeIndex; BucketType storage bucketType = __bucketTypes[typeIndex]; require(_newDuration >= bucketType.duration, "invalid duration"); require(msg.value >= 0 && msg.value + bucketType.amount == _newAmount, "invalid amount"); __lockedVotes[bucket.delegate][typeIndex] = unsafeDec( __lockedVotes[bucket.delegate][typeIndex] ); _updateBucketInfo(bucket, _newAmount, _newDuration); emit BucketExpanded(_tokenId, _newAmount, _newDuration); } function changeDelegate( uint256 _tokenId, address _delegate ) external whenNotPaused onlyTokenOwner(_tokenId) { _changeDelegate(__buckets[_tokenId], _delegate); emit DelegateChanged(_tokenId, _delegate); } function changeDelegates( uint256[] calldata _tokenIds, address _delegate ) external whenNotPaused { uint256 tokenId; for (uint256 i = 0; i < _tokenIds.length; i = unsafeInc(i)) { tokenId = _tokenIds[i]; _assertOnlyTokenOwner(tokenId); _changeDelegate(__buckets[tokenId], _delegate); emit DelegateChanged(tokenId, _delegate); } } function lockedVotesTo( address[] calldata _delegates ) external view returns (uint256[][] memory counts_) { counts_ = new uint256[][](_delegates.length); uint256 tl = numOfBucketTypes(); for (uint256 i = 0; i < _delegates.length; i = unsafeInc(i)) { counts_[i] = new uint256[](tl); mapping(uint256 => uint256) storage votes = __lockedVotes[_delegates[i]]; for (uint256 j = 0; j < tl; j = unsafeInc(j)) { counts_[i][j] = votes[j]; } } return counts_; } function unlockedVotesTo( address[] calldata _delegates ) external view returns (uint256[][] memory counts_) { counts_ = new uint256[][](_delegates.length); uint256 tl = numOfBucketTypes(); for (uint256 i = 0; i < _delegates.length; i = unsafeInc(i)) { counts_[i] = new uint256[](tl); mapping(uint256 => uint256) storage votes = __unlockedVotes[_delegates[i]]; for (uint256 j = 0; j < tl; j = unsafeInc(j)) { counts_[i][j] = votes[j]; } } return counts_; } ///////////////////////////////////////////// // Private Functions function _bucketTypeIndex(uint256 _amount, uint256 _duration) internal view returns (uint256) { uint256 index = __bucketTypeIndices[_amount][_duration]; require(index > 0, "invalid bucket type"); return unsafeDec(index); } // bucket type index `_index` must be valid function _isActiveBucketType(uint256 _index) internal view returns (bool) { return __bucketTypes[_index].activatedAt <= block.number; } function _isTriggered(uint256 _value) internal pure returns (bool) { return _value != UINT256_MAX; } function _assertOnlyTokenOwner(uint256 _tokenId) internal view { require(msg.sender == ownerOf(_tokenId), "not owner"); } function _assertOnlyLockedToken(BucketInfo storage _bucket) internal view { require(!_isTriggered(_bucket.unlockedAt), "not a locked token"); } function _assertOnlyStakedToken(BucketInfo storage _bucket) internal view { require(!_isTriggered(_bucket.unstakedAt), "not a staked token"); } function _assertOnlyValidToken(uint256 _tokenId) internal view { require(_exists(_tokenId), "ERC721: invalid token ID"); } function _assertOnlyActiveBucketType(uint256 _index) internal view { require(_isActiveBucketType(_index), "inactive bucket type"); } function _beforeTokenTransfer( address _from, address _to, uint256 _firstTokenId, uint256 _batchSize ) internal override { require(_batchSize == 1, "batch transfer is not supported"); require( _to == address(0) || !_isTriggered(__buckets[_firstTokenId].unstakedAt), "cannot transfer unstaked token" ); super._beforeTokenTransfer(_from, _to, _firstTokenId, _batchSize); } function _blocksToWithdraw(uint256 _unstakedAt) internal view returns (uint256) { require(_isTriggered(_unstakedAt), "not an unstaked bucket"); uint256 withdrawBlock = _unstakedAt + UNSTAKE_FREEZE_BLOCKS; if (withdrawBlock <= block.number) { return 0; } unchecked { return withdrawBlock - block.number; } } function _blocksToUnstake(BucketInfo storage _bucket) internal view returns (uint256) { uint256 unlockedAt = _bucket.unlockedAt; require(_isTriggered(unlockedAt), "not an unlocked bucket"); uint256 unstakeBlock = unlockedAt + __bucketTypes[_bucket.typeIndex].duration; if (unstakeBlock <= block.number) { return 0; } unchecked { return unstakeBlock - block.number; } } function _stake(uint256 _index, address _delegate) internal { __currTokenId = unsafeInc(__currTokenId); __buckets[__currTokenId] = BucketInfo(_index, UINT256_MAX, UINT256_MAX, _delegate); __lockedVotes[_delegate][_index] = unsafeInc(__lockedVotes[_delegate][_index]); _safeMint(msg.sender, __currTokenId); } function _unlock(BucketInfo storage _bucket) internal { uint256 typeIndex = _bucket.typeIndex; address delegate = _bucket.delegate; _bucket.unlockedAt = block.number; __lockedVotes[delegate][typeIndex] = unsafeDec(__lockedVotes[delegate][typeIndex]); __unlockedVotes[delegate][typeIndex] = unsafeInc(__unlockedVotes[delegate][typeIndex]); } function _lock(BucketInfo storage _bucket, uint256 _duration) internal { uint256 typeIndex = _bucket.typeIndex; address delegate = _bucket.delegate; require(_duration >= _blocksToUnstake(_bucket), "invalid duration"); uint256 newIndex = _bucketTypeIndex(__bucketTypes[typeIndex].amount, _duration); _assertOnlyActiveBucketType(newIndex); _bucket.unlockedAt = UINT256_MAX; __unlockedVotes[delegate][typeIndex] = unsafeDec(__unlockedVotes[delegate][typeIndex]); _bucket.typeIndex = newIndex; __lockedVotes[delegate][newIndex] = unsafeInc(__lockedVotes[delegate][newIndex]); } function _unstake(BucketInfo storage _bucket) internal { _bucket.unstakedAt = block.number; __unlockedVotes[_bucket.delegate][_bucket.typeIndex] = unsafeDec( __unlockedVotes[_bucket.delegate][_bucket.typeIndex] ); } function _withdraw(BucketInfo storage _bucket, address payable _recipient) internal { uint256 amount = __bucketTypes[_bucket.typeIndex].amount; (bool success, ) = _recipient.call{value: amount}(""); require(success, "failed to transfer"); } function _updateBucketInfo( BucketInfo storage _bucket, uint256 _amount, uint256 _duration ) internal { uint256 index = _bucketTypeIndex(_amount, _duration); _assertOnlyActiveBucketType(index); __lockedVotes[_bucket.delegate][index] = unsafeInc(__lockedVotes[_bucket.delegate][index]); _bucket.typeIndex = index; } function _changeDelegate(BucketInfo storage _bucket, address _newDelegate) internal { _assertOnlyStakedToken(_bucket); uint256 typeIndex = _bucket.typeIndex; address delegate = _bucket.delegate; require(delegate != _newDelegate, "invalid operation"); if (_isTriggered(_bucket.unlockedAt)) { __unlockedVotes[delegate][typeIndex] = unsafeDec(__unlockedVotes[delegate][typeIndex]); __unlockedVotes[_newDelegate][typeIndex] = unsafeInc( __unlockedVotes[_newDelegate][typeIndex] ); } else { __lockedVotes[delegate][typeIndex] = unsafeDec(__lockedVotes[delegate][typeIndex]); __lockedVotes[_newDelegate][typeIndex] = unsafeInc( __lockedVotes[_newDelegate][typeIndex] ); } _bucket.delegate = _newDelegate; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _ownerOf(tokenId); require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner or approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _safeTransfer(from, to, tokenId, data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _ownerOf(tokenId) != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId, 1); // Check that tokenId was not minted by `_beforeTokenTransfer` hook require(!_exists(tokenId), "ERC721: token already minted"); unchecked { // Will not overflow unless all 2**256 token ids are minted to the same owner. // Given that tokens are minted one by one, it is impossible in practice that // this ever happens. Might change if we allow batch minting. // The ERC fails to describe this case. _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId, 1); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId, 1); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721.ownerOf(tokenId); // Clear approvals delete _tokenApprovals[tokenId]; unchecked { // Cannot overflow, as that would require more tokens to be burned/transferred // out than the owner initially received through minting and transferring in. _balances[owner] -= 1; } delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId, 1); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId, 1); // Check that tokenId was not transferred by `_beforeTokenTransfer` hook require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; unchecked { // `_balances[from]` cannot overflow for the same reason as described in `_burn`: // `from`'s balance is the number of token held, which is at least one before the current // transfer. // `_balances[to]` could overflow in the conditions described in `_mint`. That would require // all 2**256 token ids to be minted, which in practice is impossible. _balances[from] -= 1; _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`. * - When `from` is zero, the tokens will be minted for `to`. * - When `to` is zero, ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256, /* firstTokenId */ uint256 batchSize ) internal virtual { if (batchSize > 1) { if (from != address(0)) { _balances[from] -= batchSize; } if (to != address(0)) { _balances[to] += batchSize; } } } /** * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`. * - When `from` is zero, the tokens were minted for `to`. * - When `to` is zero, ``from``'s tokens were burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"BucketExpanded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"BucketTypeActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"BucketTypeDeactivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"newDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"Merged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"Withdrawal","type":"event"},{"inputs":[],"name":"UINT256_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNSTAKE_FREEZE_BLOCKS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"activateBucketType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"addBucketType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"blocksToUnstake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"blocksToWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"bucketOf","outputs":[{"internalType":"uint256","name":"amount_","type":"uint256"},{"internalType":"uint256","name":"duration_","type":"uint256"},{"internalType":"uint256","name":"unlockedAt_","type":"uint256"},{"internalType":"uint256","name":"unstakedAt_","type":"uint256"},{"internalType":"address","name":"delegate_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"bucketTypes","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"activatedAt","type":"uint256"}],"internalType":"struct BucketType[]","name":"types_","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_delegate","type":"address"}],"name":"changeDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"address","name":"_delegate","type":"address"}],"name":"changeDelegates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"deactivateBucketType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_newAmount","type":"uint256"},{"internalType":"uint256","name":"_newDuration","type":"uint256"}],"name":"expandBucket","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"isActiveBucketType","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_delegates","type":"address[]"}],"name":"lockedVotesTo","outputs":[{"internalType":"uint256[][]","name":"counts_","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"_newDuration","type":"uint256"}],"name":"merge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numOfBucketTypes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"},{"internalType":"address","name":"_delegate","type":"address"},{"internalType":"uint256","name":"_count","type":"uint256"}],"name":"stake","outputs":[{"internalType":"uint256","name":"firstTokenId_","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"},{"internalType":"address","name":"_delegate","type":"address"}],"name":"stake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"},{"internalType":"address[]","name":"_delegates","type":"address[]"}],"name":"stake","outputs":[{"internalType":"uint256","name":"firstTokenId_","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_delegates","type":"address[]"}],"name":"unlockedVotesTo","outputs":[{"internalType":"uint256[][]","name":"counts_","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address payable","name":"_recipient","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"address payable","name":"_recipient","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080604052600436106102875760003560e01c8063715018a61161015a578063b8f4bd7b116100c1578063e449f3411161007a578063e449f341146107be578063e985e9c5146107de578063eb0ffb2e14610827578063eec7ee7314610847578063f0b56b5d1461085a578063f2fde38b1461087057600080fd5b8063b8f4bd7b14610715578063bbe33ea514610735578063c87b56dd14610748578063c8e7792314610768578063d0949f9914610788578063e0028ecf1461079e57600080fd5b806395d89b411161011357806395d89b411461066b578063960014bd1461068057806398ca3b76146106a05780639f7d5b00146106c0578063a22cb465146106d5578063b88d4fde146106f557600080fd5b8063715018a6146105c357806378bfca10146105d85780637acb7757146106055780638456cb59146106185780638da5cb5b1461062d57806393b6ef591461064b57600080fd5b80633f4ba83a116101fe5780635ceb8b5b116101b75780635ceb8b5b146105105780635d36598f146105305780636198e339146105505780636352211e1461057057806370a0823114610590578063711563d4146105b057600080fd5b80633f4ba83a1461041e5780633fd140df1461043357806342842e0e14610460578063431cd92a1461048057806343e06c59146104d15780635c975abb146104f157600080fd5b8063081812fc11610250578063081812fc14610346578063095ea7b31461037e5780630f5b2ca51461039e5780631338736f146103be57806323b872dd146103de5780632e17de78146103fe57600080fd5b8062f714ce1461028c57806301ffc9a7146102ae578063025008ed146102e357806303459b16146102f657806306fdde0314610324575b600080fd5b34801561029857600080fd5b506102ac6102a73660046133df565b610890565b005b3480156102ba57600080fd5b506102ce6102c9366004613425565b610957565b60405190151581526020015b60405180910390f35b6102ac6102f1366004613442565b6109a9565b34801561030257600080fd5b5061031661031136600461346e565b610aea565b6040519081526020016102da565b34801561033057600080fd5b50610339610b10565b6040516102da91906134d7565b34801561035257600080fd5b5061036661036136600461346e565b610ba2565b6040516001600160a01b0390911681526020016102da565b34801561038a57600080fd5b506102ac6103993660046134ea565b610bc9565b3480156103aa57600080fd5b506102ac6103b93660046133df565b610cde565b3480156103ca57600080fd5b506102ac6103d9366004613516565b610d4b565b3480156103ea57600080fd5b506102ac6103f9366004613538565b610dbe565b34801561040a57600080fd5b506102ac61041936600461346e565b610def565b34801561042a57600080fd5b506102ac610e9e565b34801561043f57600080fd5b5061045361044e3660046135c4565b610eb0565b6040516102da9190613605565b34801561046c57600080fd5b506102ac61047b366004613538565b611032565b34801561048c57600080fd5b506104a061049b36600461346e565b61104d565b6040805195865260208601949094529284019190915260608301526001600160a01b0316608082015260a0016102da565b3480156104dd57600080fd5b506102ce6104ec366004613516565b6110c9565b3480156104fd57600080fd5b50600654600160a01b900460ff166102ce565b34801561051c57600080fd5b506102ac61052b36600461368f565b6110e4565b34801561053c57600080fd5b506102ac61054b3660046135c4565b61118b565b34801561055c57600080fd5b506102ac61056b36600461346e565b611221565b34801561057c57600080fd5b5061036661058b36600461346e565b611283565b34801561059c57600080fd5b506103166105ab3660046136da565b6112e3565b6103166105be3660046136f7565b611369565b3480156105cf57600080fd5b506102ac611442565b3480156105e457600080fd5b506105f86105f3366004613516565b611454565b6040516102da9190613736565b6103166106133660046133df565b611589565b34801561062457600080fd5b506102ac61160d565b34801561063957600080fd5b506006546001600160a01b0316610366565b34801561065757600080fd5b5061031661066636600461346e565b61161d565b34801561067757600080fd5b50610339611648565b34801561068c57600080fd5b5061045361069b3660046135c4565b611657565b3480156106ac57600080fd5b506102ac6106bb36600461378f565b6117d1565b3480156106cc57600080fd5b50600b54610316565b3480156106e157600080fd5b506102ac6106f03660046137e5565b611867565b34801561070157600080fd5b506102ac61071036600461385e565b611876565b34801561072157600080fd5b506102ac61073036600461378f565b6118ae565b6102ac61074336600461368f565b61199d565b34801561075457600080fd5b5061033961076336600461346e565b611b84565b34801561077457600080fd5b506102ac610783366004613516565b611bf7565b34801561079457600080fd5b5061031660001981565b3480156107aa57600080fd5b506102ac6107b9366004613516565b611d9c565b3480156107ca57600080fd5b506102ac6107d93660046135c4565b611e10565b3480156107ea57600080fd5b506102ce6107f9366004613921565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561083357600080fd5b506102ac610842366004613516565b611eec565b61031661085536600461394f565b611f62565b34801561086657600080fd5b5061031661ca8081565b34801561087c57600080fd5b506102ac61088b3660046136da565b612067565b6108986120e0565b816108a28161212d565b600083815260086020526040902060028101546108be90612182565b156109085760405162461bcd60e51b81526020600482015260156024820152746e6f7420726561647920746f20776974686472617760581b60448201526064015b60405180910390fd5b610911846121f7565b61091b818461229a565b6040516001600160a01b0384169085907fd964a27d45f595739c13d8b1160b57491050cacf3a2e5602207277d6228f64ee90600090a350505050565b60006001600160e01b031982166380ac58cd60e01b148061098857506001600160e01b03198216635b5e139f60e01b145b806109a357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6109b16120e0565b826109bb8161212d565b60008481526008602052604090206109d281612359565b8054600b805460009190839081106109ec576109ec613a15565b906000526020600020906003020190508060010154851015610a205760405162461bcd60e51b81526004016108ff90613a2b565b80548690610a2e9034613a6b565b14610a6c5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a5908185b5bdd5b9d60921b60448201526064016108ff565b60038301546001600160a01b03166000908152600a6020908152604080832085845290915290208054600019019055610aa68387876123a3565b604080518781526020810187905288917fd29e04160a74f0dbab5e7b82ef0392d86d11ac2939e5883eb3353be4cfedb83e910160405180910390a250505050505050565b6000610af5826123ef565b6000828152600860205260409020600201546109a390612182565b606060008054610b1f90613a7e565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4b90613a7e565b8015610b985780601f10610b6d57610100808354040283529160200191610b98565b820191906000526020600020905b815481529060010190602001808311610b7b57829003601f168201915b5050505050905090565b6000610bad826123ef565b506000908152600460205260409020546001600160a01b031690565b6000610bd482611283565b9050806001600160a01b0316836001600160a01b031603610c415760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016108ff565b336001600160a01b0382161480610c5d5750610c5d81336107f9565b610ccf5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016108ff565b610cd9838361244e565b505050565b610ce66120e0565b81610cf08161212d565b6000838152600860205260409020610d0890836124bc565b6040516001600160a01b038316815283907f6f08c7e76d830d5f3d0a18fd27f4d8c0049b24a8689ddb39625e0864d894a9c19060200160405180910390a2505050565b610d536120e0565b81610d5d8161212d565b6000838152600860205260409020610d74816125de565b610d7e8184612628565b837f907fece23ce39fbcbceb71e515043fe29408353fbb393b25b35eb8a70a4bad0b84604051610db091815260200190565b60405180910390a250505050565b610dc833826126f2565b610de45760405162461bcd60e51b81526004016108ff90613ab8565b610cd9838383612770565b610df76120e0565b80610e018161212d565b6000828152600860205260409020610e18816125de565b610e21816128e1565b15610e655760405162461bcd60e51b81526020600482015260146024820152736e6f7420726561647920746f20756e7374616b6560601b60448201526064016108ff565b610e6e81612986565b60405183907f11725367022c3ff288940f4b5473aa61c2da6a24af7363a1128ee2401e8983b290600090a2505050565b610ea66129bd565b610eae612a17565b565b6060816001600160401b03811115610eca57610eca613818565b604051908082528060200260200182016040528015610efd57816020015b6060815260200190600190039081610ee85790505b5090506000610f0b600b5490565b905060005b8381101561102a57816001600160401b03811115610f3057610f30613818565b604051908082528060200260200182016040528015610f59578160200160208202803683370190505b50838281518110610f6c57610f6c613a15565b60200260200101819052506000600a6000878785818110610f8f57610f8f613a15565b9050602002016020810190610fa491906136da565b6001600160a01b03166001600160a01b03168152602001908152602001600020905060005b83811015611020576000818152602083905260409020548551869085908110610ff457610ff4613a15565b6020026020010151828151811061100d5761100d613a15565b6020908102919091010152600101610fc9565b5050600101610f10565b505092915050565b610cd983838360405180602001604052806000815250611876565b600080600080600061105e866123ef565b60008681526008602052604081208054600b8054929392909190811061108657611086613a15565b6000918252602090912060039182020180546001918201549185015460028601549590930154909b919a509198509296506001600160a01b031694509092505050565b60006110dd6110d88484612a6c565b612ad3565b9392505050565b6110ec6120e0565b60008060005b848110156111835785858281811061110c5761110c613a15565b90506020020135925061111e8361212d565b60008381526008602052604090209150611137826125de565b6111418285612628565b827f907fece23ce39fbcbceb71e515043fe29408353fbb393b25b35eb8a70a4bad0b8560405161117391815260200190565b60405180910390a26001016110f2565b505050505050565b6111936120e0565b60008060005b8381101561121a578484828181106111b3576111b3613a15565b9050602002013592506111c58361212d565b600083815260086020526040902091506111de82612359565b6111e782612b04565b60405183907ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184290600090a2600101611199565b5050505050565b6112296120e0565b806112338161212d565b600082815260086020526040902061124a81612359565b61125381612b04565b60405183907ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184290600090a2505050565b6000818152600260205260408120546001600160a01b0316806109a35760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016108ff565b60006001600160a01b03821661134d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016108ff565b506001600160a01b031660009081526003602052604090205490565b60006113736120e0565b60008211801561138b5750346113898387613b05565b145b6113a75760405162461bcd60e51b81526004016108ff90613b1c565b60006113b38686612a6c565b90506113be81612b58565b600754600101915060005b83811015611437576113db8286612ba4565b6113e58184613a6b565b604080516001600160a01b0388168152602081018a90529081018890527f17700ceb1658b18206f427c1578048e87504106b14ec69e9b4586d9a95174a329060600160405180910390a26001016113c9565b50505b949350505050565b61144a6129bd565b610eae6000612c3e565b60606000821180156114715750600b5461146e8385613a6b565b11155b61148d5760405162461bcd60e51b81526004016108ff90613b1c565b816001600160401b038111156114a5576114a5613818565b6040519080825280602002602001820160405280156114fa57816020015b6114e760405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816114c35790505b50905060005b8281101561158257600b8185018154811061151d5761151d613a15565b9060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505082828151811061156657611566613a15565b602002602001018190525061157b8160010190565b9050611500565b5092915050565b60006115936120e0565b3460006115a08286612a6c565b90506115ab81612b58565b6115b58185612ba4565b600754604080516001600160a01b03871681526020810185905290810187905281907f17700ceb1658b18206f427c1578048e87504106b14ec69e9b4586d9a95174a329060600160405180910390a295945050505050565b6116156129bd565b610eae612c90565b6000611628826123ef565b600082815260086020526040902061163f816125de565b6110dd816128e1565b606060018054610b1f90613a7e565b6060816001600160401b0381111561167157611671613818565b6040519080825280602002602001820160405280156116a457816020015b606081526020019060019003908161168f5790505b50905060006116b2600b5490565b905060005b8381101561102a57816001600160401b038111156116d7576116d7613818565b604051908082528060200260200182016040528015611700578160200160208202803683370190505b5083828151811061171357611713613a15565b602002602001018190525060006009600087878581811061173657611736613a15565b905060200201602081019061174b91906136da565b6001600160a01b03166001600160a01b03168152602001908152602001600020905060005b838110156117c757600081815260208390526040902054855186908590811061179b5761179b613a15565b602002602001015182815181106117b4576117b4613a15565b6020908102919091010152600101611770565b50506001016116b7565b6117d96120e0565b6000805b8381101561121a578484828181106117f7576117f7613a15565b9050602002013591506118098261212d565b600082815260086020526040902061182190846124bc565b6040516001600160a01b038416815282907f6f08c7e76d830d5f3d0a18fd27f4d8c0049b24a8689ddb39625e0864d894a9c19060200160405180910390a26001016117dd565b611872338383612cd3565b5050565b61188033836126f2565b61189c5760405162461bcd60e51b81526004016108ff90613ab8565b6118a884848484612da1565b50505050565b6118b66120e0565b60008060005b84811015611183578585828181106118d6576118d6613a15565b9050602002013592506118e88361212d565b6000838152600860205260409020600281015490925061190790612182565b1561194c5760405162461bcd60e51b81526020600482015260156024820152746e6f7420726561647920746f20776974686472617760581b60448201526064016108ff565b611955836121f7565b61195f828561229a565b6040516001600160a01b0385169084907fd964a27d45f595739c13d8b1160b57491050cacf3a2e5602207277d6228f64ee90600090a36001016118bc565b6119a56120e0565b600182116119e65760405162461bcd60e51b815260206004820152600e60248201526d0d2dcecc2d8d2c840d8cadccee8d60931b60448201526064016108ff565b3460008080855b8015611b7a5760001901878782818110611a0957611a09613a15565b905060200201359350611a1b8461212d565b60008481526008602052604090209250611a34836125de565b82546003840154600b80546001600160a01b039092169183908110611a5b57611a5b613a15565b906000526020600020906003020193508360010154881015611a8f5760405162461bcd60e51b81526004016108ff90613a2b565b8354611a9b9088613a6b565b9650611aad8560010154600019141590565b15611ae2576001600160a01b038116600090815260096020908152604080832085845290915290208054600019019055611b0e565b6001600160a01b0381166000908152600a60209081526040808320858452909152902080546000190190555b8215611b2257611b1d866121f7565b611b73565b6000196001860155611b3585888a6123a3565b7fb3f4c8ca702dbbd32d9a25ce17b1942a5060284d9d69fc4fcac8fb0397891b128a8a898b604051611b6a9493929190613b48565b60405180910390a15b50506119ed565b5050505050505050565b6060611b8f826123ef565b6000611ba660408051602081019091526000815290565b90506000815111611bc657604051806020016040528060008152506110dd565b80611bd084612dd4565b604051602001611be1929190613b8e565b6040516020818303038152906040529392505050565b611bff6129bd565b81600003611c435760405162461bcd60e51b8152602060048201526011602482015270185b5bdd5b9d081a5cc81a5b9d985b1a59607a1b60448201526064016108ff565b6000828152600c6020908152604080832084845290915290205415611ca25760405162461bcd60e51b81526020600482015260156024820152746475706c6963617465206275636b6574207479706560581b60448201526064016108ff565b60408051606081018252838152602080820184815243838501908152600b8054600181018255600082815295517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db960039092029182015592517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dba84015590517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbb9092019190915554858352600c82528383208584528252918390209190915581518481529081018390527f6b39e3267efcd6611c8d7d2534c4715dcb4824322b90d85540a3a82967b6e7b791015b60405180910390a15050565b611da46129bd565b43600b611db18484612a6c565b81548110611dc157611dc1613a15565b9060005260206000209060030201600201819055507f6b39e3267efcd6611c8d7d2534c4715dcb4824322b90d85540a3a82967b6e7b78282604051611d90929190918252602082015260400190565b611e186120e0565b60008060005b8381101561121a57848482818110611e3857611e38613a15565b905060200201359250611e4a8361212d565b60008381526008602052604090209150611e63826125de565b611e6c826128e1565b15611eb05760405162461bcd60e51b81526020600482015260146024820152736e6f7420726561647920746f20756e7374616b6560601b60448201526064016108ff565b611eb982612986565b60405183907f11725367022c3ff288940f4b5473aa61c2da6a24af7363a1128ee2401e8983b290600090a2600101611e1e565b611ef46129bd565b600019600b611f038484612a6c565b81548110611f1357611f13613a15565b9060005260206000209060030201600201819055507f099df2bf9247b43481cf1b791a4dd5fa1220c40c62940da539082fbcb30241d68282604051611d90929190918252602082015260400190565b6000611f6c6120e0565b34825185611f7a9190613b05565b14611f975760405162461bcd60e51b81526004016108ff90613b1c565b6000611fa38585612a6c565b9050611fae81612b58565b600754600101915060005b835181101561205e57611fe582858381518110611fd857611fd8613a15565b6020026020010151612ba4565b611fef8184613a6b565b7f17700ceb1658b18206f427c1578048e87504106b14ec69e9b4586d9a95174a3285838151811061202257612022613a15565b602090810291909101810151604080516001600160a01b0390921682529181018a905290810188905260600160405180910390a2600101611fb9565b50509392505050565b61206f6129bd565b6001600160a01b0381166120d45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108ff565b6120dd81612c3e565b50565b600654600160a01b900460ff1615610eae5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108ff565b61213681611283565b6001600160a01b0316336001600160a01b0316146120dd5760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064016108ff565b600060001982036121ce5760405162461bcd60e51b81526020600482015260166024820152751b9bdd08185b881d5b9cdd185ad95908189d58dad95d60521b60448201526064016108ff565b60006121dc61ca8084613a6b565b90504381116121ee5750600092915050565b43900392915050565b600061220282611283565b9050612212816000846001612e66565b61221b82611283565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000600b8360000154815481106122b3576122b3613a15565b600091825260208220600390910201546040519092506001600160a01b0384169083908381818185875af1925050503d806000811461230e576040519150601f19603f3d011682016040523d82523d6000602084013e612313565b606091505b50509050806118a85760405162461bcd60e51b81526020600482015260126024820152713330b4b632b2103a37903a3930b739b332b960711b60448201526064016108ff565b6001810154600019146120dd5760405162461bcd60e51b81526020600482015260126024820152713737ba1030903637b1b5b2b2103a37b5b2b760711b60448201526064016108ff565b60006123af8383612a6c565b90506123ba81612b58565b60038401546001600160a01b03166000908152600a602090815260408083208484529091529020805460010190559092555050565b6000818152600260205260409020546001600160a01b03166120dd5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016108ff565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061248382611283565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6124c5826125de565b815460038301546001600160a01b03908116908316810361251c5760405162461bcd60e51b815260206004820152601160248201527034b73b30b634b21037b832b930ba34b7b760791b60448201526064016108ff565b600184015460001914612572576001600160a01b038181166000908152600960208181526040808420878552825280842080546000190190559387168352908152828220858352905220805460010190556125b7565b6001600160a01b038181166000908152600a60208181526040808420878552825280842080546000190190559387168352908152828220858352905220805460010190555b505060039190910180546001600160a01b0319166001600160a01b03909216919091179055565b6002810154600019146120dd5760405162461bcd60e51b81526020600482015260126024820152713737ba10309039ba30b5b2b2103a37b5b2b760711b60448201526064016108ff565b815460038301546001600160a01b0316612641846128e1565b8310156126605760405162461bcd60e51b81526004016108ff90613a2b565b6000612690600b848154811061267857612678613a15565b90600052602060002090600302016000015485612a6c565b905061269b81612b58565b60001960018681018290556001600160a01b039390931660008181526009602090815260408083209783529681528682208054909401909355968390558652600a8152838620918652529220805490920190915550565b6000806126fe83611283565b9050806001600160a01b0316846001600160a01b0316148061274557506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b8061143a5750836001600160a01b031661275e84610ba2565b6001600160a01b031614949350505050565b826001600160a01b031661278382611283565b6001600160a01b0316146127a95760405162461bcd60e51b81526004016108ff90613bbd565b6001600160a01b03821661280b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016108ff565b6128188383836001612e66565b826001600160a01b031661282b82611283565b6001600160a01b0316146128515760405162461bcd60e51b81526004016108ff90613bbd565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600181015460009060001981036129335760405162461bcd60e51b81526020600482015260166024820152751b9bdd08185b881d5b9b1bd8dad95908189d58dad95d60521b60448201526064016108ff565b6000600b84600001548154811061294c5761294c613a15565b906000526020600020906003020160010154826129699190613a6b565b905043811161297c575060009392505050565b4390039392505050565b43600282015560038101546001600160a01b0316600090815260096020908152604080832093548352929052208054600019019055565b6006546001600160a01b03163314610eae5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108ff565b612a1f612f36565b6006805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000828152600c6020908152604080832084845290915281205480612ac95760405162461bcd60e51b8152602060048201526013602482015272696e76616c6964206275636b6574207479706560681b60448201526064016108ff565b600019810161143a565b600043600b8381548110612ae957612ae9613a15565b90600052602060002090600302016002015411159050919050565b80546003820154436001938401556001600160a01b03166000818152600a60209081526040808320858452825280832080546000190190559282526009815282822093825292909252902080549091019055565b612b6181612ad3565b6120dd5760405162461bcd60e51b8152602060048201526014602482015273696e616374697665206275636b6574207479706560601b60448201526064016108ff565b6007805460019081018083556040805160808101825286815260001960208083018281528385019283526001600160a01b0389811660608601818152600098895260088552878920965187559251868a0155935160028601559051600390940180546001600160a01b03191694909116939093179092558352600a8152818320878452905290208054909101905554611872903390612f86565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612c986120e0565b6006805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612a4f3390565b816001600160a01b0316836001600160a01b031603612d345760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016108ff565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612dac848484612770565b612db884848484612fa0565b6118a85760405162461bcd60e51b81526004016108ff90613c02565b60606000612de18361309e565b60010190506000816001600160401b03811115612e0057612e00613818565b6040519080825280601f01601f191660200182016040528015612e2a576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612e3457509392505050565b80600114612eb65760405162461bcd60e51b815260206004820152601f60248201527f6261746368207472616e73666572206973206e6f7420737570706f727465640060448201526064016108ff565b6001600160a01b0383161580612ede5750600082815260086020526040902060020154600019145b612f2a5760405162461bcd60e51b815260206004820152601e60248201527f63616e6e6f74207472616e7366657220756e7374616b656420746f6b656e000060448201526064016108ff565b6118a884848484613176565b600654600160a01b900460ff16610eae5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108ff565b6118728282604051806020016040528060008152506131fe565b60006001600160a01b0384163b1561309657604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612fe4903390899088908890600401613c54565b6020604051808303816000875af192505050801561301f575060408051601f3d908101601f1916820190925261301c91810190613c91565b60015b61307c573d80801561304d576040519150601f19603f3d011682016040523d82523d6000602084013e613052565b606091505b5080516000036130745760405162461bcd60e51b81526004016108ff90613c02565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061143a565b50600161143a565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106130dd5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613109576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061312757662386f26fc10000830492506010015b6305f5e100831061313f576305f5e100830492506008015b612710831061315357612710830492506004015b60648310613165576064830492506002015b600a83106109a35760010192915050565b60018111156118a8576001600160a01b038416156131bc576001600160a01b038416600090815260036020526040812080548392906131b6908490613cae565b90915550505b6001600160a01b038316156118a8576001600160a01b038316600090815260036020526040812080548392906131f3908490613a6b565b909155505050505050565b6132088383613231565b6132156000848484612fa0565b610cd95760405162461bcd60e51b81526004016108ff90613c02565b6001600160a01b0382166132875760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016108ff565b6000818152600260205260409020546001600160a01b0316156132ec5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016108ff565b6132fa600083836001612e66565b6000818152600260205260409020546001600160a01b03161561335f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016108ff565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b03811681146120dd57600080fd5b600080604083850312156133f257600080fd5b823591506020830135613404816133ca565b809150509250929050565b6001600160e01b0319811681146120dd57600080fd5b60006020828403121561343757600080fd5b81356110dd8161340f565b60008060006060848603121561345757600080fd5b505081359360208301359350604090920135919050565b60006020828403121561348057600080fd5b5035919050565b60005b838110156134a257818101518382015260200161348a565b50506000910152565b600081518084526134c3816020860160208601613487565b601f01601f19169290920160200192915050565b6020815260006110dd60208301846134ab565b600080604083850312156134fd57600080fd5b8235613508816133ca565b946020939093013593505050565b6000806040838503121561352957600080fd5b50508035926020909101359150565b60008060006060848603121561354d57600080fd5b8335613558816133ca565b92506020840135613568816133ca565b929592945050506040919091013590565b60008083601f84011261358b57600080fd5b5081356001600160401b038111156135a257600080fd5b6020830191508360208260051b85010111156135bd57600080fd5b9250929050565b600080602083850312156135d757600080fd5b82356001600160401b038111156135ed57600080fd5b6135f985828601613579565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b87010192508387016000805b8381101561368157888603603f19018552825180518088529088019088880190845b8181101561366b5783518352928a0192918a019160010161364f565b509097505050938601939186019160010161362d565b509398975050505050505050565b6000806000604084860312156136a457600080fd5b83356001600160401b038111156136ba57600080fd5b6136c686828701613579565b909790965060209590950135949350505050565b6000602082840312156136ec57600080fd5b81356110dd816133ca565b6000806000806080858703121561370d57600080fd5b84359350602085013592506040850135613726816133ca565b9396929550929360600135925050565b602080825282518282018190526000919060409081850190868401855b828110156137825781518051855286810151878601528501518585015260609093019290850190600101613753565b5091979650505050505050565b6000806000604084860312156137a457600080fd5b83356001600160401b038111156137ba57600080fd5b6137c686828701613579565b90945092505060208401356137da816133ca565b809150509250925092565b600080604083850312156137f857600080fd5b8235613803816133ca565b91506020830135801515811461340457600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561385657613856613818565b604052919050565b6000806000806080858703121561387457600080fd5b843561387f816133ca565b9350602085810135613890816133ca565b93506040860135925060608601356001600160401b03808211156138b357600080fd5b818801915088601f8301126138c757600080fd5b8135818111156138d9576138d9613818565b6138eb601f8201601f1916850161382e565b9150808252898482850101111561390157600080fd5b808484018584013760008482840101525080935050505092959194509250565b6000806040838503121561393457600080fd5b823561393f816133ca565b91506020830135613404816133ca565b60008060006060848603121561396457600080fd5b83359250602080850135925060408501356001600160401b038082111561398a57600080fd5b818701915087601f83011261399e57600080fd5b8135818111156139b0576139b0613818565b8060051b91506139c184830161382e565b818152918301840191848101908a8411156139db57600080fd5b938501935b83851015613a0557843592506139f5836133ca565b82825293850193908501906139e0565b8096505050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b60208082526010908201526f34b73b30b634b210323ab930ba34b7b760811b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b808201808211156109a3576109a3613a55565b600181811c90821680613a9257607f821691505b602082108103613ab257634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b80820281158282048414176109a3576109a3613a55565b602080825260129082015271696e76616c696420706172616d657465727360701b604082015260600190565b6060808252810184905260006001600160fb1b03851115613b6857600080fd5b8460051b8087608085013760208301949094525060408101919091520160800192915050565b60008351613ba0818460208801613487565b835190830190613bb4818360208801613487565b01949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613c87908301846134ab565b9695505050505050565b600060208284031215613ca357600080fd5b81516110dd8161340f565b818103818111156109a3576109a3613a5556fea2646970667358221220ccb3bbc737df5334f5e7babad06c39bac00a09dcfd1e34baa3ba9918de497a1364736f6c63430008120033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for
interesting conversations.