Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 17594186 | 475 days ago | IN | 0 ETH | 0.08451567 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
NNSStaking
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; contract NNSStaking is ERC721Holder, Initializable, ReentrancyGuardUpgradeable { using SafeERC20 for IERC20; using ECDSA for bytes32; struct Stake { uint256 tokenId; /// @dev when the stake started. uint256 startTime; /// @dev when the stake ended. uint256 endTime; } /// @dev Mapping of owner -> stakes mapping(address => Stake[]) public stakes; /// @dev Mapping of tokenId to index of the latest stake in stakes. mapping(uint256 => uint256) public tokenIdToStakeIdx; /// @dev Keep track of used nonces for each wallet. mapping(address => mapping(uint256 => bool)) usedNonces; /// @dev Mapping of last withdraw for a wallet. mapping(address => uint256) lastWithdraw; /// @dev NFT that can be staked. IERC721 public nft; /// @dev Coins that are rewarded. IERC20 public coin; /// @dev Signer of the signature to claim. address public signer; event Staked( address indexed staker, uint256 indexed tokenId, uint256 startTime ); event Unstaked( address indexed staker, uint256 indexed tokenId, uint256 startTime, uint256 endTime ); event Rewarded(address indexed staker, uint256 value); function initialize( IERC721 _nft, IERC20 _coin, address _signer ) public initializer { __ReentrancyGuard_init(); nft = _nft; coin = _coin; signer = _signer; } function stake(uint256[] calldata _tokenIds) public nonReentrant { require(_tokenIds.length > 0, "nothing to stake"); for (uint256 i; i < _tokenIds.length; ++i) { _stake(_tokenIds[i]); } } function _stake(uint256 _tokenId) private { require( IERC721(nft).ownerOf(_tokenId) == msg.sender, "you do not own this nft" ); stakes[msg.sender].push( Stake({tokenId: _tokenId, startTime: block.timestamp, endTime: 0}) ); tokenIdToStakeIdx[_tokenId] = stakes[msg.sender].length - 1; IERC721(nft).safeTransferFrom(msg.sender, address(this), _tokenId); emit Staked(msg.sender, _tokenId, block.timestamp); } function unstake(uint256[] calldata _tokenIds) public nonReentrant { require(_tokenIds.length > 0, "nothing to unstake"); for (uint256 i; i < _tokenIds.length; ++i) { _unstake(_tokenIds[i]); } } function _unstake(uint256 _tokenId) private { uint256 idx = tokenIdToStakeIdx[_tokenId]; require(idx < stakes[msg.sender].length, "no stake to withdraw"); Stake storage s = stakes[msg.sender][idx]; require( s.tokenId == _tokenId && s.startTime > 0, "no stake to withdraw" ); require(s.endTime == 0, "stake already withdrawn"); s.endTime = block.timestamp; delete tokenIdToStakeIdx[_tokenId]; IERC721(nft).safeTransferFrom(address(this), msg.sender, _tokenId); emit Unstaked(msg.sender, _tokenId, s.startTime, block.timestamp); } function getStakes( address _owner ) public view returns (Stake[] memory st, uint256 lastWithdrawTime) { return (stakes[_owner], lastWithdraw[_owner]); } function withdraw( uint256 value, uint256 nonce, uint256 expiry, bytes memory signature ) public nonReentrant { require(!usedNonces[msg.sender][nonce], "nonce already used"); bytes32 hash = keccak256( abi.encodePacked(msg.sender, value, nonce, expiry) ); address msgSigner = hash.toEthSignedMessageHash().recover(signature); require(msgSigner == signer, "invalid signature"); require(expiry > block.timestamp, "expired"); usedNonces[msg.sender][nonce] = true; coin.safeTransfer(msg.sender, value); lastWithdraw[msg.sender] = block.timestamp; emit Rewarded(msg.sender, value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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 // OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling 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 (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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.9.0) (token/ERC721/utils/ERC721Holder.sol) pragma solidity ^0.8.0; import "../IERC721Receiver.sol"; /** * @dev Implementation of the {IERC721Receiver} interface. * * Accepts all token transfers. * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. */ contract ERC721Holder is IERC721Receiver { /** * @dev See {IERC721Receiver-onERC721Received}. * * Always returns `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) { return this.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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 // 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 (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// 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.9.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) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 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 256, 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 << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.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 `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @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); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
{ "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Rewarded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[],"name":"coin","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"getStakes","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"internalType":"struct NNSStaking.Stake[]","name":"st","type":"tuple[]"},{"internalType":"uint256","name":"lastWithdrawTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_nft","type":"address"},{"internalType":"contract IERC20","name":"_coin","type":"address"},{"internalType":"address","name":"_signer","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nft","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakes","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToStakeIdx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50612c09806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063584b62a111610071578063584b62a1146101545780636238f870146101865780637ba6f458146101b6578063c0c53b8b146101e7578063e449f34114610203578063fe55892d1461021f576100a9565b80630fbf0a93146100ae57806311df9995146100ca578063150b7a02146100e8578063238ac9331461011857806347ccca0214610136575b600080fd5b6100c860048036038101906100c391906117d2565b61023b565b005b6100d26102d7565b6040516100df919061189e565b60405180910390f35b61010260048036038101906100fd9190611a6e565b6102fd565b60405161010f9190611b2c565b60405180910390f35b610120610311565b60405161012d9190611b56565b60405180910390f35b61013e610337565b60405161014b9190611b92565b60405180910390f35b61016e60048036038101906101699190611bad565b61035d565b60405161017d93929190611bfc565b60405180910390f35b6101a0600480360381019061019b9190611c33565b6103a4565b6040516101ad9190611c60565b60405180910390f35b6101d060048036038101906101cb9190611c7b565b6103bc565b6040516101de929190611da8565b60405180910390f35b61020160048036038101906101fc9190611e54565b6104bf565b005b61021d600480360381019061021891906117d2565b6106c3565b005b61023960048036038101906102349190611ea7565b61075f565b005b610243610a7f565b60008282905011610289576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028090611f87565b60405180910390fd5b60005b828290508110156102ca576102b98383838181106102ad576102ac611fa7565b5b90506020020135610ace565b806102c390612005565b905061028c565b506102d3610dc4565b5050565b603860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600063150b7a0260e01b9050949350505050565b603960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6033602052816000526040600020818154811061037957600080fd5b9060005260206000209060030201600091509150508060000154908060010154908060020154905083565b60346020528060005260406000206000915090505481565b60606000603360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020603660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481805480602002602001604051908101604052809291908181526020016000905b828210156104b05783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190610460565b50505050915091509150915091565b60008060019054906101000a900460ff161590508080156104f05750600160008054906101000a900460ff1660ff16105b8061051d57506104ff30610dcd565b15801561051c5750600160008054906101000a900460ff1660ff16145b5b61055c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610553906120bf565b60405180910390fd5b60016000806101000a81548160ff021916908360ff1602179055508015610599576001600060016101000a81548160ff0219169083151502179055505b6105a1610df0565b83603760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082603860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081603960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080156106bd5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516106b49190612127565b60405180910390a15b50505050565b6106cb610a7f565b60008282905011610711576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107089061218e565b60405180910390fd5b60005b828290508110156107525761074183838381811061073557610734611fa7565b5b90506020020135610e49565b8061074b90612005565b9050610714565b5061075b610dc4565b5050565b610767610a7f565b603560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060009054906101000a900460ff1615610805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107fc906121fa565b60405180910390fd5b60003385858560405160200161081e9493929190612283565b604051602081830303815290604052805190602001209050600061085383610845846110f0565b61112690919063ffffffff16565b9050603960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146108e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108dc9061231d565b60405180910390fd5b428411610927576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091e90612389565b60405180910390fd5b6001603560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060006101000a81548160ff0219169083151502179055506109dd3387603860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661114d9092919063ffffffff16565b42603660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fb3b7a071186534c03b40695710096f289fd4ed6c1a374aff0bb648955e4fe56387604051610a679190611c60565b60405180910390a25050610a79610dc4565b50505050565b600260015403610ac4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abb906123f5565b60405180910390fd5b6002600181905550565b3373ffffffffffffffffffffffffffffffffffffffff16603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b8152600401610b409190611c60565b602060405180830381865afa158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b81919061242a565b73ffffffffffffffffffffffffffffffffffffffff1614610bd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bce906124a3565b60405180910390fd5b603360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052808381526020014281526020016000815250908060018154018082558091505060019003906000526020600020906003020160009091909190915060008201518160000155602082015181600101556040820151816002015550506001603360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050610cca91906124c3565b6034600083815260200190815260200160002081905550603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e3330846040518463ffffffff1660e01b8152600401610d40939291906124f7565b600060405180830381600087803b158015610d5a57600080fd5b505af1158015610d6e573d6000803e3d6000fd5b50505050803373ffffffffffffffffffffffffffffffffffffffff167f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9042604051610db99190611c60565b60405180910390a350565b60018081905550565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16610e3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e36906125a0565b60405180910390fd5b610e476111d3565b565b600060346000838152602001908152602001600020549050603360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508110610ee5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610edc9061260c565b60405180910390fd5b6000603360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110610f3857610f37611fa7565b5b90600052602060002090600302019050828160000154148015610f5f575060008160010154115b610f9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f959061260c565b60405180910390fd5b6000816002015414610fe5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fdc90612678565b60405180910390fd5b4281600201819055506034600084815260200190815260200160002060009055603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e3033866040518463ffffffff1660e01b8152600401611064939291906124f7565b600060405180830381600087803b15801561107e57600080fd5b505af1158015611092573d6000803e3d6000fd5b50505050823373ffffffffffffffffffffffffffffffffffffffff167f204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de008360010154426040516110e3929190612698565b60405180910390a3505050565b60007f19457468657265756d205369676e6564204d6573736167653a0a33320000000060005281601c52603c6000209050919050565b6000806000611135858561122b565b915091506111428161127c565b819250505092915050565b6111ce8363a9059cbb60e01b848460405160240161116c9291906126c1565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506113e2565b505050565b600060019054906101000a900460ff16611222576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611219906125a0565b60405180910390fd5b60018081905550565b600080604183510361126c5760008060006020860151925060408601519150606086015160001a9050611260878285856114aa565b94509450505050611275565b60006002915091505b9250929050565b600060048111156112905761128f6126ea565b5b8160048111156112a3576112a26126ea565b5b03156113df57600160048111156112bd576112bc6126ea565b5b8160048111156112d0576112cf6126ea565b5b03611310576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130790612765565b60405180910390fd5b60026004811115611324576113236126ea565b5b816004811115611337576113366126ea565b5b03611377576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136e906127d1565b60405180910390fd5b6003600481111561138b5761138a6126ea565b5b81600481111561139e5761139d6126ea565b5b036113de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d590612863565b60405180910390fd5b5b50565b6000611444826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661158c9092919063ffffffff16565b905060008151148061146657508080602001905181019061146591906128bb565b5b6114a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149c9061295a565b60405180910390fd5b505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c11156114e5576000600391509150611583565b60006001878787876040516000815260200160405260405161150a94939291906129a2565b6020604051602081039080840390855afa15801561152c573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361157a57600060019250925050611583565b80600092509250505b94509492505050565b606061159b84846000856115a4565b90509392505050565b6060824710156115e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e090612a59565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516116129190612aea565b60006040518083038185875af1925050503d806000811461164f576040519150601f19603f3d011682016040523d82523d6000602084013e611654565b606091505b509150915061166587838387611671565b92505050949350505050565b606083156116d35760008351036116cb5761168b856116e6565b6116ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c190612b4d565b60405180910390fd5b5b8290506116de565b6116dd8383611709565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60008251111561171c5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117509190612bb1565b60405180910390fd5b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f8401126117925761179161176d565b5b8235905067ffffffffffffffff8111156117af576117ae611772565b5b6020830191508360208202830111156117cb576117ca611777565b5b9250929050565b600080602083850312156117e9576117e8611763565b5b600083013567ffffffffffffffff81111561180757611806611768565b5b6118138582860161177c565b92509250509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061186461185f61185a8461181f565b61183f565b61181f565b9050919050565b600061187682611849565b9050919050565b60006118888261186b565b9050919050565b6118988161187d565b82525050565b60006020820190506118b3600083018461188f565b92915050565b60006118c48261181f565b9050919050565b6118d4816118b9565b81146118df57600080fd5b50565b6000813590506118f1816118cb565b92915050565b6000819050919050565b61190a816118f7565b811461191557600080fd5b50565b60008135905061192781611901565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61197b82611932565b810181811067ffffffffffffffff8211171561199a57611999611943565b5b80604052505050565b60006119ad611759565b90506119b98282611972565b919050565b600067ffffffffffffffff8211156119d9576119d8611943565b5b6119e282611932565b9050602081019050919050565b82818337600083830152505050565b6000611a11611a0c846119be565b6119a3565b905082815260208101848484011115611a2d57611a2c61192d565b5b611a388482856119ef565b509392505050565b600082601f830112611a5557611a5461176d565b5b8135611a658482602086016119fe565b91505092915050565b60008060008060808587031215611a8857611a87611763565b5b6000611a96878288016118e2565b9450506020611aa7878288016118e2565b9350506040611ab887828801611918565b925050606085013567ffffffffffffffff811115611ad957611ad8611768565b5b611ae587828801611a40565b91505092959194509250565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611b2681611af1565b82525050565b6000602082019050611b416000830184611b1d565b92915050565b611b50816118b9565b82525050565b6000602082019050611b6b6000830184611b47565b92915050565b6000611b7c8261186b565b9050919050565b611b8c81611b71565b82525050565b6000602082019050611ba76000830184611b83565b92915050565b60008060408385031215611bc457611bc3611763565b5b6000611bd2858286016118e2565b9250506020611be385828601611918565b9150509250929050565b611bf6816118f7565b82525050565b6000606082019050611c116000830186611bed565b611c1e6020830185611bed565b611c2b6040830184611bed565b949350505050565b600060208284031215611c4957611c48611763565b5b6000611c5784828501611918565b91505092915050565b6000602082019050611c756000830184611bed565b92915050565b600060208284031215611c9157611c90611763565b5b6000611c9f848285016118e2565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611cdd816118f7565b82525050565b606082016000820151611cf96000850182611cd4565b506020820151611d0c6020850182611cd4565b506040820151611d1f6040850182611cd4565b50505050565b6000611d318383611ce3565b60608301905092915050565b6000602082019050919050565b6000611d5582611ca8565b611d5f8185611cb3565b9350611d6a83611cc4565b8060005b83811015611d9b578151611d828882611d25565b9750611d8d83611d3d565b925050600181019050611d6e565b5085935050505092915050565b60006040820190508181036000830152611dc28185611d4a565b9050611dd16020830184611bed565b9392505050565b6000611de3826118b9565b9050919050565b611df381611dd8565b8114611dfe57600080fd5b50565b600081359050611e1081611dea565b92915050565b6000611e21826118b9565b9050919050565b611e3181611e16565b8114611e3c57600080fd5b50565b600081359050611e4e81611e28565b92915050565b600080600060608486031215611e6d57611e6c611763565b5b6000611e7b86828701611e01565b9350506020611e8c86828701611e3f565b9250506040611e9d868287016118e2565b9150509250925092565b60008060008060808587031215611ec157611ec0611763565b5b6000611ecf87828801611918565b9450506020611ee087828801611918565b9350506040611ef187828801611918565b925050606085013567ffffffffffffffff811115611f1257611f11611768565b5b611f1e87828801611a40565b91505092959194509250565b600082825260208201905092915050565b7f6e6f7468696e6720746f207374616b6500000000000000000000000000000000600082015250565b6000611f71601083611f2a565b9150611f7c82611f3b565b602082019050919050565b60006020820190508181036000830152611fa081611f64565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612010826118f7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361204257612041611fd6565b5b600182019050919050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006120a9602e83611f2a565b91506120b48261204d565b604082019050919050565b600060208201905081810360008301526120d88161209c565b9050919050565b6000819050919050565b600060ff82169050919050565b600061211161210c612107846120df565b61183f565b6120e9565b9050919050565b612121816120f6565b82525050565b600060208201905061213c6000830184612118565b92915050565b7f6e6f7468696e6720746f20756e7374616b650000000000000000000000000000600082015250565b6000612178601283611f2a565b915061218382612142565b602082019050919050565b600060208201905081810360008301526121a78161216b565b9050919050565b7f6e6f6e636520616c726561647920757365640000000000000000000000000000600082015250565b60006121e4601283611f2a565b91506121ef826121ae565b602082019050919050565b60006020820190508181036000830152612213816121d7565b9050919050565b60008160601b9050919050565b60006122328261221a565b9050919050565b600061224482612227565b9050919050565b61225c612257826118b9565b612239565b82525050565b6000819050919050565b61227d612278826118f7565b612262565b82525050565b600061228f828761224b565b60148201915061229f828661226c565b6020820191506122af828561226c565b6020820191506122bf828461226c565b60208201915081905095945050505050565b7f696e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b6000612307601183611f2a565b9150612312826122d1565b602082019050919050565b60006020820190508181036000830152612336816122fa565b9050919050565b7f6578706972656400000000000000000000000000000000000000000000000000600082015250565b6000612373600783611f2a565b915061237e8261233d565b602082019050919050565b600060208201905081810360008301526123a281612366565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b60006123df601f83611f2a565b91506123ea826123a9565b602082019050919050565b6000602082019050818103600083015261240e816123d2565b9050919050565b600081519050612424816118cb565b92915050565b6000602082840312156124405761243f611763565b5b600061244e84828501612415565b91505092915050565b7f796f7520646f206e6f74206f776e2074686973206e6674000000000000000000600082015250565b600061248d601783611f2a565b915061249882612457565b602082019050919050565b600060208201905081810360008301526124bc81612480565b9050919050565b60006124ce826118f7565b91506124d9836118f7565b92508282039050818111156124f1576124f0611fd6565b5b92915050565b600060608201905061250c6000830186611b47565b6125196020830185611b47565b6125266040830184611bed565b949350505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061258a602b83611f2a565b91506125958261252e565b604082019050919050565b600060208201905081810360008301526125b98161257d565b9050919050565b7f6e6f207374616b6520746f207769746864726177000000000000000000000000600082015250565b60006125f6601483611f2a565b9150612601826125c0565b602082019050919050565b60006020820190508181036000830152612625816125e9565b9050919050565b7f7374616b6520616c72656164792077697468647261776e000000000000000000600082015250565b6000612662601783611f2a565b915061266d8261262c565b602082019050919050565b6000602082019050818103600083015261269181612655565b9050919050565b60006040820190506126ad6000830185611bed565b6126ba6020830184611bed565b9392505050565b60006040820190506126d66000830185611b47565b6126e36020830184611bed565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b600061274f601883611f2a565b915061275a82612719565b602082019050919050565b6000602082019050818103600083015261277e81612742565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b60006127bb601f83611f2a565b91506127c682612785565b602082019050919050565b600060208201905081810360008301526127ea816127ae565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b600061284d602283611f2a565b9150612858826127f1565b604082019050919050565b6000602082019050818103600083015261287c81612840565b9050919050565b60008115159050919050565b61289881612883565b81146128a357600080fd5b50565b6000815190506128b58161288f565b92915050565b6000602082840312156128d1576128d0611763565b5b60006128df848285016128a6565b91505092915050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000612944602a83611f2a565b915061294f826128e8565b604082019050919050565b6000602082019050818103600083015261297381612937565b9050919050565b6000819050919050565b61298d8161297a565b82525050565b61299c816120e9565b82525050565b60006080820190506129b76000830187612984565b6129c46020830186612993565b6129d16040830185612984565b6129de6060830184612984565b95945050505050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000612a43602683611f2a565b9150612a4e826129e7565b604082019050919050565b60006020820190508181036000830152612a7281612a36565b9050919050565b600081519050919050565b600081905092915050565b60005b83811015612aad578082015181840152602081019050612a92565b60008484015250505050565b6000612ac482612a79565b612ace8185612a84565b9350612ade818560208601612a8f565b80840191505092915050565b6000612af68284612ab9565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000612b37601d83611f2a565b9150612b4282612b01565b602082019050919050565b60006020820190508181036000830152612b6681612b2a565b9050919050565b600081519050919050565b6000612b8382612b6d565b612b8d8185611f2a565b9350612b9d818560208601612a8f565b612ba681611932565b840191505092915050565b60006020820190508181036000830152612bcb8184612b78565b90509291505056fea26469706673582212200ce8ad9e125f5f2ee834e938577d9f352e2d302530ad355b96546b73f07af7f064736f6c63430008120033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063584b62a111610071578063584b62a1146101545780636238f870146101865780637ba6f458146101b6578063c0c53b8b146101e7578063e449f34114610203578063fe55892d1461021f576100a9565b80630fbf0a93146100ae57806311df9995146100ca578063150b7a02146100e8578063238ac9331461011857806347ccca0214610136575b600080fd5b6100c860048036038101906100c391906117d2565b61023b565b005b6100d26102d7565b6040516100df919061189e565b60405180910390f35b61010260048036038101906100fd9190611a6e565b6102fd565b60405161010f9190611b2c565b60405180910390f35b610120610311565b60405161012d9190611b56565b60405180910390f35b61013e610337565b60405161014b9190611b92565b60405180910390f35b61016e60048036038101906101699190611bad565b61035d565b60405161017d93929190611bfc565b60405180910390f35b6101a0600480360381019061019b9190611c33565b6103a4565b6040516101ad9190611c60565b60405180910390f35b6101d060048036038101906101cb9190611c7b565b6103bc565b6040516101de929190611da8565b60405180910390f35b61020160048036038101906101fc9190611e54565b6104bf565b005b61021d600480360381019061021891906117d2565b6106c3565b005b61023960048036038101906102349190611ea7565b61075f565b005b610243610a7f565b60008282905011610289576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028090611f87565b60405180910390fd5b60005b828290508110156102ca576102b98383838181106102ad576102ac611fa7565b5b90506020020135610ace565b806102c390612005565b905061028c565b506102d3610dc4565b5050565b603860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600063150b7a0260e01b9050949350505050565b603960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6033602052816000526040600020818154811061037957600080fd5b9060005260206000209060030201600091509150508060000154908060010154908060020154905083565b60346020528060005260406000206000915090505481565b60606000603360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020603660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481805480602002602001604051908101604052809291908181526020016000905b828210156104b05783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190610460565b50505050915091509150915091565b60008060019054906101000a900460ff161590508080156104f05750600160008054906101000a900460ff1660ff16105b8061051d57506104ff30610dcd565b15801561051c5750600160008054906101000a900460ff1660ff16145b5b61055c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610553906120bf565b60405180910390fd5b60016000806101000a81548160ff021916908360ff1602179055508015610599576001600060016101000a81548160ff0219169083151502179055505b6105a1610df0565b83603760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082603860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081603960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080156106bd5760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516106b49190612127565b60405180910390a15b50505050565b6106cb610a7f565b60008282905011610711576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107089061218e565b60405180910390fd5b60005b828290508110156107525761074183838381811061073557610734611fa7565b5b90506020020135610e49565b8061074b90612005565b9050610714565b5061075b610dc4565b5050565b610767610a7f565b603560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060009054906101000a900460ff1615610805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107fc906121fa565b60405180910390fd5b60003385858560405160200161081e9493929190612283565b604051602081830303815290604052805190602001209050600061085383610845846110f0565b61112690919063ffffffff16565b9050603960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146108e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108dc9061231d565b60405180910390fd5b428411610927576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091e90612389565b60405180910390fd5b6001603560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060006101000a81548160ff0219169083151502179055506109dd3387603860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661114d9092919063ffffffff16565b42603660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fb3b7a071186534c03b40695710096f289fd4ed6c1a374aff0bb648955e4fe56387604051610a679190611c60565b60405180910390a25050610a79610dc4565b50505050565b600260015403610ac4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abb906123f5565b60405180910390fd5b6002600181905550565b3373ffffffffffffffffffffffffffffffffffffffff16603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b8152600401610b409190611c60565b602060405180830381865afa158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b81919061242a565b73ffffffffffffffffffffffffffffffffffffffff1614610bd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bce906124a3565b60405180910390fd5b603360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052808381526020014281526020016000815250908060018154018082558091505060019003906000526020600020906003020160009091909190915060008201518160000155602082015181600101556040820151816002015550506001603360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050610cca91906124c3565b6034600083815260200190815260200160002081905550603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e3330846040518463ffffffff1660e01b8152600401610d40939291906124f7565b600060405180830381600087803b158015610d5a57600080fd5b505af1158015610d6e573d6000803e3d6000fd5b50505050803373ffffffffffffffffffffffffffffffffffffffff167f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9042604051610db99190611c60565b60405180910390a350565b60018081905550565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16610e3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e36906125a0565b60405180910390fd5b610e476111d3565b565b600060346000838152602001908152602001600020549050603360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508110610ee5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610edc9061260c565b60405180910390fd5b6000603360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110610f3857610f37611fa7565b5b90600052602060002090600302019050828160000154148015610f5f575060008160010154115b610f9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f959061260c565b60405180910390fd5b6000816002015414610fe5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fdc90612678565b60405180910390fd5b4281600201819055506034600084815260200190815260200160002060009055603760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e3033866040518463ffffffff1660e01b8152600401611064939291906124f7565b600060405180830381600087803b15801561107e57600080fd5b505af1158015611092573d6000803e3d6000fd5b50505050823373ffffffffffffffffffffffffffffffffffffffff167f204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de008360010154426040516110e3929190612698565b60405180910390a3505050565b60007f19457468657265756d205369676e6564204d6573736167653a0a33320000000060005281601c52603c6000209050919050565b6000806000611135858561122b565b915091506111428161127c565b819250505092915050565b6111ce8363a9059cbb60e01b848460405160240161116c9291906126c1565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506113e2565b505050565b600060019054906101000a900460ff16611222576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611219906125a0565b60405180910390fd5b60018081905550565b600080604183510361126c5760008060006020860151925060408601519150606086015160001a9050611260878285856114aa565b94509450505050611275565b60006002915091505b9250929050565b600060048111156112905761128f6126ea565b5b8160048111156112a3576112a26126ea565b5b03156113df57600160048111156112bd576112bc6126ea565b5b8160048111156112d0576112cf6126ea565b5b03611310576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130790612765565b60405180910390fd5b60026004811115611324576113236126ea565b5b816004811115611337576113366126ea565b5b03611377576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136e906127d1565b60405180910390fd5b6003600481111561138b5761138a6126ea565b5b81600481111561139e5761139d6126ea565b5b036113de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d590612863565b60405180910390fd5b5b50565b6000611444826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661158c9092919063ffffffff16565b905060008151148061146657508080602001905181019061146591906128bb565b5b6114a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149c9061295a565b60405180910390fd5b505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c11156114e5576000600391509150611583565b60006001878787876040516000815260200160405260405161150a94939291906129a2565b6020604051602081039080840390855afa15801561152c573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361157a57600060019250925050611583565b80600092509250505b94509492505050565b606061159b84846000856115a4565b90509392505050565b6060824710156115e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e090612a59565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516116129190612aea565b60006040518083038185875af1925050503d806000811461164f576040519150601f19603f3d011682016040523d82523d6000602084013e611654565b606091505b509150915061166587838387611671565b92505050949350505050565b606083156116d35760008351036116cb5761168b856116e6565b6116ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c190612b4d565b60405180910390fd5b5b8290506116de565b6116dd8383611709565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60008251111561171c5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117509190612bb1565b60405180910390fd5b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f8401126117925761179161176d565b5b8235905067ffffffffffffffff8111156117af576117ae611772565b5b6020830191508360208202830111156117cb576117ca611777565b5b9250929050565b600080602083850312156117e9576117e8611763565b5b600083013567ffffffffffffffff81111561180757611806611768565b5b6118138582860161177c565b92509250509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061186461185f61185a8461181f565b61183f565b61181f565b9050919050565b600061187682611849565b9050919050565b60006118888261186b565b9050919050565b6118988161187d565b82525050565b60006020820190506118b3600083018461188f565b92915050565b60006118c48261181f565b9050919050565b6118d4816118b9565b81146118df57600080fd5b50565b6000813590506118f1816118cb565b92915050565b6000819050919050565b61190a816118f7565b811461191557600080fd5b50565b60008135905061192781611901565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61197b82611932565b810181811067ffffffffffffffff8211171561199a57611999611943565b5b80604052505050565b60006119ad611759565b90506119b98282611972565b919050565b600067ffffffffffffffff8211156119d9576119d8611943565b5b6119e282611932565b9050602081019050919050565b82818337600083830152505050565b6000611a11611a0c846119be565b6119a3565b905082815260208101848484011115611a2d57611a2c61192d565b5b611a388482856119ef565b509392505050565b600082601f830112611a5557611a5461176d565b5b8135611a658482602086016119fe565b91505092915050565b60008060008060808587031215611a8857611a87611763565b5b6000611a96878288016118e2565b9450506020611aa7878288016118e2565b9350506040611ab887828801611918565b925050606085013567ffffffffffffffff811115611ad957611ad8611768565b5b611ae587828801611a40565b91505092959194509250565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611b2681611af1565b82525050565b6000602082019050611b416000830184611b1d565b92915050565b611b50816118b9565b82525050565b6000602082019050611b6b6000830184611b47565b92915050565b6000611b7c8261186b565b9050919050565b611b8c81611b71565b82525050565b6000602082019050611ba76000830184611b83565b92915050565b60008060408385031215611bc457611bc3611763565b5b6000611bd2858286016118e2565b9250506020611be385828601611918565b9150509250929050565b611bf6816118f7565b82525050565b6000606082019050611c116000830186611bed565b611c1e6020830185611bed565b611c2b6040830184611bed565b949350505050565b600060208284031215611c4957611c48611763565b5b6000611c5784828501611918565b91505092915050565b6000602082019050611c756000830184611bed565b92915050565b600060208284031215611c9157611c90611763565b5b6000611c9f848285016118e2565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611cdd816118f7565b82525050565b606082016000820151611cf96000850182611cd4565b506020820151611d0c6020850182611cd4565b506040820151611d1f6040850182611cd4565b50505050565b6000611d318383611ce3565b60608301905092915050565b6000602082019050919050565b6000611d5582611ca8565b611d5f8185611cb3565b9350611d6a83611cc4565b8060005b83811015611d9b578151611d828882611d25565b9750611d8d83611d3d565b925050600181019050611d6e565b5085935050505092915050565b60006040820190508181036000830152611dc28185611d4a565b9050611dd16020830184611bed565b9392505050565b6000611de3826118b9565b9050919050565b611df381611dd8565b8114611dfe57600080fd5b50565b600081359050611e1081611dea565b92915050565b6000611e21826118b9565b9050919050565b611e3181611e16565b8114611e3c57600080fd5b50565b600081359050611e4e81611e28565b92915050565b600080600060608486031215611e6d57611e6c611763565b5b6000611e7b86828701611e01565b9350506020611e8c86828701611e3f565b9250506040611e9d868287016118e2565b9150509250925092565b60008060008060808587031215611ec157611ec0611763565b5b6000611ecf87828801611918565b9450506020611ee087828801611918565b9350506040611ef187828801611918565b925050606085013567ffffffffffffffff811115611f1257611f11611768565b5b611f1e87828801611a40565b91505092959194509250565b600082825260208201905092915050565b7f6e6f7468696e6720746f207374616b6500000000000000000000000000000000600082015250565b6000611f71601083611f2a565b9150611f7c82611f3b565b602082019050919050565b60006020820190508181036000830152611fa081611f64565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612010826118f7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361204257612041611fd6565b5b600182019050919050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006120a9602e83611f2a565b91506120b48261204d565b604082019050919050565b600060208201905081810360008301526120d88161209c565b9050919050565b6000819050919050565b600060ff82169050919050565b600061211161210c612107846120df565b61183f565b6120e9565b9050919050565b612121816120f6565b82525050565b600060208201905061213c6000830184612118565b92915050565b7f6e6f7468696e6720746f20756e7374616b650000000000000000000000000000600082015250565b6000612178601283611f2a565b915061218382612142565b602082019050919050565b600060208201905081810360008301526121a78161216b565b9050919050565b7f6e6f6e636520616c726561647920757365640000000000000000000000000000600082015250565b60006121e4601283611f2a565b91506121ef826121ae565b602082019050919050565b60006020820190508181036000830152612213816121d7565b9050919050565b60008160601b9050919050565b60006122328261221a565b9050919050565b600061224482612227565b9050919050565b61225c612257826118b9565b612239565b82525050565b6000819050919050565b61227d612278826118f7565b612262565b82525050565b600061228f828761224b565b60148201915061229f828661226c565b6020820191506122af828561226c565b6020820191506122bf828461226c565b60208201915081905095945050505050565b7f696e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b6000612307601183611f2a565b9150612312826122d1565b602082019050919050565b60006020820190508181036000830152612336816122fa565b9050919050565b7f6578706972656400000000000000000000000000000000000000000000000000600082015250565b6000612373600783611f2a565b915061237e8261233d565b602082019050919050565b600060208201905081810360008301526123a281612366565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b60006123df601f83611f2a565b91506123ea826123a9565b602082019050919050565b6000602082019050818103600083015261240e816123d2565b9050919050565b600081519050612424816118cb565b92915050565b6000602082840312156124405761243f611763565b5b600061244e84828501612415565b91505092915050565b7f796f7520646f206e6f74206f776e2074686973206e6674000000000000000000600082015250565b600061248d601783611f2a565b915061249882612457565b602082019050919050565b600060208201905081810360008301526124bc81612480565b9050919050565b60006124ce826118f7565b91506124d9836118f7565b92508282039050818111156124f1576124f0611fd6565b5b92915050565b600060608201905061250c6000830186611b47565b6125196020830185611b47565b6125266040830184611bed565b949350505050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b600061258a602b83611f2a565b91506125958261252e565b604082019050919050565b600060208201905081810360008301526125b98161257d565b9050919050565b7f6e6f207374616b6520746f207769746864726177000000000000000000000000600082015250565b60006125f6601483611f2a565b9150612601826125c0565b602082019050919050565b60006020820190508181036000830152612625816125e9565b9050919050565b7f7374616b6520616c72656164792077697468647261776e000000000000000000600082015250565b6000612662601783611f2a565b915061266d8261262c565b602082019050919050565b6000602082019050818103600083015261269181612655565b9050919050565b60006040820190506126ad6000830185611bed565b6126ba6020830184611bed565b9392505050565b60006040820190506126d66000830185611b47565b6126e36020830184611bed565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b600061274f601883611f2a565b915061275a82612719565b602082019050919050565b6000602082019050818103600083015261277e81612742565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b60006127bb601f83611f2a565b91506127c682612785565b602082019050919050565b600060208201905081810360008301526127ea816127ae565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b600061284d602283611f2a565b9150612858826127f1565b604082019050919050565b6000602082019050818103600083015261287c81612840565b9050919050565b60008115159050919050565b61289881612883565b81146128a357600080fd5b50565b6000815190506128b58161288f565b92915050565b6000602082840312156128d1576128d0611763565b5b60006128df848285016128a6565b91505092915050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000612944602a83611f2a565b915061294f826128e8565b604082019050919050565b6000602082019050818103600083015261297381612937565b9050919050565b6000819050919050565b61298d8161297a565b82525050565b61299c816120e9565b82525050565b60006080820190506129b76000830187612984565b6129c46020830186612993565b6129d16040830185612984565b6129de6060830184612984565b95945050505050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000612a43602683611f2a565b9150612a4e826129e7565b604082019050919050565b60006020820190508181036000830152612a7281612a36565b9050919050565b600081519050919050565b600081905092915050565b60005b83811015612aad578082015181840152602081019050612a92565b60008484015250505050565b6000612ac482612a79565b612ace8185612a84565b9350612ade818560208601612a8f565b80840191505092915050565b6000612af68284612ab9565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000612b37601d83611f2a565b9150612b4282612b01565b602082019050919050565b60006020820190508181036000830152612b6681612b2a565b9050919050565b600081519050919050565b6000612b8382612b6d565b612b8d8185611f2a565b9350612b9d818560208601612a8f565b612ba681611932565b840191505092915050565b60006020820190508181036000830152612bcb8184612b78565b90509291505056fea26469706673582212200ce8ad9e125f5f2ee834e938577d9f352e2d302530ad355b96546b73f07af7f064736f6c63430008120033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.