More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
TrashCan
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; contract TrashCan is IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) public override returns (bytes4) { return this.onERC721Received.selector; } // Optional: A function to check if a token is locked in the contract function isTokenLocked(address tokenContract, uint256 tokenId) public view returns (bool) { IERC721 erc721 = IERC721(tokenContract); return erc721.ownerOf(tokenId) == address(this); } }
// 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.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.6.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 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 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); }
{ "remappings": [], "optimizer": { "details": { "constantOptimizer": true, "cse": true, "deduplicate": true, "inliner": true, "jumpdestRemover": true, "orderLiterals": true, "peephole": true, "yul": false }, "runs": 200 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isTokenLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50610323806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063150b7a021461003b5780637ae1ccf914610070575b600080fd5b61005a6100493660046101ae565b630a85bd0160e11b95945050505050565b6040516100679190610244565b60405180910390f35b61008361007e366004610252565b610090565b6040516100679190610297565b6040516331a9108f60e11b8152600090839030906001600160a01b03831690636352211e906100c39087906004016102ab565b602060405180830381865afa1580156100e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010491906102c4565b6001600160a01b0316149150505b92915050565b60006001600160a01b038216610112565b61013281610118565b811461013d57600080fd5b50565b803561011281610129565b80610132565b80356101128161014b565b60008083601f84011261017157610171600080fd5b50813567ffffffffffffffff81111561018c5761018c600080fd5b6020830191508360018202830111156101a7576101a7600080fd5b9250929050565b6000806000806000608086880312156101c9576101c9600080fd5b60006101d58888610140565b95505060206101e688828901610140565b94505060406101f788828901610151565b935050606086013567ffffffffffffffff81111561021757610217600080fd5b6102238882890161015c565b92509250509295509295909350565b6001600160e01b031981165b82525050565b602081016101128284610232565b6000806040838503121561026857610268600080fd5b60006102748585610140565b925050602061028585828601610151565b9150509250929050565b80151561023e565b60208101610112828461028f565b8061023e565b6020810161011282846102a5565b805161011281610129565b6000602082840312156102d9576102d9600080fd5b60006102e584846102b9565b94935050505056fea264697066735822122095e7360930cc4c3600a8b70e96d8cc5647b687f3159bf3a4a26a5b3b32d5f73c64736f6c634300080a0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063150b7a021461003b5780637ae1ccf914610070575b600080fd5b61005a6100493660046101ae565b630a85bd0160e11b95945050505050565b6040516100679190610244565b60405180910390f35b61008361007e366004610252565b610090565b6040516100679190610297565b6040516331a9108f60e11b8152600090839030906001600160a01b03831690636352211e906100c39087906004016102ab565b602060405180830381865afa1580156100e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010491906102c4565b6001600160a01b0316149150505b92915050565b60006001600160a01b038216610112565b61013281610118565b811461013d57600080fd5b50565b803561011281610129565b80610132565b80356101128161014b565b60008083601f84011261017157610171600080fd5b50813567ffffffffffffffff81111561018c5761018c600080fd5b6020830191508360018202830111156101a7576101a7600080fd5b9250929050565b6000806000806000608086880312156101c9576101c9600080fd5b60006101d58888610140565b95505060206101e688828901610140565b94505060406101f788828901610151565b935050606086013567ffffffffffffffff81111561021757610217600080fd5b6102238882890161015c565b92509250509295509295909350565b6001600160e01b031981165b82525050565b602081016101128284610232565b6000806040838503121561026857610268600080fd5b60006102748585610140565b925050602061028585828601610151565b9150509250929050565b80151561023e565b60208101610112828461028f565b8061023e565b6020810161011282846102a5565b805161011281610129565b6000602082840312156102d9576102d9600080fd5b60006102e584846102b9565b94935050505056fea264697066735822122095e7360930cc4c3600a8b70e96d8cc5647b687f3159bf3a4a26a5b3b32d5f73c64736f6c634300080a0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
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.