@animoca/ethereum-contracts-assets
Version:
Base assets contracts
73 lines • 4.11 MB
JSON
{
"id": "c99ef83ca5fcbf3b0fddb30b6eb0e9c0",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.7.6",
"solcLongVersion": "0.7.6+commit.7338295f",
"input": {
"language": "Solidity",
"sources": {
"contracts/token/ERC1155721/mocks/ERC1155721InventoryBurnableMock.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\nimport {IForwarderRegistry} from \"ethereum-universal-forwarder/src/solc_0.7/ERC2771/IForwarderRegistry.sol\";\nimport {IERC165} from \"@animoca/ethereum-contracts-core/contracts/introspection/IERC165.sol\";\nimport {IERC1155MetadataURI} from \"./../../../token/ERC1155/interfaces/IERC1155MetadataURI.sol\";\nimport {IERC1155InventoryCreator} from \"./../../../token/ERC1155/interfaces/IERC1155InventoryCreator.sol\";\nimport {IERC1155721InventoryMintable} from \"./../interfaces/IERC1155721InventoryMintable.sol\";\nimport {IERC1155721InventoryDeliverable} from \"./../interfaces/IERC1155721InventoryDeliverable.sol\";\nimport {IERC1155721InventoryBurnable} from \"./../interfaces/IERC1155721InventoryBurnable.sol\";\nimport {ManagedIdentity} from \"@animoca/ethereum-contracts-core/contracts/metatx/ManagedIdentity.sol\";\nimport {Recoverable} from \"@animoca/ethereum-contracts-core/contracts/utils/Recoverable.sol\";\nimport {UsingUniversalForwarding} from \"ethereum-universal-forwarder/src/solc_0.7/ERC2771/UsingUniversalForwarding.sol\";\nimport {MinterRole} from \"@animoca/ethereum-contracts-core/contracts/access/MinterRole.sol\";\nimport {ERC1155721InventoryBurnable} from \"./../ERC1155721InventoryBurnable.sol\";\nimport {NFTBaseMetadataURI} from \"./../../../metadata/NFTBaseMetadataURI.sol\";\n\n/**\n * @title ERC1155 & ERC721 Inventory Burnable Mock.\n */\ncontract ERC1155721InventoryBurnableMock is\n Recoverable,\n UsingUniversalForwarding,\n ERC1155721InventoryBurnable,\n IERC1155721InventoryMintable,\n IERC1155721InventoryDeliverable,\n IERC1155InventoryCreator,\n NFTBaseMetadataURI,\n MinterRole\n{\n constructor(\n IForwarderRegistry forwarderRegistry,\n address universalForwarder,\n uint256 collectionMaskLength\n )\n ERC1155721InventoryBurnable(\"ERC1155721InventoryBurnableMock\", \"INVB\", collectionMaskLength)\n UsingUniversalForwarding(forwarderRegistry, universalForwarder)\n MinterRole(msg.sender)\n {}\n\n //======================================================= ERC165 ========================================================//\n\n /// @inheritdoc IERC165\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC1155InventoryCreator).interfaceId || super.supportsInterface(interfaceId);\n }\n\n //================================================= ERC1155MetadataURI ==================================================//\n\n /// @inheritdoc IERC1155MetadataURI\n function uri(uint256 id) public view virtual override returns (string memory) {\n return _uri(id);\n }\n\n //=============================================== ERC1155InventoryCreator ===============================================//\n\n /// @inheritdoc IERC1155InventoryCreator\n function creator(uint256 collectionId) external view override returns (address) {\n return _creator(collectionId);\n }\n\n //=========================================== ERC1155InventoryCreator (admin) ===========================================//\n\n /**\n * Creates a collection.\n * @dev Reverts if the sender is not the contract owner.\n * @dev Reverts if `collectionId` does not represent a collection.\n * @dev Reverts if `collectionId` has already been created.\n * @dev Emits a {IERC1155Inventory-CollectionCreated} event.\n * @param collectionId Identifier of the collection.\n */\n function createCollection(uint256 collectionId) external {\n _requireOwnership(_msgSender());\n _createCollection(collectionId);\n }\n\n //============================================= ERC1155721InventoryMintable =============================================//\n\n /// @inheritdoc IERC1155721InventoryMintable\n /// @dev Reverts if the sender is not a minter.\n function mint(address to, uint256 nftId) external virtual override {\n _requireMinter(_msgSender());\n _mint(to, nftId, \"\", false);\n }\n\n /// @inheritdoc IERC1155721InventoryMintable\n /// @dev Reverts if the sender is not a minter.\n function batchMint(address to, uint256[] calldata nftIds) external virtual override {\n _requireMinter(_msgSender());\n _batchMint(to, nftIds);\n }\n\n /// @inheritdoc IERC1155721InventoryMintable\n /// @dev Reverts if the sender is not a minter.\n function safeMint(\n address to,\n uint256 nftId,\n bytes calldata data\n ) external virtual override {\n _requireMinter(_msgSender());\n _mint(to, nftId, data, true);\n }\n\n /// @inheritdoc IERC1155721InventoryMintable\n /// @dev Reverts if the sender is not a minter.\n function safeMint(\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override {\n _requireMinter(_msgSender());\n _safeMint(to, id, value, data);\n }\n\n /// @inheritdoc IERC1155721InventoryMintable\n /// @dev Reverts if the sender is not a minter.\n function safeBatchMint(\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override {\n _requireMinter(_msgSender());\n _safeBatchMint(to, ids, values, data);\n }\n\n //============================================ ERC1155721InventoryDeliverable =============================================//\n\n /// @inheritdoc IERC1155721InventoryDeliverable\n /// @dev Reverts if the sender is not a minter.\n function safeDeliver(\n address[] calldata recipients,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override {\n _requireMinter(_msgSender());\n _safeDeliver(recipients, ids, values, data);\n }\n\n //======================================== Meta Transactions Internal Functions =========================================//\n\n function _msgSender() internal view virtual override(ManagedIdentity, UsingUniversalForwarding) returns (address payable) {\n return UsingUniversalForwarding._msgSender();\n }\n\n function _msgData() internal view virtual override(ManagedIdentity, UsingUniversalForwarding) returns (bytes memory ret) {\n return UsingUniversalForwarding._msgData();\n }\n\n //=============================================== Mock Coverage Functions ===============================================//\n\n function msgData() external view returns (bytes memory ret) {\n return _msgData();\n }\n}\n"
},
"ethereum-universal-forwarder/src/solc_0.7/ERC2771/IForwarderRegistry.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.7.0;\n\ninterface IForwarderRegistry {\n function isForwarderFor(address, address) external view returns (bool);\n}\n"
},
"@animoca/ethereum-contracts-core/contracts/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"contracts/token/ERC1155/interfaces/IERC1155MetadataURI.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\n/**\n * @title ERC1155 Multi Token Standard, optional extension: Metadata URI.\n * @dev See https://eips.ethereum.org/EIPS/eip-1155\n * @dev Note: The ERC-165 identifier for this interface is 0x0e89341c.\n */\ninterface IERC1155MetadataURI {\n /**\n * @notice A distinct Uniform Resource Identifier (URI) for a given token.\n * @dev URIs are defined in RFC 3986.\n * @dev The URI MUST point to a JSON file that conforms to the \"ERC1155 Metadata URI JSON Schema\".\n * @dev The uri function SHOULD be used to retrieve values if no event was emitted.\n * @dev The uri function MUST return the same value as the latest event for an _id if it was emitted.\n * @dev The uri function MUST NOT be used to check for the existence of a token as it is possible for\n * an implementation to return a valid string even if the token does not exist.\n * @return URI string\n */\n function uri(uint256 id) external view returns (string memory);\n}\n"
},
"contracts/token/ERC1155/interfaces/IERC1155InventoryCreator.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\n/**\n * @title ERC1155 Inventory, optional extension: Creator.\n * @dev See https://eips.ethereum.org/EIPS/eip-1155\n * @dev Note: The ERC-165 identifier for this interface is 0x510b5158.\n */\ninterface IERC1155InventoryCreator {\n /**\n * Returns the creator of a collection, or the zero address if the collection has not been created.\n * @dev Reverts if `collectionId` does not represent a collection.\n * @param collectionId Identifier of the collection.\n * @return The creator of a collection, or the zero address if the collection has not been created.\n */\n function creator(uint256 collectionId) external view returns (address);\n}\n"
},
"contracts/token/ERC1155721/interfaces/IERC1155721InventoryMintable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\n/**\n * @title ERC1155 Inventory with support for ERC721, optional extension: Mintable.\n * @dev The ERC721 Mintable function `safeMint(address,uint256,bytes)` is not provided as\n * the ERC1155 Mintable function `safeMint(address,uint256,uint256,bytes)` can be used instead.\n */\ninterface IERC1155721InventoryMintable {\n /**\n * Safely mints some token (ERC1155-compatible).\n * @dev Reverts if `to` is the zero address.\n * @dev Reverts if `id` is not a token.\n * @dev Reverts if `id` represents a Non-Fungible Token and `value` is not 1.\n * @dev Reverts if `id` represents a Non-Fungible Token which has already been minted.\n * @dev Reverts if `id` represents a Fungible Token and `value` is 0.\n * @dev Reverts if `id` represents a Fungible Token and there is an overflow of supply.\n * @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails or is refused.\n * @dev Emits an {IERC721-Transfer} event from the zero address if `id` represents a Non-Fungible Token.\n * @dev Emits an {IERC1155-TransferSingle} event from the zero address.\n * @param to Address of the new token owner.\n * @param id Identifier of the token to mint.\n * @param value Amount of token to mint.\n * @param data Optional data to send along to a receiver contract.\n */\n function safeMint(\n address to,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external;\n\n /**\n * Safely mints a batch of tokens (ERC1155-compatible).\n * @dev Reverts if `ids` and `values` have different lengths.\n * @dev Reverts if `to` is the zero address.\n * @dev Reverts if one of `ids` is not a token.\n * @dev Reverts if one of `ids` represents a Non-Fungible Token and its paired value is not 1.\n * @dev Reverts if one of `ids` represents a Non-Fungible Token which has already been minted.\n * @dev Reverts if one of `ids` represents a Fungible Token and its paired value is 0.\n * @dev Reverts if one of `ids` represents a Fungible Token and there is an overflow of supply.\n * @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155batchReceived} fails or is refused.\n * @dev Emits an {IERC721-Transfer} event from the zero address for each Non-Fungible Token minted.\n * @dev Emits an {IERC1155-TransferBatch} event from the zero address.\n * @param to Address of the new tokens owner.\n * @param ids Identifiers of the tokens to mint.\n * @param values Amounts of tokens to mint.\n * @param data Optional data to send along to a receiver contract.\n */\n function safeBatchMint(\n address to,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n\n /**\n * Unsafely mints a Non-Fungible Token (ERC721-compatible).\n * @dev Reverts if `to` is the zero address.\n * @dev Reverts if `nftId` does not represent a Non-Fungible Token.\n * @dev Reverts if `nftId` has already been minted.\n * @dev Emits an {IERC721-Transfer} event from the zero address.\n * @dev Emits an {IERC1155-TransferSingle} event from the zero address.\n * @dev If `to` is a contract and supports ERC1155TokenReceiver, calls {IERC1155TokenReceiver-onERC1155Received} with empty data.\n * @param to Address of the new token owner.\n * @param nftId Identifier of the token to mint.\n */\n function mint(address to, uint256 nftId) external;\n\n /**\n * Unsafely mints a batch of Non-Fungible Tokens (ERC721-compatible).\n * @dev Reverts if `to` is the zero address.\n * @dev Reverts if one of `nftIds` does not represent a Non-Fungible Token.\n * @dev Reverts if one of `nftIds` has already been minted.\n * @dev Emits an {IERC721-Transfer} event from the zero address for each of `nftIds`.\n * @dev Emits an {IERC1155-TransferBatch} event from the zero address.\n * @dev If `to` is a contract and supports ERC1155TokenReceiver, calls {IERC1155TokenReceiver-onERC1155BatchReceived} with empty data.\n * @param to Address of the new token owner.\n * @param nftIds Identifiers of the tokens to mint.\n */\n function batchMint(address to, uint256[] calldata nftIds) external;\n\n /**\n * Safely mints a token (ERC721-compatible).\n * @dev Reverts if `to` is the zero address.\n * @dev Reverts if `tokenId` has already ben minted.\n * @dev Reverts if `to` is a contract which does not implement IERC721Receiver or IERC1155TokenReceiver.\n * @dev Reverts if `to` is an IERC1155TokenReceiver or IERC721TokenReceiver contract which refuses the transfer.\n * @dev Emits an {IERC721-Transfer} event from the zero address.\n * @dev Emits an {IERC1155-TransferSingle} event from the zero address.\n * @param to Address of the new token owner.\n * @param nftId Identifier of the token to mint.\n * @param data Optional data to pass along to the receiver call.\n */\n function safeMint(\n address to,\n uint256 nftId,\n bytes calldata data\n ) external;\n}\n"
},
"contracts/token/ERC1155721/interfaces/IERC1155721InventoryDeliverable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\n/**\n * @title ERC1155 Inventory with support for ERC721, optional extension: Deliverable.\n * Provides a minting function which can be used to deliver tokens to several recipients.\n */\ninterface IERC1155721InventoryDeliverable {\n /**\n * Safely mints some tokens to a list of recipients.\n * @dev Reverts if `recipients`, `ids` and `values` have different lengths.\n * @dev Reverts if one of `recipients` is the zero address.\n * @dev Reverts if one of `ids` is not a token.\n * @dev Reverts if one of `ids` represents a Non-Fungible Token and its `value` is not 1.\n * @dev Reverts if one of `ids` represents a Non-Fungible Token which has already been minted.\n * @dev Reverts if one of `ids` represents a Fungible Token and its `value` is 0.\n * @dev Reverts if one of `ids` represents a Fungible Token and there is an overflow of supply.\n * @dev Reverts if one of `recipients` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails or is refused.\n * @dev Emits an {IERC721-Transfer} event from the zero address for each `id` representing a Non-Fungible Token.\n * @dev Emits an {IERC1155-TransferSingle} event from the zero address.\n * @param recipients Addresses of the new token owners.\n * @param ids Identifiers of the tokens to mint.\n * @param values Amounts of tokens to mint.\n * @param data Optional data to send along to the receiver contract(s), if any. All receivers receive the same data.\n */\n function safeDeliver(\n address[] calldata recipients,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external;\n}\n"
},
"contracts/token/ERC1155721/interfaces/IERC1155721InventoryBurnable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\n/**\n * @title ERC1155 Inventory with support for ERC721, optional extension: Burnable.\n * @dev The ERC721 Burnable function `burnFrom(address,uint256)` is not provided\n * the ERC1155 Burnable function `burnFrom(address,uint256,uint256)` can be used instead.\n * @dev Note: The ERC-165 identifier for this interface is 0x6059f1b4.\n */\ninterface IERC1155721InventoryBurnable {\n /**\n * Burns some token (ERC1155-compatible).\n * @dev Reverts if the sender is not approved.\n * @dev Reverts if `id` does not represent a token.\n * @dev Reverts if `id` represents a Fungible Token and `value` is 0.\n * @dev Reverts if `id` represents a Fungible Token and `value` is higher than `from`'s balance.\n * @dev Reverts if `id` represents a Non-Fungible Token and `value` is not 1.\n * @dev Reverts if `id` represents a Non-Fungible Token which is not owned by `from`.\n * @dev Emits an {IERC721-Transfer} event to the zero address if `id` represents a Non-Fungible Token.\n * @dev Emits an {IERC1155-TransferSingle} event to the zero address.\n * @param from Address of the current token owner.\n * @param id Identifier of the token to burn.\n * @param value Amount of token to burn.\n */\n function burnFrom(\n address from,\n uint256 id,\n uint256 value\n ) external;\n\n /**\n * Burns multiple tokens (ERC1155-compatible).\n * @dev Reverts if `ids` and `values` have different lengths.\n * @dev Reverts if the sender is not approved.\n * @dev Reverts if one of `ids` does not represent a token.\n * @dev Reverts if one of `ids` represents a Fungible Token and `value` is 0.\n * @dev Reverts if one of `ids` represents a Fungible Token and `value` is higher than `from`'s balance.\n * @dev Reverts if one of `ids` represents a Non-Fungible Token and `value` is not 1.\n * @dev Reverts if one of `ids` represents a Non-Fungible Token which is not owned by `from`.\n * @dev Emits an {IERC721-Transfer} event to the zero address for each burnt Non-Fungible Token.\n * @dev Emits an {IERC1155-TransferBatch} event to the zero address.\n * @param from Address of the current tokens owner.\n * @param ids Identifiers of the tokens to burn.\n * @param values Amounts of tokens to burn.\n */\n function batchBurnFrom(\n address from,\n uint256[] calldata ids,\n uint256[] calldata values\n ) external;\n\n /**\n * Burns a batch of Non-Fungible Tokens (ERC721-compatible).\n * @dev Reverts if the sender is not approved.\n * @dev Reverts if one of `nftIds` does not represent a Non-Fungible Token.\n * @dev Reverts if one of `nftIds` is not owned by `from`.\n * @dev Emits an {IERC721-Transfer} event to the zero address for each of `nftIds`.\n * @dev Emits an {IERC1155-TransferBatch} event to the zero address.\n * @param from Current token owner.\n * @param nftIds Identifiers of the tokens to transfer.\n */\n function batchBurnFrom(address from, uint256[] calldata nftIds) external;\n}\n"
},
"@animoca/ethereum-contracts-core/contracts/metatx/ManagedIdentity.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\n/*\n * Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner.\n */\nabstract contract ManagedIdentity {\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n return msg.data;\n }\n}\n"
},
"@animoca/ethereum-contracts-core/contracts/utils/Recoverable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\nimport {ManagedIdentity} from \"../metatx/ManagedIdentity.sol\";\nimport {Ownable} from \"../access/Ownable.sol\";\nimport {IWrappedERC20, ERC20Wrapper} from \"./ERC20Wrapper.sol\";\n\nabstract contract Recoverable is ManagedIdentity, Ownable {\n using ERC20Wrapper for IWrappedERC20;\n\n /**\n * Extract ERC20 tokens which were accidentally sent to the contract to a list of accounts.\n * Warning: this function should be overriden for contracts which are supposed to hold ERC20 tokens\n * so that the extraction is limited to only amounts sent accidentally.\n * @dev Reverts if the sender is not the contract owner.\n * @dev Reverts if `accounts`, `tokens` and `amounts` do not have the same length.\n * @dev Reverts if one of `tokens` is does not implement the ERC20 transfer function.\n * @dev Reverts if one of the ERC20 transfers fail for any reason.\n * @param accounts the list of accounts to transfer the tokens to.\n * @param tokens the list of ERC20 token addresses.\n * @param amounts the list of token amounts to transfer.\n */\n function recoverERC20s(\n address[] calldata accounts,\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external virtual {\n _requireOwnership(_msgSender());\n uint256 length = accounts.length;\n require(length == tokens.length && length == amounts.length, \"Recov: inconsistent arrays\");\n for (uint256 i = 0; i != length; ++i) {\n IWrappedERC20(tokens[i]).wrappedTransfer(accounts[i], amounts[i]);\n }\n }\n\n /**\n * Extract ERC721 tokens which were accidentally sent to the contract to a list of accounts.\n * Warning: this function should be overriden for contracts which are supposed to hold ERC721 tokens\n * so that the extraction is limited to only tokens sent accidentally.\n * @dev Reverts if the sender is not the contract owner.\n * @dev Reverts if `accounts`, `contracts` and `amounts` do not have the same length.\n * @dev Reverts if one of `contracts` is does not implement the ERC721 transferFrom function.\n * @dev Reverts if one of the ERC721 transfers fail for any reason.\n * @param accounts the list of accounts to transfer the tokens to.\n * @param contracts the list of ERC721 contract addresses.\n * @param tokenIds the list of token ids to transfer.\n */\n function recoverERC721s(\n address[] calldata accounts,\n address[] calldata contracts,\n uint256[] calldata tokenIds\n ) external virtual {\n _requireOwnership(_msgSender());\n uint256 length = accounts.length;\n require(length == contracts.length && length == tokenIds.length, \"Recov: inconsistent arrays\");\n for (uint256 i = 0; i != length; ++i) {\n IRecoverableERC721(contracts[i]).transferFrom(address(this), accounts[i], tokenIds[i]);\n }\n }\n}\n\ninterface IRecoverableERC721 {\n /// See {IERC721-transferFrom(address,address,uint256)}\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n}\n"
},
"ethereum-universal-forwarder/src/solc_0.7/ERC2771/UsingUniversalForwarding.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.7.0;\n\nimport \"./UsingAppendedCallData.sol\";\nimport \"./IERC2771.sol\";\nimport \"./IForwarderRegistry.sol\";\n\nabstract contract UsingUniversalForwarding is UsingAppendedCallData, IERC2771 {\n IForwarderRegistry internal immutable _forwarderRegistry;\n address internal immutable _universalForwarder;\n\n constructor(IForwarderRegistry forwarderRegistry, address universalForwarder) {\n _universalForwarder = universalForwarder;\n _forwarderRegistry = forwarderRegistry;\n }\n\n function isTrustedForwarder(address forwarder) external view virtual override returns (bool) {\n return forwarder == _universalForwarder || forwarder == address(_forwarderRegistry);\n }\n\n function _msgSender() internal view virtual returns (address payable) {\n address payable msgSender = msg.sender;\n address payable sender = _lastAppendedDataAsSender();\n if (msgSender == address(_forwarderRegistry) || msgSender == _universalForwarder) {\n // if forwarder use appended data\n return sender;\n }\n\n // if msg.sender is neither the registry nor the universal forwarder,\n // we have to check the last 20bytes of the call data intepreted as an address\n // and check if the msg.sender was registered as forewarder for that address\n // we check tx.origin to save gas in case where msg.sender == tx.origin\n // solhint-disable-next-line avoid-tx-origin\n if (msgSender != tx.origin && _forwarderRegistry.isForwarderFor(sender, msgSender)) {\n return sender;\n }\n\n return msgSender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n address payable msgSender = msg.sender;\n if (msgSender == address(_forwarderRegistry) || msgSender == _universalForwarder) {\n // if forwarder use appended data\n return _msgDataAssuming20BytesAppendedData();\n }\n\n // we check tx.origin to save gas in case where msg.sender == tx.origin\n // solhint-disable-next-line avoid-tx-origin\n if (msgSender != tx.origin && _forwarderRegistry.isForwarderFor(_lastAppendedDataAsSender(), msgSender)) {\n return _msgDataAssuming20BytesAppendedData();\n }\n return msg.data;\n }\n}\n"
},
"@animoca/ethereum-contracts-core/contracts/access/MinterRole.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\nimport {Ownable} from \"./Ownable.sol\";\n\n/**\n * Contract which allows derived contracts access control over token minting operations.\n */\ncontract MinterRole is Ownable {\n event MinterAdded(address indexed account);\n event MinterRemoved(address indexed account);\n\n mapping(address => bool) public isMinter;\n\n /**\n * Constructor.\n */\n constructor(address owner_) Ownable(owner_) {\n _addMinter(owner_);\n }\n\n /**\n * Grants the minter role to a non-minter.\n * @dev reverts if the sender is not the contract owner.\n * @param account The account to grant the minter role to.\n */\n function addMinter(address account) public {\n _requireOwnership(_msgSender());\n _addMinter(account);\n }\n\n /**\n * Renounces the granted minter role.\n * @dev reverts if the sender is not a minter.\n */\n function renounceMinter() public {\n address account = _msgSender();\n _requireMinter(account);\n isMinter[account] = false;\n emit MinterRemoved(account);\n }\n\n function _requireMinter(address account) internal view {\n require(isMinter[account], \"MinterRole: not a Minter\");\n }\n\n function _addMinter(address account) internal {\n isMinter[account] = true;\n emit MinterAdded(account);\n }\n}\n"
},
"contracts/token/ERC1155721/ERC1155721InventoryBurnable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\nimport {ERC1155InventoryIdentifiersLib} from \"./../ERC1155/ERC1155InventoryIdentifiersLib.sol\";\nimport {IERC165} from \"@animoca/ethereum-contracts-core/contracts/introspection/IERC165.sol\";\nimport {IERC1155721InventoryBurnable} from \"./interfaces/IERC1155721InventoryBurnable.sol\";\nimport {ERC1155721Inventory} from \"./ERC1155721Inventory.sol\";\n\n/**\n * @title ERC1155721Inventory, an ERC1155Inventory with additional support for ERC721, burnable version.\n * @dev The function `uri(uint256)` needs to be implemented by a child contract, for example with the help of `NFTBaseMetadataURI`.\n */\nabstract contract ERC1155721InventoryBurnable is IERC1155721InventoryBurnable, ERC1155721Inventory {\n using ERC1155InventoryIdentifiersLib for uint256;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 collectionMaskLength\n ) ERC1155721Inventory(name_, symbol_, collectionMaskLength) {}\n\n //======================================================= ERC165 ========================================================//\n\n /// @inheritdoc IERC165\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC1155721InventoryBurnable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n //============================================= ERC1155721InventoryBurnable =============================================//\n\n /// @inheritdoc IERC1155721InventoryBurnable\n function burnFrom(\n address from,\n uint256 id,\n uint256 value\n ) public virtual override {\n address sender = _msgSender();\n bool operatable = _isOperatable(from, sender);\n\n if (id.isFungibleToken()) {\n _burnFungible(from, id, value, operatable);\n } else if (id.isNonFungibleToken(_collectionMaskLength)) {\n _burnNFT(from, id, value, operatable, false);\n emit Transfer(from, address(0), id);\n } else {\n revert(\"Inventory: not a token id\");\n }\n\n emit TransferSingle(sender, from, address(0), id, value);\n }\n\n /// @inheritdoc IERC1155721InventoryBurnable\n function batchBurnFrom(\n address from,\n uint256[] memory ids,\n uint256[] memory values\n ) public virtual override {\n uint256 length = ids.length;\n require(length == values.length, \"Inventory: inconsistent arrays\");\n\n address sender = _msgSender();\n bool operatable = _isOperatable(from, sender);\n\n uint256 nfCollectionId;\n uint256 nfCollectionCount;\n uint256 nftsCount;\n for (uint256 i; i != length; ++i) {\n uint256 id = ids[i];\n if (id.isFungibleToken()) {\n _burnFungible(from, id, values[i], operatable);\n } else if (id.isNonFungibleToken(_collectionMaskLength)) {\n _burnNFT(from, id, values[i], operatable, true);\n emit Transfer(from, address(0), id);\n uint256 nextCollectionId = id.getNonFungibleCollection(_collectionMaskLength);\n if (nfCollectionId == 0) {\n nfCollectionId = nextCollectionId;\n nfCollectionCount = 1;\n } else {\n if (nextCollectionId != nfCollectionId) {\n _burnNFTUpdateCollection(from, nfCollectionId, nfCollectionCount);\n nfCollectionId = nextCollectionId;\n nftsCount += nfCollectionCount;\n nfCollectionCount = 1;\n } else {\n ++nfCollectionCount;\n }\n }\n } else {\n revert(\"Inventory: not a token id\");\n }\n }\n\n if (nfCollectionId != 0) {\n _burnNFTUpdateCollection(from, nfCollectionId, nfCollectionCount);\n nftsCount += nfCollectionCount;\n // cannot underflow as balance is verified through ownership\n _nftBalances[from] -= nftsCount;\n }\n\n emit TransferBatch(sender, from, address(0), ids, values);\n }\n\n /// @inheritdoc IERC1155721InventoryBurnable\n function batchBurnFrom(address from, uint256[] memory nftIds) public virtual override {\n address sender = _msgSender();\n bool operatable = _isOperatable(from, sender);\n\n uint256 length = nftIds.length;\n uint256[] memory values = new uint256[](length);\n\n uint256 nfCollectionId;\n uint256 nfCollectionCount;\n for (uint256 i; i != length; ++i) {\n uint256 nftId = nftIds[i];\n values[i] = 1;\n _burnNFT(from, nftId, values[i], operatable, true);\n emit Transfer(from, address(0), nftId);\n uint256 nextCollectionId = nftId.getNonFungibleCollection(_collectionMaskLength);\n if (nfCollectionId == 0) {\n nfCollectionId = nextCollectionId;\n nfCollectionCount = 1;\n } else {\n if (nextCollectionId != nfCollectionId) {\n _burnNFTUpdateCollection(from, nfCollectionId, nfCollectionCount);\n nfCollectionId = nextCollectionId;\n nfCollectionCount = 1;\n } else {\n ++nfCollectionCount;\n }\n }\n }\n\n if (nfCollectionId != 0) {\n _burnNFTUpdateCollection(from, nfCollectionId, nfCollectionCount);\n _nftBalances[from] -= length;\n }\n\n emit TransferBatch(sender, from, address(0), nftIds, values);\n }\n\n //============================================== Helper Internal Functions ==============================================//\n\n function _burnFungible(\n address from,\n uint256 id,\n uint256 value,\n bool operatable\n ) internal {\n require(value != 0, \"Inventory: zero value\");\n require(operatable, \"Inventory: non-approved sender\");\n uint256 balance = _balances[id][from];\n require(balance >= value, \"Inventory: not enough balance\");\n _balances[id][from] = balance - value;\n // Cannot underflow\n _supplies[id] -= value;\n }\n\n function _burnNFT(\n address from,\n uint256 id,\n uint256 value,\n bool operatable,\n bool isBatch\n ) internal virtual {\n require(value == 1, \"Inventory: wrong NFT value\");\n uint256 owner = _owners[id];\n require(from == address(uint160(owner)), \"Inventory: non-owned NFT\");\n if (!operatable) {\n require((owner & _APPROVAL_BIT_TOKEN_OWNER_ != 0) && _msgSender() == _nftApprovals[id], \"Inventory: non-approved sender\");\n }\n _owners[id] = _BURNT_NFT_OWNER;\n\n if (!isBatch) {\n _burnNFTUpdateCollection(from, id.getNonFungibleCollection(_collectionMaskLength), 1);\n\n // cannot underflow as balance is verified through NFT ownership\n --_nftBalances[from];\n }\n }\n\n function _burnNFTUpdateCollection(\n address from,\n uint256 collectionId,\n uint256 amount\n ) internal virtual {\n // cannot underflow as balance is verified through NFT ownership\n _balances[collectionId][from] -= amount;\n _supplies[collectionId] -= amount;\n }\n}\n"
},
"contracts/metadata/NFTBaseMetadataURI.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\nimport {UInt256ToDecimalString} from \"@animoca/ethereum-contracts-core/contracts/utils/types/UInt256ToDecimalString.sol\";\nimport {ManagedIdentity} from \"@animoca/ethereum-contracts-core/contracts/metatx/ManagedIdentity.sol\";\nimport {Ownable} from \"@animoca/ethereum-contracts-core/contracts/access/Ownable.sol\";\n\nabstract contract NFTBaseMetadataURI is ManagedIdentity, Ownable {\n using UInt256ToDecimalString for uint256;\n\n event BaseMetadataURISet(string baseMetadataURI);\n\n string public baseMetadataURI;\n\n function setBaseMetadataURI(string calldata baseMetadataURI_) external {\n _requireOwnership(_msgSender());\n baseMetadataURI = baseMetadataURI_;\n emit BaseMetadataURISet(baseMetadataURI_);\n }\n\n function _uri(uint256 id) internal view virtual returns (string memory) {\n return string(abi.encodePacked(baseMetadataURI, id.toDecimalString()));\n }\n}\n"
},
"@animoca/ethereum-contracts-core/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\nimport {ManagedIdentity} from \"../metatx/ManagedIdentity.sol\";\nimport {IERC173} from \"./IERC173.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is ManagedIdentity, IERC173 {\n address internal _owner;\n\n /**\n * Initializes the contract, setting the deployer as the initial owner.\n * @dev Emits an {IERC173-OwnershipTransferred(address,address)} event.\n */\n constructor(address owner_) {\n _owner = owner_;\n emit OwnershipTransferred(address(0), owner_);\n }\n\n /**\n * Gets the address of the current contract owner.\n */\n function owner() public view virtual override returns (address) {\n return _owner;\n }\n\n /**\n * See {IERC173-transferOwnership(address)}\n * @dev Reverts if the sender is not the current contract owner.\n * @param newOwner the address of the new owner. Use the zero address to renounce the ownership.\n */\n function transferOwnership(address newOwner) public virtual override {\n _requireOwnership(_msgSender());\n _owner = newOwner;\n emit OwnershipTransferred(_owner, newOwner);\n }\n\n /**\n * @dev Reverts if `account` is not the contract owner.\n * @param account the account to test.\n */\n function _requireOwnership(address account) internal virtual {\n require(account == this.owner(), \"Ownable: not the owner\");\n }\n}\n"
},
"@animoca/ethereum-contracts-core/contracts/utils/ERC20Wrapper.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\nimport {AddressIsContract} from \"./types/AddressIsContract.sol\";\n\n/**\n * @title ERC20Wrapper\n * Wraps ERC20 functions to support non-standard implementations which do not return a bool value.\n * Calls to the wrapped functions revert only if they throw or if they return false.\n */\nlibrary ERC20Wrapper {\n using AddressIsContract for address;\n\n function wrappedTransfer(\n IWrappedERC20 token,\n address to,\n uint256 value\n ) internal {\n _callWithOptionalReturnData(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function wrappedTransferFrom(\n IWrappedERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callWithOptionalReturnData(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n function wrappedApprove(\n IWrappedERC20 token,\n address spender,\n uint256 value\n ) internal {\n _callWithOptionalReturnData(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function _callWithOptionalReturnData(IWrappedERC20 token, bytes memory callData) internal {\n address target = address(token);\n require(target.isContract(), \"ERC20Wrapper: non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = target.call(callData);\n if (success) {\n if (data.length != 0) {\n require(abi.decode(data, (bool)), \"ERC20Wrapper: operation failed\");\n }\n } else {\n // revert using a standard revert message\n if (data.length == 0) {\n revert(\"ERC20Wrapper: operation failed\");\n }\n\n // revert using the revert message coming from the call\n assembly {\n let size := mload(data)\n revert(add(32, data), size)\n }\n }\n }\n}\n\ninterface IWrappedERC20 {\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n}\n"
},
"@animoca/ethereum-contracts-core/contracts/access/IERC173.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\n/**\n * @title ERC-173 Contract Ownership Standard\n * Note: the ERC-165 identifier for this interface is 0x7f5828d0\n */\ninterface IERC173 {\n /**\n * Event emited when ownership of a contract changes.\n * @param previousOwner the previous owner.\n * @param newOwner the new owner.\n */\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * Get the address of the owner\n * @return The address of the owner.\n */\n function owner() external view returns (address);\n\n /**\n * Set the address of the new owner of the contract\n * Set newOwner to address(0) to renounce any ownership.\n * @dev Emits an {OwnershipTransferred} event.\n * @param newOwner The address of the new owner of the contract. Using the zero address means renouncing ownership.\n */\n function transferOwnership(address newOwner) external;\n}\n"
},
"@animoca/ethereum-contracts-core/contracts/utils/types/AddressIsContract.sol": {
"content": "// SPDX-License-Identifier: MIT\n\n// Partially derived from OpenZeppelin:\n// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/406c83649bd6169fc1b578e08506d78f0873b276/contracts/utils/Address.sol\n\npragma solidity >=0.7.6 <0.8.0;\n\n/**\n * @dev Upgrades the address type to check if it is a contract.\n */\nlibrary AddressIsContract {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n}\n"
},
"ethereum-universal-forwarder/src/solc_0.7/ERC2771/UsingAppendedCallData.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.7.0;\n\nabstract contract UsingAppendedCallData {\n function _lastAppendedDataAsSender() internal pure virtual returns (address payable sender) {\n // Copied from openzeppelin : https://github.com/OpenZeppelin/openzeppelin-contracts/blob/9d5f77db9da0604ce0b25148898a94ae2c20d70f/contracts/metatx/ERC2771Context.sol1\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n }\n\n function _msgDataAssuming20BytesAppendedData() internal pure virtual returns (bytes calldata) {\n return msg.data[:msg.data.length - 20];\n }\n}\n"
},
"ethereum-universal-forwarder/src/solc_0.7/ERC2771/IERC2771.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.7.0;\n\ninterface IERC2771 {\n function isTrustedForwarder(address forwarder) external view returns (bool);\n}\n"
},
"contracts/token/ERC1155/ERC1155InventoryIdentifiersLib.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\n/**\n * @title ERC1155InventoryIdentifiersLib, a library to introspect inventory identifiers.\n * @dev With 0 < N < 256 representing the Non-Fungible Collection mask length, identifiers are represented as follow:\n * (a) a Fungible Token:\n * - most significant bit == 0\n * (b) a Non-Fungible Collection:\n * - most significant bit == 1\n * - (256-N) least significant bits == 0\n * (c) a Non-Fungible Token:\n * - most significant bit == 1\n * - (256-N) least significant bits != 0\n */\nlibrary ERC1155InventoryIdentifiersLib {\n // Non-Fungible bit. If an id has this bit set, it is a Non-Fungible (either Collection or Token)\n uint256 internal constant _NF_BIT = 1 << 255;\n\n function isFungibleToken(uint256 id) internal pure returns (bool) {\n return id & _NF_BIT == 0;\n }\n\n function isNonFungibleToken(uint256 id, uint256 collectionMaskLength) internal pure returns (bool) {\n return id & _NF_BIT != 0 && id & _getNonFungibleTokenMask(collectionMaskLength) != 0;\n }\n\n function getNonFungibleCollection(uint256 nftId, uint256 collectionMaskLength) internal pure returns (uint256) {\n return nftId & ~_getNonFungibleTokenMask(collectionMaskLength);\n }\n\n function _getNonFungibleTokenMask(uint256 collectionMaskLength) private pure returns (uint256) {\n return (1 << (256 - collectionMaskLength)) - 1;\n }\n}\n"
},
"contracts/token/ERC1155721/ERC1155721Inventory.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.7.6 <0.8.0;\n\nimport {AddressIsContract} from \"@animoca/ethereum-contracts-core/contracts/utils/types/AddressIsContract.sol\";\nimport {ERC1155InventoryIdentifiersLib} from \"./../ERC1155/ERC1155InventoryIdentifiersLib.sol\";\nimport {IERC165} from \"@animoca/ethereum-contracts-core/contracts/introspection/IERC165.sol\";\nimport {IERC721} from \"./../ERC721/interfaces/IERC721.sol\";\nimport {IERC721Metadata} from \"./../ERC721/interfaces/IERC721Metadata.sol\";\nimport {IERC721BatchTransfer} from \"./../ERC721/interfaces/IERC721BatchTransfer.sol\";\nimport {IERC721Receiver} from \"./../ERC721/interfaces/IERC721Receiver.sol\";\nimport {IERC1155MetadataURI} from \"./../ERC1155/interfaces/IERC1155MetadataURI.sol\";\nimport {IERC1155TokenReceiver} from \"./../ERC1155/interfaces/IERC1155TokenReceiver.sol\";\nimport {IERC1155Inventory} from \"./../ERC1155/interfaces/IERC1155Inventory.sol\";\nimport {IERC1155721Inventory} from \"./interfaces/IERC1155721Inventory.sol\";\nimport {ERC1155InventoryBase} from \"./../ERC1155/ERC1155InventoryBase.sol\";\n\n/**\n * @title ERC1155721Inventory, an ERC1155Inventory with additional support for ERC721.\n * @dev The function `uri(uint256)` needs to be implemented by a child contract, for example with the help of `NFTBaseMetadataURI`.\n */\nabstract contract ERC1155721Inventory is IERC1155721Inventory, IERC721Metadata, ERC1155InventoryBase {\n using ERC1155InventoryIdentifiersLib for uint256;\n using AddressIsContract for address;\n\n uint256 internal constant _APPROVAL_BIT_TOKEN_OWNER_ = 1 << 160;\n\n string internal _name;\n string internal _symbol;\n\n /* owner => NFT balance */\n mapping(address => uint256) internal _nftBalances;\n\n /* NFT ID => operator */\n mapping(uint256 => address) internal _nftApprovals;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 collectionMaskLength\n ) ERC1155InventoryBase(collectionMaskLength) {\n _name = name_;\n _symbol = symbol_;\n }\n\n //======================================================= ERC165 ========================================================//\n\n /// @inheritdoc IERC165\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n interfaceId == type(IERC721B