zellic-audit
Initial commit
f998fcd
raw
history blame
77.2 kB
{
"language": "Solidity",
"sources": {
"contracts/QUANTNFT_EXTENSION.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: turcotte.eth\n\nimport \"@manifoldxyz/creator-core-solidity/contracts/core/IERC1155CreatorCore.sol\";\nimport \"@manifoldxyz/creator-core-solidity/contracts/extensions/CreatorExtensionBasic.sol\";\n\ncontract QUANTNFT_EXTENSION is CreatorExtensionBasic {\n address _creator_contract_address;\n address _owner_wallet_address;\n\n struct Token {\n string name;\n string uri;\n uint256 priceWei;\n uint256 invocations;\n uint256 maxInvocations;\n bool active;\n bool locked;\n }\n\n mapping(uint256 => Token) tokens;\n uint256[] _mintedTokens;\n\n event Minted(uint256 tokenId, uint256 amount);\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(CreatorExtensionBasic)\n returns (bool)\n {\n return CreatorExtensionBasic.supportsInterface(interfaceId);\n }\n\n constructor(address creator, address owner) {\n require(\n ERC165Checker.supportsInterface(\n creator,\n type(IERC1155CreatorCore).interfaceId\n ),\n \"creator must implement IERC1155CreatorCore\"\n );\n\n _creator_contract_address = creator;\n _owner_wallet_address = owner;\n }\n\n function configureTokenMint(\n uint256 tokenId,\n string memory name,\n string memory uri,\n uint256 priceWei,\n uint256 maxInvocations,\n bool active,\n bool locked\n ) external adminRequired {\n if (!tokens[tokenId].locked) {\n tokens[tokenId].name = name;\n tokens[tokenId].uri = uri;\n tokens[tokenId].priceWei = priceWei;\n tokens[tokenId].maxInvocations = maxInvocations;\n tokens[tokenId].active = active;\n tokens[tokenId].locked = locked;\n }\n }\n\n function toggleActive(uint256 tokenId, bool active) external adminRequired {\n tokens[tokenId].active = active;\n }\n\n function mint(uint256 tokenId, uint256 amount) external payable {\n if (msg.value < tokens[tokenId].priceWei * amount) {\n revert(\"Not enought ether\");\n }\n _mintNewOrExistingToken(msg.sender, tokenId, amount);\n payable(_owner_wallet_address).transfer(msg.value);\n }\n\n function _mintNewOrExistingToken(\n address address_to,\n uint256 tokenId,\n uint256 amount\n ) internal {\n if (!tokens[tokenId].active) {\n revert(\"Token is not active\");\n }\n if (\n tokens[tokenId].invocations + amount >\n tokens[tokenId].maxInvocations\n ) {\n revert(\"Max invocations reached\");\n }\n if (tokens[tokenId].invocations == 0) {\n _mintNewToken(address_to, amount, tokens[tokenId].uri);\n } else {\n _mintExistingToken(address_to, tokenId, amount);\n }\n tokens[tokenId].invocations += amount;\n emit Minted(tokenId, amount);\n }\n\n function _mintNewToken(\n address to,\n uint256 amount,\n string memory uri\n ) internal {\n address[] memory tos = new address[](1);\n uint256[] memory amounts = new uint256[](1);\n string[] memory uris = new string[](1);\n\n tos[0] = to;\n amounts[0] = amount;\n uris[0] = uri;\n\n uint256[] memory tokenIds = IERC1155CreatorCore(\n _creator_contract_address\n ).mintExtensionNew(tos, amounts, uris);\n _mintedTokens.push(tokenIds[0]);\n }\n\n function _mintExistingToken(\n address to,\n uint256 tokenId,\n uint256 amount\n ) internal {\n address[] memory tos = new address[](1);\n uint256[] memory tokenIds = new uint256[](1);\n uint256[] memory amounts = new uint256[](1);\n\n tos[0] = to;\n tokenIds[0] = tokenId;\n amounts[0] = amount;\n\n IERC1155CreatorCore(_creator_contract_address).mintExtensionExisting(\n tos,\n tokenIds,\n amounts\n );\n }\n\n function mintedTokens() external view returns (uint256[] memory) {\n return _mintedTokens;\n }\n}\n"
},
"@manifoldxyz/creator-core-solidity/contracts/core/IERC1155CreatorCore.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"./CreatorCore.sol\";\n\n/**\n * @dev Core ERC1155 creator interface\n */\ninterface IERC1155CreatorCore is ICreatorCore {\n\n /**\n * @dev mint a token with no extension. Can only be called by an admin.\n *\n * @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)\n * @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array\n * @param uris - If no elements, all tokens use the default uri.\n * If any element is an empty string, the corresponding token uses the default uri.\n *\n *\n * Requirements: If to is a multi-element array, then uris must be empty or single element array\n * If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size\n * If to is a single element array, uris must be empty or the same length as amounts\n *\n * Examples:\n * mintBaseNew(['0x....1', '0x....2'], [1], [])\n * Mints a single new token, and gives 1 each to '0x....1' and '0x....2'. Token uses default uri.\n * \n * mintBaseNew(['0x....1', '0x....2'], [1, 2], [])\n * Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'. Token uses default uri.\n * \n * mintBaseNew(['0x....1'], [1, 2], [\"\", \"http://token2.com\"])\n * Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second. 1st token uses default uri, second uses \"http://token2.com\".\n * \n * @return Returns list of tokenIds minted\n */\n function mintBaseNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);\n\n /**\n * @dev batch mint existing token with no extension. Can only be called by an admin.\n *\n * @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)\n * @param tokenIds - Can be a single element array (all recipients get the same token) or a multi-element array\n * @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array\n *\n * Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays\n *\n * Examples:\n * mintBaseExisting(['0x....1', '0x....2'], [1], [10])\n * Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'.\n * \n * mintBaseExisting(['0x....1', '0x....2'], [1, 2], [10, 20])\n * Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'.\n * \n * mintBaseExisting(['0x....1'], [1, 2], [10, 20])\n * Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'.\n * \n * mintBaseExisting(['0x....1', '0x....2'], [1], [10, 20])\n * Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'.\n * \n */\n function mintBaseExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;\n\n /**\n * @dev mint a token from an extension. Can only be called by a registered extension.\n *\n * @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)\n * @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array\n * @param uris - If no elements, all tokens use the default uri.\n * If any element is an empty string, the corresponding token uses the default uri.\n *\n *\n * Requirements: If to is a multi-element array, then uris must be empty or single element array\n * If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size\n * If to is a single element array, uris must be empty or the same length as amounts\n *\n * Examples:\n * mintExtensionNew(['0x....1', '0x....2'], [1], [])\n * Mints a single new token, and gives 1 each to '0x....1' and '0x....2'. Token uses default uri.\n * \n * mintExtensionNew(['0x....1', '0x....2'], [1, 2], [])\n * Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'. Token uses default uri.\n * \n * mintExtensionNew(['0x....1'], [1, 2], [\"\", \"http://token2.com\"])\n * Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second. 1st token uses default uri, second uses \"http://token2.com\".\n * \n * @return Returns list of tokenIds minted\n */\n function mintExtensionNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);\n\n /**\n * @dev batch mint existing token from extension. Can only be called by a registered extension.\n *\n * @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)\n * @param tokenIds - Can be a single element array (all recipients get the same token) or a multi-element array\n * @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array\n *\n * Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays\n *\n * Examples:\n * mintExtensionExisting(['0x....1', '0x....2'], [1], [10])\n * Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'.\n * \n * mintExtensionExisting(['0x....1', '0x....2'], [1, 2], [10, 20])\n * Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'.\n * \n * mintExtensionExisting(['0x....1'], [1, 2], [10, 20])\n * Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'.\n * \n * mintExtensionExisting(['0x....1', '0x....2'], [1], [10, 20])\n * Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'.\n * \n */\n function mintExtensionExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;\n\n /**\n * @dev burn tokens. Can only be called by token owner or approved address.\n * On burn, calls back to the registered extension's onBurn method\n */\n function burn(address account, uint256[] calldata tokenIds, uint256[] calldata amounts) external;\n\n /**\n * @dev Total amount of tokens in with a given tokenId.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256);\n}"
},
"@manifoldxyz/creator-core-solidity/contracts/extensions/CreatorExtensionBasic.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\nimport \"@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol\";\n\nimport \"../core/ICreatorCore.sol\";\nimport \"./ICreatorExtensionBasic.sol\";\nimport \"./CreatorExtension.sol\";\n\n/**\n * @dev Provides functions to set token uri's\n */\nabstract contract CreatorExtensionBasic is AdminControl, CreatorExtension, ICreatorExtensionBasic {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(AdminControl, CreatorExtension, IERC165) returns (bool) {\n return interfaceId == type(ICreatorExtensionBasic).interfaceId\n || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {ICreatorExtensionBasic-setBaseTokenURI}.\n */\n function setBaseTokenURI(address creator, string calldata uri) external override adminRequired {\n require(ERC165Checker.supportsInterface(creator, type(ICreatorCore).interfaceId), \"Requires creator to implement ICreatorCore\");\n ICreatorCore(creator).setBaseTokenURIExtension(uri);\n }\n\n /**\n * @dev See {ICreatorExtensionBasic-setBaseTokenURI}.\n */\n function setBaseTokenURI(address creator, string calldata uri, bool identical) external override adminRequired {\n require(ERC165Checker.supportsInterface(creator, type(ICreatorCore).interfaceId), \"Requires creator to implement CreatorCore\");\n ICreatorCore(creator).setBaseTokenURIExtension(uri, identical);\n }\n\n /**\n * @dev See {ICreatorExtensionBasic-setTokenURI}.\n */\n function setTokenURI(address creator, uint256 tokenId, string calldata uri) external override adminRequired {\n require(ERC165Checker.supportsInterface(creator, type(ICreatorCore).interfaceId), \"Requires creator to implement CreatorCore\");\n ICreatorCore(creator).setTokenURIExtension(tokenId, uri);\n }\n\n /**\n * @dev See {ICreatorExtensionBasic-setTokenURI}.\n */\n function setTokenURI(address creator, uint256[] calldata tokenIds, string[] calldata uris) external override adminRequired {\n require(ERC165Checker.supportsInterface(creator, type(ICreatorCore).interfaceId), \"Requires creator to implement CreatorCore\");\n ICreatorCore(creator).setTokenURIExtension(tokenIds, uris);\n }\n\n /**\n * @dev See {ICreatorExtensionBasic-setTokenURIPrefix}.\n */\n function setTokenURIPrefix(address creator, string calldata prefix) external override adminRequired {\n require(ERC165Checker.supportsInterface(creator, type(ICreatorCore).interfaceId), \"Requires creator to implement CreatorCore\");\n ICreatorCore(creator).setTokenURIPrefixExtension(prefix);\n }\n\n\n}"
},
"@manifoldxyz/creator-core-solidity/contracts/core/CreatorCore.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\n\nimport \"../extensions/ICreatorExtensionTokenURI.sol\";\n\nimport \"./ICreatorCore.sol\";\n\n/**\n * @dev Core creator implementation\n */\nabstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 {\n using Strings for uint256;\n using EnumerableSet for EnumerableSet.AddressSet;\n using AddressUpgradeable for address;\n\n uint256 _tokenCount = 0;\n\n // Track registered extensions data\n EnumerableSet.AddressSet internal _extensions;\n EnumerableSet.AddressSet internal _blacklistedExtensions;\n mapping (address => address) internal _extensionPermissions;\n mapping (address => bool) internal _extensionApproveTransfers;\n \n // For tracking which extension a token was minted by\n mapping (uint256 => address) internal _tokensExtension;\n\n // The baseURI for a given extension\n mapping (address => string) private _extensionBaseURI;\n mapping (address => bool) private _extensionBaseURIIdentical;\n\n // The prefix for any tokens with a uri configured\n mapping (address => string) private _extensionURIPrefix;\n\n // Mapping for individual token URIs\n mapping (uint256 => string) internal _tokenURIs;\n\n \n // Royalty configurations\n mapping (address => address payable[]) internal _extensionRoyaltyReceivers;\n mapping (address => uint256[]) internal _extensionRoyaltyBPS;\n mapping (uint256 => address payable[]) internal _tokenRoyaltyReceivers;\n mapping (uint256 => uint256[]) internal _tokenRoyaltyBPS;\n\n /**\n * External interface identifiers for royalties\n */\n\n /**\n * @dev CreatorCore\n *\n * bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6\n *\n * => 0xbb3bafd6 = 0xbb3bafd6\n */\n bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;\n\n /**\n * @dev Rarible: RoyaltiesV1\n *\n * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb\n * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f\n *\n * => 0xb9c4d9fb ^ 0x0ebd4c7f = 0xb7799584\n */\n bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;\n\n /**\n * @dev Foundation\n *\n * bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c\n *\n * => 0xd5a06d4c = 0xd5a06d4c\n */\n bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0xd5a06d4c;\n\n /**\n * @dev EIP-2981\n *\n * bytes4(keccak256(\"royaltyInfo(uint256,uint256)\")) == 0x2a55205a\n *\n * => 0x2a55205a = 0x2a55205a\n */\n bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(ICreatorCore).interfaceId || super.supportsInterface(interfaceId)\n || interfaceId == _INTERFACE_ID_ROYALTIES_CREATORCORE || interfaceId == _INTERFACE_ID_ROYALTIES_RARIBLE\n || interfaceId == _INTERFACE_ID_ROYALTIES_FOUNDATION || interfaceId == _INTERFACE_ID_ROYALTIES_EIP2981;\n }\n\n /**\n * @dev Only allows registered extensions to call the specified function\n */\n modifier extensionRequired() {\n require(_extensions.contains(msg.sender), \"Must be registered extension\");\n _;\n }\n\n /**\n * @dev Only allows non-blacklisted extensions\n */\n modifier nonBlacklistRequired(address extension) {\n require(!_blacklistedExtensions.contains(extension), \"Extension blacklisted\");\n _;\n } \n\n /**\n * @dev See {ICreatorCore-getExtensions}.\n */\n function getExtensions() external view override returns (address[] memory extensions) {\n extensions = new address[](_extensions.length());\n for (uint i = 0; i < _extensions.length(); i++) {\n extensions[i] = _extensions.at(i);\n }\n return extensions;\n }\n\n /**\n * @dev Register an extension\n */\n function _registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) internal {\n require(extension != address(this), \"Creator: Invalid\");\n require(extension.isContract(), \"Creator: Extension must be a contract\");\n if (!_extensions.contains(extension)) {\n _extensionBaseURI[extension] = baseURI;\n _extensionBaseURIIdentical[extension] = baseURIIdentical;\n emit ExtensionRegistered(extension, msg.sender);\n _extensions.add(extension);\n }\n }\n\n /**\n * @dev Unregister an extension\n */\n function _unregisterExtension(address extension) internal {\n if (_extensions.contains(extension)) {\n emit ExtensionUnregistered(extension, msg.sender);\n _extensions.remove(extension);\n }\n }\n\n /**\n * @dev Blacklist an extension\n */\n function _blacklistExtension(address extension) internal {\n require(extension != address(this), \"Cannot blacklist yourself\");\n if (_extensions.contains(extension)) {\n emit ExtensionUnregistered(extension, msg.sender);\n _extensions.remove(extension);\n }\n if (!_blacklistedExtensions.contains(extension)) {\n emit ExtensionBlacklisted(extension, msg.sender);\n _blacklistedExtensions.add(extension);\n }\n }\n\n /**\n * @dev Set base token uri for an extension\n */\n function _setBaseTokenURIExtension(string calldata uri, bool identical) internal {\n _extensionBaseURI[msg.sender] = uri;\n _extensionBaseURIIdentical[msg.sender] = identical;\n }\n\n /**\n * @dev Set token uri prefix for an extension\n */\n function _setTokenURIPrefixExtension(string calldata prefix) internal {\n _extensionURIPrefix[msg.sender] = prefix;\n }\n\n /**\n * @dev Set token uri for a token of an extension\n */\n function _setTokenURIExtension(uint256 tokenId, string calldata uri) internal {\n require(_tokensExtension[tokenId] == msg.sender, \"Invalid token\");\n _tokenURIs[tokenId] = uri;\n }\n\n /**\n * @dev Set base token uri for tokens with no extension\n */\n function _setBaseTokenURI(string memory uri) internal {\n _extensionBaseURI[address(this)] = uri;\n }\n\n /**\n * @dev Set token uri prefix for tokens with no extension\n */\n function _setTokenURIPrefix(string calldata prefix) internal {\n _extensionURIPrefix[address(this)] = prefix;\n }\n\n\n /**\n * @dev Set token uri for a token with no extension\n */\n function _setTokenURI(uint256 tokenId, string calldata uri) internal {\n require(_tokensExtension[tokenId] == address(this), \"Invalid token\");\n _tokenURIs[tokenId] = uri;\n }\n\n /**\n * @dev Retrieve a token's URI\n */\n function _tokenURI(uint256 tokenId) internal view returns (string memory) {\n address extension = _tokensExtension[tokenId];\n require(!_blacklistedExtensions.contains(extension), \"Extension blacklisted\");\n\n if (bytes(_tokenURIs[tokenId]).length != 0) {\n if (bytes(_extensionURIPrefix[extension]).length != 0) {\n return string(abi.encodePacked(_extensionURIPrefix[extension],_tokenURIs[tokenId]));\n }\n return _tokenURIs[tokenId];\n }\n\n if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionTokenURI).interfaceId)) {\n return ICreatorExtensionTokenURI(extension).tokenURI(address(this), tokenId);\n }\n\n if (!_extensionBaseURIIdentical[extension]) {\n return string(abi.encodePacked(_extensionBaseURI[extension], tokenId.toString()));\n } else {\n return _extensionBaseURI[extension];\n }\n }\n\n /**\n * Get token extension\n */\n function _tokenExtension(uint256 tokenId) internal view returns (address extension) {\n extension = _tokensExtension[tokenId];\n\n require(extension != address(this), \"No extension for token\");\n require(!_blacklistedExtensions.contains(extension), \"Extension blacklisted\");\n\n return extension;\n }\n\n /**\n * Helper to get royalties for a token\n */\n function _getRoyalties(uint256 tokenId) view internal returns (address payable[] storage, uint256[] storage) {\n return (_getRoyaltyReceivers(tokenId), _getRoyaltyBPS(tokenId));\n }\n\n /**\n * Helper to get royalty receivers for a token\n */\n function _getRoyaltyReceivers(uint256 tokenId) view internal returns (address payable[] storage) {\n if (_tokenRoyaltyReceivers[tokenId].length > 0) {\n return _tokenRoyaltyReceivers[tokenId];\n } else if (_extensionRoyaltyReceivers[_tokensExtension[tokenId]].length > 0) {\n return _extensionRoyaltyReceivers[_tokensExtension[tokenId]];\n }\n return _extensionRoyaltyReceivers[address(this)]; \n }\n\n /**\n * Helper to get royalty basis points for a token\n */\n function _getRoyaltyBPS(uint256 tokenId) view internal returns (uint256[] storage) {\n if (_tokenRoyaltyBPS[tokenId].length > 0) {\n return _tokenRoyaltyBPS[tokenId];\n } else if (_extensionRoyaltyBPS[_tokensExtension[tokenId]].length > 0) {\n return _extensionRoyaltyBPS[_tokensExtension[tokenId]];\n }\n return _extensionRoyaltyBPS[address(this)]; \n }\n\n function _getRoyaltyInfo(uint256 tokenId, uint256 value) view internal returns (address receiver, uint256 amount){\n address payable[] storage receivers = _getRoyaltyReceivers(tokenId);\n require(receivers.length <= 1, \"More than 1 royalty receiver\");\n \n if (receivers.length == 0) {\n return (address(this), 0);\n }\n return (receivers[0], _getRoyaltyBPS(tokenId)[0]*value/10000);\n }\n\n /**\n * Set royalties for a token\n */\n function _setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {\n require(receivers.length == basisPoints.length, \"Invalid input\");\n uint256 totalBasisPoints;\n for (uint i = 0; i < basisPoints.length; i++) {\n totalBasisPoints += basisPoints[i];\n }\n require(totalBasisPoints < 10000, \"Invalid total royalties\");\n _tokenRoyaltyReceivers[tokenId] = receivers;\n _tokenRoyaltyBPS[tokenId] = basisPoints;\n emit RoyaltiesUpdated(tokenId, receivers, basisPoints);\n }\n\n /**\n * Set royalties for all tokens of an extension\n */\n function _setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {\n require(receivers.length == basisPoints.length, \"Invalid input\");\n uint256 totalBasisPoints;\n for (uint i = 0; i < basisPoints.length; i++) {\n totalBasisPoints += basisPoints[i];\n }\n require(totalBasisPoints < 10000, \"Invalid total royalties\");\n _extensionRoyaltyReceivers[extension] = receivers;\n _extensionRoyaltyBPS[extension] = basisPoints;\n if (extension == address(this)) {\n emit DefaultRoyaltiesUpdated(receivers, basisPoints);\n } else {\n emit ExtensionRoyaltiesUpdated(extension, receivers, basisPoints);\n }\n }\n\n\n}\n"
},
"@openzeppelin/contracts/security/ReentrancyGuard.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n"
},
"@openzeppelin/contracts/utils/Strings.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n"
},
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
},
"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.2) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface,\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return\n _supportsERC165Interface(account, type(IERC165).interfaceId) &&\n !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)\n internal\n view\n returns (bool[] memory)\n {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in _interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!_supportsERC165Interface(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n * Interface identification is specified in ERC-165.\n */\n function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {\n // prepare call\n bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\n\n // perform static call\n bool success;\n uint256 returnSize;\n uint256 returnValue;\n assembly {\n success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n returnSize := returndatasize()\n returnValue := mload(0x00)\n }\n\n return success && returnSize >= 0x20 && returnValue > 0;\n }\n}\n"
},
"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\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 * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
},
"@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Implement this if you want your extension to have overloadable URI's\n */\ninterface ICreatorExtensionTokenURI is IERC165 {\n\n /**\n * Get the uri for a given creator/tokenId\n */\n function tokenURI(address creator, uint256 tokenId) external view returns (string memory);\n}\n"
},
"@manifoldxyz/creator-core-solidity/contracts/core/ICreatorCore.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Core creator interface\n */\ninterface ICreatorCore is IERC165 {\n\n event ExtensionRegistered(address indexed extension, address indexed sender);\n event ExtensionUnregistered(address indexed extension, address indexed sender);\n event ExtensionBlacklisted(address indexed extension, address indexed sender);\n event MintPermissionsUpdated(address indexed extension, address indexed permissions, address indexed sender);\n event RoyaltiesUpdated(uint256 indexed tokenId, address payable[] receivers, uint256[] basisPoints);\n event DefaultRoyaltiesUpdated(address payable[] receivers, uint256[] basisPoints);\n event ExtensionRoyaltiesUpdated(address indexed extension, address payable[] receivers, uint256[] basisPoints);\n event ExtensionApproveTransferUpdated(address indexed extension, bool enabled);\n\n /**\n * @dev gets address of all extensions\n */\n function getExtensions() external view returns (address[] memory);\n\n /**\n * @dev add an extension. Can only be called by contract owner or admin.\n * extension address must point to a contract implementing ICreatorExtension.\n * Returns True if newly added, False if already added.\n */\n function registerExtension(address extension, string calldata baseURI) external;\n\n /**\n * @dev add an extension. Can only be called by contract owner or admin.\n * extension address must point to a contract implementing ICreatorExtension.\n * Returns True if newly added, False if already added.\n */\n function registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) external;\n\n /**\n * @dev add an extension. Can only be called by contract owner or admin.\n * Returns True if removed, False if already removed.\n */\n function unregisterExtension(address extension) external;\n\n /**\n * @dev blacklist an extension. Can only be called by contract owner or admin.\n * This function will destroy all ability to reference the metadata of any tokens created\n * by the specified extension. It will also unregister the extension if needed.\n * Returns True if removed, False if already removed.\n */\n function blacklistExtension(address extension) external;\n\n /**\n * @dev set the baseTokenURI of an extension. Can only be called by extension.\n */\n function setBaseTokenURIExtension(string calldata uri) external;\n\n /**\n * @dev set the baseTokenURI of an extension. Can only be called by extension.\n * For tokens with no uri configured, tokenURI will return \"uri+tokenId\"\n */\n function setBaseTokenURIExtension(string calldata uri, bool identical) external;\n\n /**\n * @dev set the common prefix of an extension. Can only be called by extension.\n * If configured, and a token has a uri set, tokenURI will return \"prefixURI+tokenURI\"\n * Useful if you want to use ipfs/arweave\n */\n function setTokenURIPrefixExtension(string calldata prefix) external;\n\n /**\n * @dev set the tokenURI of a token extension. Can only be called by extension that minted token.\n */\n function setTokenURIExtension(uint256 tokenId, string calldata uri) external;\n\n /**\n * @dev set the tokenURI of a token extension for multiple tokens. Can only be called by extension that minted token.\n */\n function setTokenURIExtension(uint256[] memory tokenId, string[] calldata uri) external;\n\n /**\n * @dev set the baseTokenURI for tokens with no extension. Can only be called by owner/admin.\n * For tokens with no uri configured, tokenURI will return \"uri+tokenId\"\n */\n function setBaseTokenURI(string calldata uri) external;\n\n /**\n * @dev set the common prefix for tokens with no extension. Can only be called by owner/admin.\n * If configured, and a token has a uri set, tokenURI will return \"prefixURI+tokenURI\"\n * Useful if you want to use ipfs/arweave\n */\n function setTokenURIPrefix(string calldata prefix) external;\n\n /**\n * @dev set the tokenURI of a token with no extension. Can only be called by owner/admin.\n */\n function setTokenURI(uint256 tokenId, string calldata uri) external;\n\n /**\n * @dev set the tokenURI of multiple tokens with no extension. Can only be called by owner/admin.\n */\n function setTokenURI(uint256[] memory tokenIds, string[] calldata uris) external;\n\n /**\n * @dev set a permissions contract for an extension. Used to control minting.\n */\n function setMintPermissions(address extension, address permissions) external;\n\n /**\n * @dev Configure so transfers of tokens created by the caller (must be extension) gets approval\n * from the extension before transferring\n */\n function setApproveTransferExtension(bool enabled) external;\n\n /**\n * @dev get the extension of a given token\n */\n function tokenExtension(uint256 tokenId) external view returns (address);\n\n /**\n * @dev Set default royalties\n */\n function setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) external;\n\n /**\n * @dev Set royalties of a token\n */\n function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;\n\n /**\n * @dev Set royalties of an extension\n */\n function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external;\n\n /**\n * @dev Get royalites of a token. Returns list of receivers and basisPoints\n */\n function getRoyalties(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);\n \n // Royalty support for various other standards\n function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory);\n function getFeeBps(uint256 tokenId) external view returns (uint[] memory);\n function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);\n function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);\n\n}\n"
},
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\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"
},
"@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./IAdminControl.sol\";\n\nabstract contract AdminControl is Ownable, IAdminControl, ERC165 {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n // Track registered admins\n EnumerableSet.AddressSet private _admins;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IAdminControl).interfaceId\n || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Only allows approved admins to call the specified function\n */\n modifier adminRequired() {\n require(owner() == msg.sender || _admins.contains(msg.sender), \"AdminControl: Must be owner or admin\");\n _;\n } \n\n /**\n * @dev See {IAdminControl-getAdmins}.\n */\n function getAdmins() external view override returns (address[] memory admins) {\n admins = new address[](_admins.length());\n for (uint i = 0; i < _admins.length(); i++) {\n admins[i] = _admins.at(i);\n }\n return admins;\n }\n\n /**\n * @dev See {IAdminControl-approveAdmin}.\n */\n function approveAdmin(address admin) external override onlyOwner {\n if (!_admins.contains(admin)) {\n emit AdminApproved(admin, msg.sender);\n _admins.add(admin);\n }\n }\n\n /**\n * @dev See {IAdminControl-revokeAdmin}.\n */\n function revokeAdmin(address admin) external override onlyOwner {\n if (_admins.contains(admin)) {\n emit AdminRevoked(admin, msg.sender);\n _admins.remove(admin);\n }\n }\n\n /**\n * @dev See {IAdminControl-isAdmin}.\n */\n function isAdmin(address admin) public override view returns (bool) {\n return (owner() == admin || _admins.contains(admin));\n }\n\n}"
},
"@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionBasic.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Provides functions to set token uri's\n */\ninterface ICreatorExtensionBasic is IERC165 {\n\n /**\n * @dev set the baseTokenURI of tokens generated by this extension. Can only be called by admins.\n */\n function setBaseTokenURI(address creator, string calldata uri) external;\n\n /**\n * @dev set the baseTokenURI of tokens generated by this extension. Can only be called by admins.\n */\n function setBaseTokenURI(address creator, string calldata uri, bool identical) external;\n\n /**\n * @dev set the tokenURI of a token generated by this extension. Can only be called by admins.\n */\n function setTokenURI(address creator, uint256 tokenId, string calldata uri) external;\n\n /**\n * @dev set the tokenURI of multiple tokens generated by this extension. Can only be called by admins.\n */\n function setTokenURI(address creator, uint256[] calldata tokenId, string[] calldata uri) external;\n\n /**\n * @dev set the extension's token uri prefix\n */\n function setTokenURIPrefix(address creator, string calldata prefix) external;\n}\n"
},
"@manifoldxyz/creator-core-solidity/contracts/extensions/CreatorExtension.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\n/**\n * @dev Base creator extension variables\n */\nabstract contract CreatorExtension is ERC165 {\n\n /**\n * @dev Legacy extension interface identifiers\n *\n * {IERC165-supportsInterface} needs to return 'true' for this interface\n * in order backwards compatible with older creator contracts\n */\n bytes4 constant internal LEGACY_EXTENSION_INTERFACE = 0x7005caad;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165) returns (bool) {\n return interfaceId == LEGACY_EXTENSION_INTERFACE\n || super.supportsInterface(interfaceId);\n }\n \n}"
},
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.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 Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@manifoldxyz/libraries-solidity/contracts/access/IAdminControl.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface for admin control\n */\ninterface IAdminControl is IERC165 {\n\n event AdminApproved(address indexed account, address indexed sender);\n event AdminRevoked(address indexed account, address indexed sender);\n\n /**\n * @dev gets address of all admins\n */\n function getAdmins() external view returns (address[] memory);\n\n /**\n * @dev add an admin. Can only be called by contract owner.\n */\n function approveAdmin(address admin) external;\n\n /**\n * @dev remove an admin. Can only be called by contract owner.\n */\n function revokeAdmin(address admin) external;\n\n /**\n * @dev checks whether or not given address is an admin\n * Returns True if they are\n */\n function isAdmin(address admin) external view returns (bool);\n\n}"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev 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, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}