Feature Tip: Add private address tag to any address under My Name Tag !
More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
MarketplaceTokenReceiver
Compiler Version
v0.8.3+commit.8d00100c
Optimization Enabled:
Yes with 1500 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "./IMarketplaceTokenReceiver.sol"; /** * Token receiver for a given marketplace */ contract MarketplaceTokenReceiver is IMarketplaceTokenReceiver { address private _marketplace; // ERC1155: Mapping from token contracts to token IDs to account balances mapping (address => mapping(uint256 => mapping(address => uint256))) private _erc1155balances; constructor(address marketplace) { _marketplace = marketplace; } function decrementERC1155(address owner, address tokenAddress, uint256 tokenId, uint256 value) external virtual override { require(msg.sender == _marketplace, "Invalid caller"); require(_erc1155balances[tokenAddress][tokenId][owner] >= value, "Invalid token amount"); _erc1155balances[tokenAddress][tokenId][owner] -= value; } function transferERC1155(address tokenAddress, uint256 tokenId, uint256 value, address to) external virtual override { require(msg.sender == _marketplace, "Invalid caller"); IERC1155(tokenAddress).safeTransferFrom(address(this), to, tokenId, value, ""); } function withdrawERC1155(address tokenAddress, uint256 tokenId, uint256 value) external virtual override { require(_erc1155balances[tokenAddress][tokenId][msg.sender] >= value, "Invalid token amount"); _erc1155balances[tokenAddress][tokenId][msg.sender] -= value; IERC1155(tokenAddress).safeTransferFrom(address(this), msg.sender, tokenId, value, ""); } function onERC1155Received(address, address from, uint256 id, uint256 value, bytes calldata) external virtual override returns(bytes4) { _erc1155balances[msg.sender][id][from] += value; return this.onERC1155Received.selector; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz /** * Token receiver for a given marketplace */ interface IMarketplaceTokenReceiver { /** * @dev decrement the balance of an ERC1155 token. Only callable by the configured marketplace. */ function decrementERC1155(address owner, address tokenAddress, uint256 tokenId, uint256 value) external; /** * @dev transfer the balance of an ERC1155 token. Only callable by the configured marketplace. */ function transferERC1155(address tokenAddress, uint256 tokenId, uint256 value, address to) external; /** * @dev withdraw deposited ERC1155 token. Only callable by the depositor of a token and limited to the balance deposited. */ function withdrawERC1155(address tokenAddress, uint256 tokenId, uint256 value) external; function onERC1155Received(address, address from, uint256 id, uint256 value, bytes calldata) external returns(bytes4); }
// 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); }
{ "optimizer": { "enabled": true, "runs": 1500 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"marketplace","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"decrementERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"transferERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"withdrawERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405161071a38038061071a83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b610689806100916000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806339ead720146100515780633d7fe791146100665780636194a1c514610079578063f23a6e611461008c575b600080fd5b61006461005f36600461057e565b6100d4565b005b6100646100743660046105b0565b610214565b61006461008736600461049c565b6102f1565b61009f61009a3660046104dd565b610412565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200160405180910390f35b6001600160a01b038316600090815260016020908152604080832085845282528083203384529091529020548111156101545760405162461bcd60e51b815260206004820152601460248201527f496e76616c696420746f6b656e20616d6f756e7400000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b038316600090815260016020908152604080832085845282528083203384529091528120805483929061018f90849061060d565b9091555050604051637921219560e11b8152306004820152336024820152604481018390526064810182905260a06084820152600060a48201526001600160a01b0384169063f242432a9060c401600060405180830381600087803b1580156101f757600080fd5b505af115801561020b573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b0316331461026e5760405162461bcd60e51b815260206004820152600e60248201527f496e76616c69642063616c6c6572000000000000000000000000000000000000604482015260640161014b565b604051637921219560e11b81523060048201526001600160a01b038281166024830152604482018590526064820184905260a06084830152600060a483015285169063f242432a9060c401600060405180830381600087803b1580156102d357600080fd5b505af11580156102e7573d6000803e3d6000fd5b5050505050505050565b6000546001600160a01b0316331461034b5760405162461bcd60e51b815260206004820152600e60248201527f496e76616c69642063616c6c6572000000000000000000000000000000000000604482015260640161014b565b6001600160a01b0380841660009081526001602090815260408083208684528252808320938816835292905220548111156103c85760405162461bcd60e51b815260206004820152601460248201527f496e76616c696420746f6b656e20616d6f756e74000000000000000000000000604482015260640161014b565b6001600160a01b03808416600090815260016020908152604080832086845282528083209388168352929052908120805483929061040790849061060d565b909155505050505050565b33600090815260016020908152604080832087845282528083206001600160a01b038916845290915281208054859190839061044f9084906105f5565b909155507ff23a6e610000000000000000000000000000000000000000000000000000000098975050505050505050565b80356001600160a01b038116811461049757600080fd5b919050565b600080600080608085870312156104b1578384fd5b6104ba85610480565b93506104c860208601610480565b93969395505050506040820135916060013590565b60008060008060008060a087890312156104f5578182fd5b6104fe87610480565b955061050c60208801610480565b94506040870135935060608701359250608087013567ffffffffffffffff80821115610536578384fd5b818901915089601f830112610549578384fd5b813581811115610557578485fd5b8a6020828501011115610568578485fd5b6020830194508093505050509295509295509295565b600080600060608486031215610592578283fd5b61059b84610480565b95602085013595506040909401359392505050565b600080600080608085870312156105c5578384fd5b6105ce85610480565b935060208501359250604085013591506105ea60608601610480565b905092959194509250565b6000821982111561060857610608610624565b500190565b60008282101561061f5761061f610624565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea26469706673582212204c204207e6debc2f022ed4bb4e8989f218aefc1459cfa95973cd3d5abd3054cc64736f6c634300080300330000000000000000000000007ef865963d3a005670b8f8df6aed23e456fa75e0
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806339ead720146100515780633d7fe791146100665780636194a1c514610079578063f23a6e611461008c575b600080fd5b61006461005f36600461057e565b6100d4565b005b6100646100743660046105b0565b610214565b61006461008736600461049c565b6102f1565b61009f61009a3660046104dd565b610412565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200160405180910390f35b6001600160a01b038316600090815260016020908152604080832085845282528083203384529091529020548111156101545760405162461bcd60e51b815260206004820152601460248201527f496e76616c696420746f6b656e20616d6f756e7400000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b038316600090815260016020908152604080832085845282528083203384529091528120805483929061018f90849061060d565b9091555050604051637921219560e11b8152306004820152336024820152604481018390526064810182905260a06084820152600060a48201526001600160a01b0384169063f242432a9060c401600060405180830381600087803b1580156101f757600080fd5b505af115801561020b573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b0316331461026e5760405162461bcd60e51b815260206004820152600e60248201527f496e76616c69642063616c6c6572000000000000000000000000000000000000604482015260640161014b565b604051637921219560e11b81523060048201526001600160a01b038281166024830152604482018590526064820184905260a06084830152600060a483015285169063f242432a9060c401600060405180830381600087803b1580156102d357600080fd5b505af11580156102e7573d6000803e3d6000fd5b5050505050505050565b6000546001600160a01b0316331461034b5760405162461bcd60e51b815260206004820152600e60248201527f496e76616c69642063616c6c6572000000000000000000000000000000000000604482015260640161014b565b6001600160a01b0380841660009081526001602090815260408083208684528252808320938816835292905220548111156103c85760405162461bcd60e51b815260206004820152601460248201527f496e76616c696420746f6b656e20616d6f756e74000000000000000000000000604482015260640161014b565b6001600160a01b03808416600090815260016020908152604080832086845282528083209388168352929052908120805483929061040790849061060d565b909155505050505050565b33600090815260016020908152604080832087845282528083206001600160a01b038916845290915281208054859190839061044f9084906105f5565b909155507ff23a6e610000000000000000000000000000000000000000000000000000000098975050505050505050565b80356001600160a01b038116811461049757600080fd5b919050565b600080600080608085870312156104b1578384fd5b6104ba85610480565b93506104c860208601610480565b93969395505050506040820135916060013590565b60008060008060008060a087890312156104f5578182fd5b6104fe87610480565b955061050c60208801610480565b94506040870135935060608701359250608087013567ffffffffffffffff80821115610536578384fd5b818901915089601f830112610549578384fd5b813581811115610557578485fd5b8a6020828501011115610568578485fd5b6020830194508093505050509295509295509295565b600080600060608486031215610592578283fd5b61059b84610480565b95602085013595506040909401359392505050565b600080600080608085870312156105c5578384fd5b6105ce85610480565b935060208501359250604085013591506105ea60608601610480565b905092959194509250565b6000821982111561060857610608610624565b500190565b60008282101561061f5761061f610624565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea26469706673582212204c204207e6debc2f022ed4bb4e8989f218aefc1459cfa95973cd3d5abd3054cc64736f6c63430008030033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007ef865963d3a005670b8f8df6aed23e456fa75e0
-----Decoded View---------------
Arg [0] : marketplace (address): 0x7ef865963D3A005670b8F8Df6aed23e456FA75e0
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000007ef865963d3a005670b8f8df6aed23e456fa75e0
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.