More Info
Private Name Tags
Latest 25 from a total of 161 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Unstake | 18456833 | 375 days ago | IN | 0 ETH | 0.0003525 | ||||
Unstake | 18456828 | 375 days ago | IN | 0 ETH | 0.00210825 | ||||
Claim | 18456814 | 375 days ago | IN | 0 ETH | 0.00140247 | ||||
Claim | 18170232 | 415 days ago | IN | 0 ETH | 0.00090683 | ||||
Unstake | 17780809 | 470 days ago | IN | 0 ETH | 0.00165911 | ||||
Claim | 17780804 | 470 days ago | IN | 0 ETH | 0.00096371 | ||||
Unstake | 16842392 | 602 days ago | IN | 0 ETH | 0.00556582 | ||||
Claim | 16842378 | 602 days ago | IN | 0 ETH | 0.00240708 | ||||
Unstake | 16322383 | 675 days ago | IN | 0 ETH | 0.0036552 | ||||
Claim | 16236040 | 687 days ago | IN | 0 ETH | 0.00098596 | ||||
Claim | 16235329 | 687 days ago | IN | 0 ETH | 0.00088963 | ||||
Claim | 16142413 | 700 days ago | IN | 0 ETH | 0.00069269 | ||||
Claim | 16025643 | 716 days ago | IN | 0 ETH | 0.00114414 | ||||
Claim | 15978936 | 723 days ago | IN | 0 ETH | 0.00272303 | ||||
Unstake | 15971013 | 724 days ago | IN | 0 ETH | 0.00228925 | ||||
Claim | 15971003 | 724 days ago | IN | 0 ETH | 0.00194448 | ||||
Claim | 15835191 | 743 days ago | IN | 0 ETH | 0.00077454 | ||||
Claim | 15761906 | 753 days ago | IN | 0 ETH | 0.00084376 | ||||
Unstake | 15725745 | 758 days ago | IN | 0 ETH | 0.00269774 | ||||
Claim | 15684981 | 764 days ago | IN | 0 ETH | 0.00133844 | ||||
Claim | 15684814 | 764 days ago | IN | 0 ETH | 0.00028663 | ||||
Claim | 15684790 | 764 days ago | IN | 0 ETH | 0.00032477 | ||||
Claim | 15684292 | 764 days ago | IN | 0 ETH | 0.00104491 | ||||
Unstake | 15661764 | 767 days ago | IN | 0 ETH | 0.00053822 | ||||
Claim | 15652728 | 768 days ago | IN | 0 ETH | 0.00038262 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
ZSCstakingvault
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.4; import "https://github.com/net2devcrypto/n2dstaking/N2DRewards.sol"; import "https://github.com/net2devcrypto/n2dstaking/Collection.sol"; contract ZSCstakingvault is Ownable, IERC721Receiver { uint256 public totalStaked; // struct to store a stake's token, owner, and earning values struct Stake { uint24 tokenId; uint48 timestamp; address owner; } event NFTStaked(address owner, uint256 tokenId, uint256 value); event NFTUnstaked(address owner, uint256 tokenId, uint256 value); event Claimed(address owner, uint256 amount); // reference to the Block NFT contract Collection nft; N2DRewards token; // maps tokenId to stake mapping(uint256 => Stake) public vault; constructor(Collection _nft, N2DRewards _token) { nft = _nft; token = _token; } function stake(uint256[] calldata tokenIds) external { uint256 tokenId; totalStaked += tokenIds.length; for (uint i = 0; i < tokenIds.length; i++) { tokenId = tokenIds[i]; require(nft.ownerOf(tokenId) == msg.sender, "not your token"); require(vault[tokenId].tokenId == 0, 'already staked'); nft.transferFrom(msg.sender, address(this), tokenId); emit NFTStaked(msg.sender, tokenId, block.timestamp); vault[tokenId] = Stake({ owner: msg.sender, tokenId: uint24(tokenId), timestamp: uint48(block.timestamp) }); } } function _unstakeMany(address account, uint256[] calldata tokenIds) internal { uint256 tokenId; totalStaked -= tokenIds.length; for (uint i = 0; i < tokenIds.length; i++) { tokenId = tokenIds[i]; Stake memory staked = vault[tokenId]; require(staked.owner == msg.sender, "not an owner"); delete vault[tokenId]; emit NFTUnstaked(account, tokenId, block.timestamp); nft.transferFrom(address(this), account, tokenId); } } function claim(uint256[] calldata tokenIds) external { _claim(msg.sender, tokenIds, false); } function claimForAddress(address account, uint256[] calldata tokenIds) external { _claim(account, tokenIds, false); } function unstake(uint256[] calldata tokenIds) external { _claim(msg.sender, tokenIds, true); } function _claim(address account, uint256[] calldata tokenIds, bool _unstake) internal { uint256 tokenId; uint256 earned = 0; for (uint i = 0; i < tokenIds.length; i++) { tokenId = tokenIds[i]; Stake memory staked = vault[tokenId]; require(staked.owner == account, "not an owner"); uint256 stakedAt = staked.timestamp; earned += 10000 ether * (block.timestamp - stakedAt) / 1 days; vault[tokenId] = Stake({ owner: account, tokenId: uint24(tokenId), timestamp: uint48(block.timestamp) }); } if (earned > 0) { earned = earned / 10; token.mint(account, earned); } if (_unstake) { _unstakeMany(account, tokenIds); } emit Claimed(account, earned); } function earningInfo(uint256[] calldata tokenIds) external view returns (uint256[2] memory info) { uint256 tokenId; uint256 totalScore = 0; uint256 earned = 0; Stake memory staked = vault[tokenId]; uint256 stakedAt = staked.timestamp; earned += 10000 ether * (block.timestamp - stakedAt) / 1 days; uint256 earnRatePerSecond = totalScore * 1 ether / 1 days; earnRatePerSecond = earnRatePerSecond / 10000; //earned, earnRatePerSecond return [earned, earnRatePerSecond]; } // should never be used inside of transaction because of gas fee function balanceOf(address account) public view returns (uint256) { uint256 balance = 0; uint256 supply = nft.totalSupply(); for(uint i = 1; i <= supply; i++) { if (vault[i].owner == account) { balance += 1; } } return balance; } // should never be used inside of transaction because of gas fee function tokensOfOwner(address account) public view returns (uint256[] memory ownerTokens) { uint256 supply = nft.totalSupply(); uint256[] memory tmp = new uint256[](supply); uint256 index = 0; for(uint tokenId = 1; tokenId <= supply; tokenId++) { if (vault[tokenId].owner == account) { tmp[index] = vault[tokenId].tokenId; index +=1; } } uint256[] memory tokens = new uint256[](index); for(uint i = 0; i < index; i++) { tokens[i] = tmp[i]; } return tokens; } function onERC721Received( address, address from, uint256, bytes calldata ) external pure override returns (bytes4) { require(from == address(0x0), "Cannot send nfts to Vault directly"); return IERC721Receiver.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT LICENSE // File: @openzeppelin/contracts/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); } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol pragma solidity ^0.8.0; /** * @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`, 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 be 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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * 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 Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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 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); /** * @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; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/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 `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Context.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol pragma solidity ^0.8.0; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } import "@openzeppelin/contracts/access/Ownable.sol"; pragma solidity ^0.8.0; contract Collection is ERC721Enumerable, Ownable { using Strings for uint256; string public baseURI; string public baseExtension = ".json"; uint256 public cost = 0.001 ether; uint256 public maxSupply = 100000; uint256 public maxMintAmount = 5; bool public paused = false; constructor() ERC721("Net2Dev NFT Collection", "N2D") {} // internal function _baseURI() internal view virtual override returns (string memory) { return "ipfs://EE5MmqVp5MmqVp7ZRMBBizicVh9ficVh9fjUofWicVh9f/"; } // public function mint(address _to, uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { require(msg.value == cost * _mintAmount, "Need to send 0.08 ether!"); } for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(_to, supply + i); } } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } // only owner function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner() { maxMintAmount = _newmaxMintAmount; } function setBaseURI(string memory _newBaseURI) public onlyOwner() { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner() { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner() { paused = _state; } function withdraw() public payable onlyOwner() { require(payable(msg.sender).send(address(this).balance)); } }
// SPDX-License-Identifier: MIT LICENSE pragma solidity 0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; contract N2DRewards is ERC20, ERC20Burnable, Ownable { mapping(address => bool) controllers; constructor() ERC20("N2DRewards", "N2DR") { } function mint(address to, uint256 amount) external { require(controllers[msg.sender], "Only controllers can mint"); _mint(to, amount); } function burnFrom(address account, uint256 amount) public override { if (controllers[msg.sender]) { _burn(account, amount); } else { super.burnFrom(account, amount); } } function addController(address controller) external onlyOwner { controllers[controller] = true; } function removeController(address controller) external onlyOwner { controllers[controller] = false; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract Collection","name":"_nft","type":"address"},{"internalType":"contract N2DRewards","name":"_token","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"NFTStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"NFTUnstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"claimForAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"earningInfo","outputs":[{"internalType":"uint256[2]","name":"info","type":"uint256[2]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"ownerTokens","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vault","outputs":[{"internalType":"uint24","name":"tokenId","type":"uint24"},{"internalType":"uint48","name":"timestamp","type":"uint48"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051620014a4380380620014a4833981016040819052610031916100bb565b61003a3361006b565b600280546001600160a01b039384166001600160a01b0319918216179091556003805492909316911617905561010c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100cd578182fd5b82516100d8816100f4565b60208401519092506100e9816100f4565b809150509250929050565b6001600160a01b038116811461010957600080fd5b50565b611388806200011c6000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063817b1cd21161008c5780638da5cb5b116100665780638da5cb5b14610217578063c36be35714610232578063e449f34114610245578063f2fde38b1461025857600080fd5b8063817b1cd21461017657806381a36fb61461017f5780638462151c146101f757600080fd5b80630fbf0a93146100d4578063150b7a02146100e95780633562b0861461011a5780636ba4c1381461013a57806370a082311461014d578063715018a61461016e575b600080fd5b6100e76100e23660046111b9565b61026b565b005b6100fc6100f73660046110cc565b61053a565b6040516001600160e01b031990911681526020015b60405180910390f35b61012d6101283660046111b9565b6105b0565b6040516101119190611229565b6100e76101483660046111b9565b6106b0565b61016061015b36600461108d565b6106c1565b604051908152602001610111565b6100e76107ae565b61016060015481565b6101c661018d3660046111f9565b60046020526000908152604090205462ffffff8116906301000000810465ffffffffffff1690600160481b90046001600160a01b031683565b6040805162ffffff909416845265ffffffffffff90921660208401526001600160a01b031690820152606001610111565b61020a61020536600461108d565b610814565b604051610111919061125a565b6000546040516001600160a01b039091168152602001610111565b6100e7610240366004611166565b610a5e565b6100e76102533660046111b9565b610a70565b6100e761026636600461108d565b610a7d565b60008282905060016000828254610282919061129e565b90915550600090505b82811015610534578383828181106102b357634e487b7160e01b600052603260045260246000fd5b6002546040516331a9108f60e11b8152602092909202939093013560048201819052945033926001600160a01b03169150636352211e9060240160206040518083038186803b15801561030557600080fd5b505afa158015610319573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033d91906110b0565b6001600160a01b0316146103895760405162461bcd60e51b815260206004820152600e60248201526d3737ba103cb7bab9103a37b5b2b760911b60448201526064015b60405180910390fd5b60008281526004602052604090205462ffffff16156103db5760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e481cdd185ad95960921b6044820152606401610380565b6002546040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b03909116906323b872dd90606401600060405180830381600087803b15801561042d57600080fd5b505af1158015610441573d6000803e3d6000fd5b50506040805133815260208101869052428183015290517f36b3725f1783bad4ff05b7f4c077c3aa68eeb23a4d054ba189db4d01ac278d399350908190036060019150a16040805160608101825262ffffff808516825265ffffffffffff4281166020808501918252338587019081526000898152600490925295902093518454915195516001600160a01b0316600160481b027fffffff0000000000000000000000000000000000000000ffffffffffffffffff9690931663010000000268ffffffffffffffffff1990921693169290921791909117929092169190911790558061052c8161130c565b91505061028b565b50505050565b60006001600160a01b0385161561059e5760405162461bcd60e51b815260206004820152602260248201527f43616e6e6f742073656e64206e66747320746f205661756c74206469726563746044820152616c7960f01b6064820152608401610380565b50630a85bd0160e11b95945050505050565b6105b8611025565b600080805260046020908152604080516060810182527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec5462ffffff811682526301000000810465ffffffffffff16938201849052600160481b90046001600160a01b03169181019190915282918291906201518061063782426112f5565b61064b9069021e19e0c9bab24000006112d6565b61065591906112b6565b61065f908461129e565b925060006201518061067986670de0b6b3a76400006112d6565b61068391906112b6565b9050610691612710826112b6565b6040805180820190915294855260208501525091979650505050505050565b6106bd3383836000610b48565b5050565b600080600090506000600260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561071857600080fd5b505afa15801561072c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107509190611211565b905060015b8181116107a5576000818152600460205260409020546001600160a01b03868116600160481b9092041614156107935761079060018461129e565b92505b8061079d8161130c565b915050610755565b50909392505050565b6000546001600160a01b031633146108085760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610380565b6108126000610e07565b565b60606000600260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561086657600080fd5b505afa15801561087a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089e9190611211565b905060008167ffffffffffffffff8111156108c957634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156108f2578160200160208202803683370190505b509050600060015b83811161098e576000818152600460205260409020546001600160a01b03878116600160481b90920416141561097c57600081815260046020526040902054835162ffffff9091169084908490811061096357634e487b7160e01b600052603260045260246000fd5b602090810291909101015261097960018361129e565b91505b806109868161130c565b9150506108fa565b5060008167ffffffffffffffff8111156109b857634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156109e1578160200160208202803683370190505b50905060005b82811015610a5457838181518110610a0f57634e487b7160e01b600052603260045260246000fd5b6020026020010151828281518110610a3757634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610a4c8161130c565b9150506109e7565b5095945050505050565b610a6b8383836000610b48565b505050565b6106bd3383836001610b48565b6000546001600160a01b03163314610ad75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610380565b6001600160a01b038116610b3c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610380565b610b4581610e07565b50565b600080805b84811015610d3157858582818110610b7557634e487b7160e01b600052603260045260246000fd5b602090810292909201356000818152600484526040908190208151606081018352905462ffffff8116825265ffffffffffff6301000000820416958201959095526001600160a01b03600160481b909504851691810182905291965090928a16149050610c135760405162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71037bbb732b960a11b6044820152606401610380565b602081015165ffffffffffff1662015180610c2e82426112f5565b610c429069021e19e0c9bab24000006112d6565b610c4c91906112b6565b610c56908561129e565b935060405180606001604052808662ffffff1681526020014265ffffffffffff1681526020018a6001600160a01b03168152506004600087815260200190815260200160002060008201518160000160006101000a81548162ffffff021916908362ffffff16021790555060208201518160000160036101000a81548165ffffffffffff021916908365ffffffffffff16021790555060408201518160000160096101000a8154816001600160a01b0302191690836001600160a01b0316021790555090505050508080610d299061130c565b915050610b4d565b508015610dac57610d43600a826112b6565b6003546040516340c10f1960e01b81526001600160a01b038981166004830152602482018490529293509116906340c10f1990604401600060405180830381600087803b158015610d9357600080fd5b505af1158015610da7573d6000803e3d6000fd5b505050505b8215610dbd57610dbd868686610e57565b604080516001600160a01b0388168152602081018390527fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a910160405180910390a1505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008282905060016000828254610e6e91906112f5565b90915550600090505b8281101561101e57838382818110610e9f57634e487b7160e01b600052603260045260246000fd5b602090810292909201356000818152600484526040908190208151606081018352905462ffffff811682526301000000810465ffffffffffff1695820195909552600160481b9094046001600160a01b031690840181905290945033149050610f395760405162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71037bbb732b960a11b6044820152606401610380565b60008381526004602090815260409182902080546001600160e81b031916905581516001600160a01b0389168152908101859052428183015290517fc486b9458a8637650d84d262414833a5a457bc91ae86b7da110386c8c3fa255b9181900360600190a16002546040516323b872dd60e01b81523060048201526001600160a01b03888116602483015260448201869052909116906323b872dd90606401600060405180830381600087803b158015610ff257600080fd5b505af1158015611006573d6000803e3d6000fd5b505050505080806110169061130c565b915050610e77565b5050505050565b60405180604001604052806002906020820280368337509192915050565b60008083601f840112611054578182fd5b50813567ffffffffffffffff81111561106b578182fd5b6020830191508360208260051b850101111561108657600080fd5b9250929050565b60006020828403121561109e578081fd5b81356110a98161133d565b9392505050565b6000602082840312156110c1578081fd5b81516110a98161133d565b6000806000806000608086880312156110e3578081fd5b85356110ee8161133d565b945060208601356110fe8161133d565b935060408601359250606086013567ffffffffffffffff80821115611121578283fd5b818801915088601f830112611134578283fd5b813581811115611142578384fd5b896020828501011115611153578384fd5b9699959850939650602001949392505050565b60008060006040848603121561117a578283fd5b83356111858161133d565b9250602084013567ffffffffffffffff8111156111a0578283fd5b6111ac86828701611043565b9497909650939450505050565b600080602083850312156111cb578182fd5b823567ffffffffffffffff8111156111e1578283fd5b6111ed85828601611043565b90969095509350505050565b60006020828403121561120a578081fd5b5035919050565b600060208284031215611222578081fd5b5051919050565b60408101818360005b6002811015611251578151835260209283019290910190600101611232565b50505092915050565b6020808252825182820181905260009190848201906040850190845b8181101561129257835183529284019291840191600101611276565b50909695505050505050565b600082198211156112b1576112b1611327565b500190565b6000826112d157634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156112f0576112f0611327565b500290565b60008282101561130757611307611327565b500390565b600060001982141561132057611320611327565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610b4557600080fdfea264697066735822122016c0de0e8817fdf7ebcf9373853978cafcdfacd43a1bfef6fcca87a13648563d64736f6c63430008040033000000000000000000000000eceb6268f75174887a233112fc8bb9f8149ce45d0000000000000000000000005e4a0c8691dbdd685d0031c8cd31bc298f0f2c6f
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063817b1cd21161008c5780638da5cb5b116100665780638da5cb5b14610217578063c36be35714610232578063e449f34114610245578063f2fde38b1461025857600080fd5b8063817b1cd21461017657806381a36fb61461017f5780638462151c146101f757600080fd5b80630fbf0a93146100d4578063150b7a02146100e95780633562b0861461011a5780636ba4c1381461013a57806370a082311461014d578063715018a61461016e575b600080fd5b6100e76100e23660046111b9565b61026b565b005b6100fc6100f73660046110cc565b61053a565b6040516001600160e01b031990911681526020015b60405180910390f35b61012d6101283660046111b9565b6105b0565b6040516101119190611229565b6100e76101483660046111b9565b6106b0565b61016061015b36600461108d565b6106c1565b604051908152602001610111565b6100e76107ae565b61016060015481565b6101c661018d3660046111f9565b60046020526000908152604090205462ffffff8116906301000000810465ffffffffffff1690600160481b90046001600160a01b031683565b6040805162ffffff909416845265ffffffffffff90921660208401526001600160a01b031690820152606001610111565b61020a61020536600461108d565b610814565b604051610111919061125a565b6000546040516001600160a01b039091168152602001610111565b6100e7610240366004611166565b610a5e565b6100e76102533660046111b9565b610a70565b6100e761026636600461108d565b610a7d565b60008282905060016000828254610282919061129e565b90915550600090505b82811015610534578383828181106102b357634e487b7160e01b600052603260045260246000fd5b6002546040516331a9108f60e11b8152602092909202939093013560048201819052945033926001600160a01b03169150636352211e9060240160206040518083038186803b15801561030557600080fd5b505afa158015610319573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033d91906110b0565b6001600160a01b0316146103895760405162461bcd60e51b815260206004820152600e60248201526d3737ba103cb7bab9103a37b5b2b760911b60448201526064015b60405180910390fd5b60008281526004602052604090205462ffffff16156103db5760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e481cdd185ad95960921b6044820152606401610380565b6002546040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b03909116906323b872dd90606401600060405180830381600087803b15801561042d57600080fd5b505af1158015610441573d6000803e3d6000fd5b50506040805133815260208101869052428183015290517f36b3725f1783bad4ff05b7f4c077c3aa68eeb23a4d054ba189db4d01ac278d399350908190036060019150a16040805160608101825262ffffff808516825265ffffffffffff4281166020808501918252338587019081526000898152600490925295902093518454915195516001600160a01b0316600160481b027fffffff0000000000000000000000000000000000000000ffffffffffffffffff9690931663010000000268ffffffffffffffffff1990921693169290921791909117929092169190911790558061052c8161130c565b91505061028b565b50505050565b60006001600160a01b0385161561059e5760405162461bcd60e51b815260206004820152602260248201527f43616e6e6f742073656e64206e66747320746f205661756c74206469726563746044820152616c7960f01b6064820152608401610380565b50630a85bd0160e11b95945050505050565b6105b8611025565b600080805260046020908152604080516060810182527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec5462ffffff811682526301000000810465ffffffffffff16938201849052600160481b90046001600160a01b03169181019190915282918291906201518061063782426112f5565b61064b9069021e19e0c9bab24000006112d6565b61065591906112b6565b61065f908461129e565b925060006201518061067986670de0b6b3a76400006112d6565b61068391906112b6565b9050610691612710826112b6565b6040805180820190915294855260208501525091979650505050505050565b6106bd3383836000610b48565b5050565b600080600090506000600260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561071857600080fd5b505afa15801561072c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107509190611211565b905060015b8181116107a5576000818152600460205260409020546001600160a01b03868116600160481b9092041614156107935761079060018461129e565b92505b8061079d8161130c565b915050610755565b50909392505050565b6000546001600160a01b031633146108085760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610380565b6108126000610e07565b565b60606000600260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561086657600080fd5b505afa15801561087a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089e9190611211565b905060008167ffffffffffffffff8111156108c957634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156108f2578160200160208202803683370190505b509050600060015b83811161098e576000818152600460205260409020546001600160a01b03878116600160481b90920416141561097c57600081815260046020526040902054835162ffffff9091169084908490811061096357634e487b7160e01b600052603260045260246000fd5b602090810291909101015261097960018361129e565b91505b806109868161130c565b9150506108fa565b5060008167ffffffffffffffff8111156109b857634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156109e1578160200160208202803683370190505b50905060005b82811015610a5457838181518110610a0f57634e487b7160e01b600052603260045260246000fd5b6020026020010151828281518110610a3757634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610a4c8161130c565b9150506109e7565b5095945050505050565b610a6b8383836000610b48565b505050565b6106bd3383836001610b48565b6000546001600160a01b03163314610ad75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610380565b6001600160a01b038116610b3c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610380565b610b4581610e07565b50565b600080805b84811015610d3157858582818110610b7557634e487b7160e01b600052603260045260246000fd5b602090810292909201356000818152600484526040908190208151606081018352905462ffffff8116825265ffffffffffff6301000000820416958201959095526001600160a01b03600160481b909504851691810182905291965090928a16149050610c135760405162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71037bbb732b960a11b6044820152606401610380565b602081015165ffffffffffff1662015180610c2e82426112f5565b610c429069021e19e0c9bab24000006112d6565b610c4c91906112b6565b610c56908561129e565b935060405180606001604052808662ffffff1681526020014265ffffffffffff1681526020018a6001600160a01b03168152506004600087815260200190815260200160002060008201518160000160006101000a81548162ffffff021916908362ffffff16021790555060208201518160000160036101000a81548165ffffffffffff021916908365ffffffffffff16021790555060408201518160000160096101000a8154816001600160a01b0302191690836001600160a01b0316021790555090505050508080610d299061130c565b915050610b4d565b508015610dac57610d43600a826112b6565b6003546040516340c10f1960e01b81526001600160a01b038981166004830152602482018490529293509116906340c10f1990604401600060405180830381600087803b158015610d9357600080fd5b505af1158015610da7573d6000803e3d6000fd5b505050505b8215610dbd57610dbd868686610e57565b604080516001600160a01b0388168152602081018390527fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a910160405180910390a1505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008282905060016000828254610e6e91906112f5565b90915550600090505b8281101561101e57838382818110610e9f57634e487b7160e01b600052603260045260246000fd5b602090810292909201356000818152600484526040908190208151606081018352905462ffffff811682526301000000810465ffffffffffff1695820195909552600160481b9094046001600160a01b031690840181905290945033149050610f395760405162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71037bbb732b960a11b6044820152606401610380565b60008381526004602090815260409182902080546001600160e81b031916905581516001600160a01b0389168152908101859052428183015290517fc486b9458a8637650d84d262414833a5a457bc91ae86b7da110386c8c3fa255b9181900360600190a16002546040516323b872dd60e01b81523060048201526001600160a01b03888116602483015260448201869052909116906323b872dd90606401600060405180830381600087803b158015610ff257600080fd5b505af1158015611006573d6000803e3d6000fd5b505050505080806110169061130c565b915050610e77565b5050505050565b60405180604001604052806002906020820280368337509192915050565b60008083601f840112611054578182fd5b50813567ffffffffffffffff81111561106b578182fd5b6020830191508360208260051b850101111561108657600080fd5b9250929050565b60006020828403121561109e578081fd5b81356110a98161133d565b9392505050565b6000602082840312156110c1578081fd5b81516110a98161133d565b6000806000806000608086880312156110e3578081fd5b85356110ee8161133d565b945060208601356110fe8161133d565b935060408601359250606086013567ffffffffffffffff80821115611121578283fd5b818801915088601f830112611134578283fd5b813581811115611142578384fd5b896020828501011115611153578384fd5b9699959850939650602001949392505050565b60008060006040848603121561117a578283fd5b83356111858161133d565b9250602084013567ffffffffffffffff8111156111a0578283fd5b6111ac86828701611043565b9497909650939450505050565b600080602083850312156111cb578182fd5b823567ffffffffffffffff8111156111e1578283fd5b6111ed85828601611043565b90969095509350505050565b60006020828403121561120a578081fd5b5035919050565b600060208284031215611222578081fd5b5051919050565b60408101818360005b6002811015611251578151835260209283019290910190600101611232565b50505092915050565b6020808252825182820181905260009190848201906040850190845b8181101561129257835183529284019291840191600101611276565b50909695505050505050565b600082198211156112b1576112b1611327565b500190565b6000826112d157634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156112f0576112f0611327565b500290565b60008282101561130757611307611327565b500390565b600060001982141561132057611320611327565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610b4557600080fdfea264697066735822122016c0de0e8817fdf7ebcf9373853978cafcdfacd43a1bfef6fcca87a13648563d64736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000eceb6268f75174887a233112fc8bb9f8149ce45d0000000000000000000000005e4a0c8691dbdd685d0031c8cd31bc298f0f2c6f
-----Decoded View---------------
Arg [0] : _nft (address): 0xECEB6268F75174887a233112fc8bB9F8149CE45D
Arg [1] : _token (address): 0x5E4a0c8691dBdd685D0031C8Cd31Bc298F0F2C6f
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000eceb6268f75174887a233112fc8bb9f8149ce45d
Arg [1] : 0000000000000000000000005e4a0c8691dbdd685d0031c8cd31bc298f0f2c6f
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 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.