More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 12447752 | 1097 days ago | IN | Create: ERC721NFT2ERC20Receiver | 0 ETH | 0.06458773 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
ERC721NFT2ERC20Receiver
Compiler Version
v0.8.3+commit.8d00100c
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; /// @author: manifold.xyz import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import "../INFT2ERC20.sol"; contract ERC721NFT2ERC20Receiver is IERC721Receiver { address private _nft2erc20; mapping (address => bool) private _approved; constructor (address nft2erc20) { require(ERC165Checker.supportsInterface(nft2erc20, type(INFT2ERC20).interfaceId), "ERC721NFT2ERC20Receiver: Must implement INFT2ERC20"); _nft2erc20 = nft2erc20; } /* * @dev See {IERC721Receiver-onERC721Received}. */ function onERC721Received( address, address from, uint256 tokenId, bytes calldata ) external override returns(bytes4) { if (!_approved[msg.sender]) { IERC721(msg.sender).setApprovalForAll(_nft2erc20, true); _approved[msg.sender] = true; } uint256[] memory args = new uint256[](1); args[0] = tokenId; INFT2ERC20(_nft2erc20).burnToken(msg.sender, args, 'erc721', from); return this.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT 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`, 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; }
// SPDX-License-Identifier: MIT 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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Library used to query support of an interface declared via {IERC165}. * * Note that these functions return the actual result of the query: they do not * `revert` if an interface is not supported. It is up to the caller to decide * what to do in these cases. */ library ERC165Checker { // As per the EIP-165 spec, no interface should ever match 0xffffffff bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; /** * @dev Returns true if `account` supports the {IERC165} interface, */ function supportsERC165(address account) internal view returns (bool) { // Any contract that implements ERC165 must explicitly indicate support of // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid return _supportsERC165Interface(account, type(IERC165).interfaceId) && !_supportsERC165Interface(account, _INTERFACE_ID_INVALID); } /** * @dev Returns true if `account` supports the interface defined by * `interfaceId`. Support for {IERC165} itself is queried automatically. * * See {IERC165-supportsInterface}. */ function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) { // query support of both ERC165 as per the spec and support of _interfaceId return supportsERC165(account) && _supportsERC165Interface(account, interfaceId); } /** * @dev Returns a boolean array where each value corresponds to the * interfaces passed in and whether they're supported or not. This allows * you to batch check interfaces for a contract where your expectation * is that some interfaces may not be supported. * * See {IERC165-supportsInterface}. * * _Available since v3.4._ */ function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) { // an array of booleans corresponding to interfaceIds and whether they're supported or not bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length); // query support of ERC165 itself if (supportsERC165(account)) { // query support of each interface in interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]); } } return interfaceIdsSupported; } /** * @dev Returns true if `account` supports all the interfaces defined in * `interfaceIds`. Support for {IERC165} itself is queried automatically. * * Batch-querying can lead to gas savings by skipping repeated checks for * {IERC165} support. * * See {IERC165-supportsInterface}. */ function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) { // query support of ERC165 itself if (!supportsERC165(account)) { return false; } // query support of each interface in _interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { if (!_supportsERC165Interface(account, interfaceIds[i])) { return false; } } // all interfaces supported return true; } /** * @notice Query if a contract implements an interface, does not check ERC165 support * @param account The address of the contract to query for support of an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @return true if the contract at account indicates support of the interface with * identifier interfaceId, false otherwise * @dev Assumes that account contains a contract that supports ERC165, otherwise * the behavior of this method is undefined. This precondition can be checked * with {supportsERC165}. * Interface identification is specified in ERC-165. */ function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { bytes memory encodedParams = abi.encodeWithSelector(IERC165(account).supportsInterface.selector, interfaceId); (bool success, bytes memory result) = account.staticcall{ gas: 30000 }(encodedParams); if (result.length < 32) return false; return success && abi.decode(result, (bool)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; /// @author: manifold.xyz import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./access/IAdminControl.sol"; interface INFT2ERC20 is IAdminControl, IERC20 { event Swapped(address indexed account, address indexed tokenContract, uint256[] args, string spec, uint256 rate); event RateEngineUpdated(address sender, address rateEngine); event TreasuryUpdated(address sender, address treasury, uint128 basisPoints); event TransferSpecUpdated(address sender, string spec, bytes4 transferFunction); /* * @dev sets the contract used to get NFT to ERC20 conversion rate values */ function setRateEngine(address rateEngine) external; /* * @dev sets the amount of tokens the treasury gets on every burn */ function setTreasury(address treasury, uint128 basisPoints) external; /* * @dev gets the treasury configuration */ function getTreasury() external view returns(address, uint128); /* * @dev gets the rate engine */ function getRateEngine() external view returns(address); /* * @dev sets the transfer function of a given spec */ function setTransferFunction(string calldata spec, bytes4 transferFunction) external; /* * @dev burns an NFT token and gives the caller ERC20 */ function burnToken(address tokenContract, uint256[] calldata args, string calldata spec) external; /* * @dev burns an NFT token and gives the caller ERC20 */ function burnToken(address tokenContract, uint256[] calldata args, string calldata spec, address receiver) external; }
// SPDX-License-Identifier: MIT 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 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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, 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); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Admin control interface */ interface IAdminControl is IERC165 { event AdminApproved(address indexed account, address indexed sender); event AdminRevoked(address indexed account, address indexed sender); /** * @dev gets address of all admins */ function getAdmins() external view returns (address[] memory); /** * @dev add an admin. Can only be called by contract owner. */ function approveAdmin(address admin) external; /** * @dev remove an admin. Can only be called by contract owner. */ function revokeAdmin(address admin) external; /** * @dev checks whether or not given address is an admin * Returns True if they are */ function isAdmin(address admin) external view returns (bool); }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"nft2erc20","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405161085138038061085183398101604081905261002f9161021b565b61004a81630f21484360e01b6100da60201b61023d1760201c565b6100b55760405162461bcd60e51b815260206004820152603260248201527f4552433732314e465432455243323052656365697665723a204d75737420696d6044820152710706c656d656e7420494e46543245524332360741b606482015260840160405180910390fd5b600080546001600160a01b0319166001600160a01b03929092169190911790556102a2565b60006100e5836100ff565b80156100f657506100f68383610132565b90505b92915050565b6000610112826301ffc9a760e01b610132565b80156100f9575061012b826001600160e01b0319610132565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b0387169061753090610199908690610269565b6000604051808303818686fa925050503d80600081146101d5576040519150601f19603f3d011682016040523d82523d6000602084013e6101da565b606091505b50915091506020815110156101f557600093505050506100f9565b8180156102115750808060200190518101906102119190610249565b9695505050505050565b60006020828403121561022c578081fd5b81516001600160a01b0381168114610242578182fd5b9392505050565b60006020828403121561025a578081fd5b81518015158114610242578182fd5b60008251815b81811015610289576020818601810151858301520161026f565b818111156102975782828501525b509190910192915050565b6105a0806102b16000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063150b7a0214610030575b600080fd5b61004361003e3660046103dd565b610078565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200160405180910390f35b3360009081526001602052604081205460ff1661012a576000546040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260016024820152339063a22cb46590604401600060405180830381600087803b1580156100f457600080fd5b505af1158015610108573d6000803e3d6000fd5b5050336000908152600160208190526040909120805460ff1916909117905550505b604080516001808252818301909252600091602080830190803683370190505090508481600081518110610187577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101526000546040517fb9b9e4080000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063b9b9e408906101df90339085908b906004016104d3565b600060405180830381600087803b1580156101f957600080fd5b505af115801561020d573d6000803e3d6000fd5b507f150b7a02000000000000000000000000000000000000000000000000000000009a9950505050505050505050565b600061024883610262565b8015610259575061025983836102b0565b90505b92915050565b6000610275826301ffc9a760e01b6102b0565b80156102a857506102a6827fffffffff000000000000000000000000000000000000000000000000000000006102b0565b155b90505b919050565b604080517fffffffff00000000000000000000000000000000000000000000000000000000831660248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052905160009190829081906001600160a01b038716906175309061034490869061049a565b6000604051808303818686fa925050503d8060008114610380576040519150601f19603f3d011682016040523d82523d6000602084013e610385565b606091505b50915091506020815110156103a0576000935050505061025c565b8180156103bc5750808060200190518101906103bc9190610473565b9695505050505050565b80356001600160a01b03811681146102ab57600080fd5b6000806000806000608086880312156103f4578081fd5b6103fd866103c6565b945061040b602087016103c6565b935060408601359250606086013567ffffffffffffffff8082111561042e578283fd5b818801915088601f830112610441578283fd5b81358181111561044f578384fd5b896020828501011115610460578384fd5b9699959850939650602001949392505050565b600060208284031215610484578081fd5b81518015158114610493578182fd5b9392505050565b60008251815b818110156104ba57602081860181015185830152016104a0565b818111156104c85782828501525b509190910192915050565b6000608082016001600160a01b038087168452602060808186015282875180855260a0870191508289019450855b8181101561051d57855183529483019491830191600101610501565b50508581036040870152600681527f65726337323100000000000000000000000000000000000000000000000000008282015260408101945050508085166060850152505094935050505056fea26469706673582212206c81da702befb4cba8a35cbc4ddbdbea7374aa6a89f030b9805bdda5e6f92db464736f6c6343000803003300000000000000000000000064d91f12ece7362f91a6f8e7940cd55f05060b92
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063150b7a0214610030575b600080fd5b61004361003e3660046103dd565b610078565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200160405180910390f35b3360009081526001602052604081205460ff1661012a576000546040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260016024820152339063a22cb46590604401600060405180830381600087803b1580156100f457600080fd5b505af1158015610108573d6000803e3d6000fd5b5050336000908152600160208190526040909120805460ff1916909117905550505b604080516001808252818301909252600091602080830190803683370190505090508481600081518110610187577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101526000546040517fb9b9e4080000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063b9b9e408906101df90339085908b906004016104d3565b600060405180830381600087803b1580156101f957600080fd5b505af115801561020d573d6000803e3d6000fd5b507f150b7a02000000000000000000000000000000000000000000000000000000009a9950505050505050505050565b600061024883610262565b8015610259575061025983836102b0565b90505b92915050565b6000610275826301ffc9a760e01b6102b0565b80156102a857506102a6827fffffffff000000000000000000000000000000000000000000000000000000006102b0565b155b90505b919050565b604080517fffffffff00000000000000000000000000000000000000000000000000000000831660248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052905160009190829081906001600160a01b038716906175309061034490869061049a565b6000604051808303818686fa925050503d8060008114610380576040519150601f19603f3d011682016040523d82523d6000602084013e610385565b606091505b50915091506020815110156103a0576000935050505061025c565b8180156103bc5750808060200190518101906103bc9190610473565b9695505050505050565b80356001600160a01b03811681146102ab57600080fd5b6000806000806000608086880312156103f4578081fd5b6103fd866103c6565b945061040b602087016103c6565b935060408601359250606086013567ffffffffffffffff8082111561042e578283fd5b818801915088601f830112610441578283fd5b81358181111561044f578384fd5b896020828501011115610460578384fd5b9699959850939650602001949392505050565b600060208284031215610484578081fd5b81518015158114610493578182fd5b9392505050565b60008251815b818110156104ba57602081860181015185830152016104a0565b818111156104c85782828501525b509190910192915050565b6000608082016001600160a01b038087168452602060808186015282875180855260a0870191508289019450855b8181101561051d57855183529483019491830191600101610501565b50508581036040870152600681527f65726337323100000000000000000000000000000000000000000000000000008282015260408101945050508085166060850152505094935050505056fea26469706673582212206c81da702befb4cba8a35cbc4ddbdbea7374aa6a89f030b9805bdda5e6f92db464736f6c63430008030033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000064d91f12ece7362f91a6f8e7940cd55f05060b92
-----Decoded View---------------
Arg [0] : nft2erc20 (address): 0x64D91f12Ece7362F91A6f8E7940Cd55F05060b92
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000064d91f12ece7362f91a6f8e7940cd55f05060b92
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 25 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.