Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
Contract Name:
DefaultCallbackHandler
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.17; /* solhint-disable no-empty-blocks */ import {IERC1155TokenReceiver} from "../interfaces/IERC1155TokenReceiver.sol"; import {IERC721TokenReceiver} from "../interfaces/IERC721TokenReceiver.sol"; import {IERC777TokensRecipient} from "../interfaces/IERC777TokensRecipient.sol"; import {IERC165} from "../interfaces/IERC165.sol"; /** @title Default Callback Handler - returns true for known token callbacks * @dev Handles EIP-1271 compliant isValidSignature requests. * @notice inspired by Richard Meissner's <[email protected]> implementation */ contract DefaultCallbackHandler is IERC1155TokenReceiver, IERC777TokensRecipient, IERC721TokenReceiver, IERC165 { string public constant NAME = "Default Callback Handler"; string public constant VERSION = "1.0.0"; function supportsInterface( bytes4 interfaceId ) external view virtual override returns (bool) { return interfaceId == type(IERC1155TokenReceiver).interfaceId || interfaceId == type(IERC721TokenReceiver).interfaceId || interfaceId == type(IERC777TokensRecipient).interfaceId || interfaceId == type(IERC165).interfaceId; } function onERC1155Received( address, address, uint256, uint256, bytes calldata ) external pure override returns (bytes4) { return IERC1155TokenReceiver.onERC1155Received.selector; } function onERC1155BatchReceived( address, address, uint256[] calldata, uint256[] calldata, bytes calldata ) external pure override returns (bytes4) { return IERC1155TokenReceiver.onERC1155BatchReceived.selector; } function onERC721Received( address, address, uint256, bytes calldata ) external pure override returns (bytes4) { return IERC721TokenReceiver.onERC721Received.selector; } function tokensReceived( address, address, address, uint256, bytes calldata, bytes calldata ) external pure override { // We implement this for completeness, doesn't really have any value } }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.17; /** Note: The ERC-165 identifier for this interface is 0x4e2312e0. */ interface IERC1155TokenReceiver { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param _operator The address which initiated the transfer (i.e. msg.sender) * @param _from The address which previously owned the token * @param _id The ID of the token being transferred * @param _value The amount of tokens being transferred * @param _data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address _operator, address _from, uint256 _id, uint256 _value, bytes calldata _data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param _operator The address which initiated the batch transfer (i.e. msg.sender) * @param _from The address which previously owned the token * @param _ids An array containing ids of each token being transferred (order and length must match values array) * @param _values An array containing amounts of each token transferred (order and length must match ids array) * @param _data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if allowed */ function onERC1155BatchReceived( address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data ) external returns (bytes4); }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.17; /** * @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: LGPL-3.0-only pragma solidity 0.8.17; /// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02. interface IERC721TokenReceiver { /// @notice Handle the receipt of an NFT /// @dev The ERC721 smart contract calls this function on the recipient /// after a `transfer`. This function MAY throw to revert and reject the /// transfer. Return of other than the magic value MUST result in the /// transaction being reverted. /// Note: the contract address is always the message sender. /// @param _operator The address which called `safeTransferFrom` function /// @param _from The address which previously owned the token /// @param _tokenId The NFT identifier which is being transferred /// @param _data Additional data with no specified format /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` /// unless throwing function onERC721Received( address _operator, address _from, uint256 _tokenId, bytes calldata _data ) external returns (bytes4); }
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.17; interface IERC777TokensRecipient { function tokensReceived( address operator, address from, address to, uint256 amount, bytes calldata data, bytes calldata operatorData ) external; }
{ "optimizer": { "enabled": true, "runs": 800 }, "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract ABI
API[{"inputs":[],"name":"NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"tokensReceived","outputs":[],"stateMutability":"pure","type":"function"}]
Contract Creation Code
60808060405234610016576104ca908161001c8239f35b600080fdfe60806040908082526004918236101561001757600080fd5b600091823560e01c90816223de291461031b57816301ffc9a71461029457508063150b7a021461023d578063a3f4df7e146101d6578063bc197c811461014c578063f23a6e61146100f25763ffa1ad741461007157600080fd5b346100ee57816003193601126100ee578051918183019083821067ffffffffffffffff8311176100db57506100d793508152600582527f312e302e300000000000000000000000000000000000000000000000000000006020830152519182918261041a565b0390f35b634e487b7160e01b815260418552602490fd5b5080fd5b5090346101495760a03660031901126101495761010d6103a1565b506101166103c9565b506084359067ffffffffffffffff8211610149575060209261013a913691016103ec565b50505163f23a6e6160e01b8152f35b80fd5b5090346101495760a0366003190112610149576101676103a1565b506101706103c9565b5067ffffffffffffffff906044358281116100ee576101929036908601610463565b50506064358281116100ee576101ab9036908601610463565b505060843591821161014957506020926101c7913691016103ec565b50505163bc197c8160e01b8152f35b50346100ee57816003193601126100ee578051918183019083821067ffffffffffffffff8311176100db57506100d793508152601882527f44656661756c742043616c6c6261636b2048616e646c657200000000000000006020830152519182918261041a565b509034610149576080366003190112610149576102586103a1565b506102616103c9565b506064359067ffffffffffffffff82116101495750602092610285913691016103ec565b505051630a85bd0160e11b8152f35b83908534610317576020366003190112610317573563ffffffff60e01b81168091036103175760209250630271189760e51b8114908115610306575b81156102f6575b81156102e5575b5015158152f35b6301ffc9a760e01b149050836102de565b6223de2960e01b811491506102d7565b630a85bd0160e11b811491506102d0565b8280fd5b8385346100ee5760c03660031901126100ee576103366103a1565b5061033f6103c9565b5060443573ffffffffffffffffffffffffffffffffffffffff8116036100ee5767ffffffffffffffff9060843582811161039d5761038090369083016103ec565b505060a43591821161031757610398913691016103ec565b505080f35b8380fd5b6004359073ffffffffffffffffffffffffffffffffffffffff821682036103c457565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff821682036103c457565b9181601f840112156103c45782359167ffffffffffffffff83116103c457602083818601950101116103c457565b6020808252825181830181905290939260005b82811061044f57505060409293506000838284010152601f8019910116010190565b81810186015184820160400152850161042d565b9181601f840112156103c45782359167ffffffffffffffff83116103c4576020808501948460051b0101116103c45756fea2646970667358221220189a65031da8b9cd67d425e2ed29478ce74c651eda4f49e9e43ba413d9cc0cc964736f6c63430008110033
Deployed Bytecode
0x60806040908082526004918236101561001757600080fd5b600091823560e01c90816223de291461031b57816301ffc9a71461029457508063150b7a021461023d578063a3f4df7e146101d6578063bc197c811461014c578063f23a6e61146100f25763ffa1ad741461007157600080fd5b346100ee57816003193601126100ee578051918183019083821067ffffffffffffffff8311176100db57506100d793508152600582527f312e302e300000000000000000000000000000000000000000000000000000006020830152519182918261041a565b0390f35b634e487b7160e01b815260418552602490fd5b5080fd5b5090346101495760a03660031901126101495761010d6103a1565b506101166103c9565b506084359067ffffffffffffffff8211610149575060209261013a913691016103ec565b50505163f23a6e6160e01b8152f35b80fd5b5090346101495760a0366003190112610149576101676103a1565b506101706103c9565b5067ffffffffffffffff906044358281116100ee576101929036908601610463565b50506064358281116100ee576101ab9036908601610463565b505060843591821161014957506020926101c7913691016103ec565b50505163bc197c8160e01b8152f35b50346100ee57816003193601126100ee578051918183019083821067ffffffffffffffff8311176100db57506100d793508152601882527f44656661756c742043616c6c6261636b2048616e646c657200000000000000006020830152519182918261041a565b509034610149576080366003190112610149576102586103a1565b506102616103c9565b506064359067ffffffffffffffff82116101495750602092610285913691016103ec565b505051630a85bd0160e11b8152f35b83908534610317576020366003190112610317573563ffffffff60e01b81168091036103175760209250630271189760e51b8114908115610306575b81156102f6575b81156102e5575b5015158152f35b6301ffc9a760e01b149050836102de565b6223de2960e01b811491506102d7565b630a85bd0160e11b811491506102d0565b8280fd5b8385346100ee5760c03660031901126100ee576103366103a1565b5061033f6103c9565b5060443573ffffffffffffffffffffffffffffffffffffffff8116036100ee5767ffffffffffffffff9060843582811161039d5761038090369083016103ec565b505060a43591821161031757610398913691016103ec565b505080f35b8380fd5b6004359073ffffffffffffffffffffffffffffffffffffffff821682036103c457565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff821682036103c457565b9181601f840112156103c45782359167ffffffffffffffff83116103c457602083818601950101116103c457565b6020808252825181830181905290939260005b82811061044f57505060409293506000838284010152601f8019910116010190565b81810186015184820160400152850161042d565b9181601f840112156103c45782359167ffffffffffffffff83116103c4576020808501948460051b0101116103c45756fea2646970667358221220189a65031da8b9cd67d425e2ed29478ce74c651eda4f49e9e43ba413d9cc0cc964736f6c63430008110033
Loading...
Loading
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.