creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "contracts/eip/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 \"./interface/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"
      },
      "contracts/eip/interface/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 * [EIP](https://eips.ethereum.org/EIPS/eip-165).\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     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\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/eip/interface/IERC2981.sol": {
        "content": "// SPDX-License-Identifier: Apache 2.0\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981 is IERC165 {\n    /**\n     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n     * exchange. The royalty amount is denominated and should be payed in that same unit of exchange.\n     */\n    function royaltyInfo(\n        uint256 tokenId,\n        uint256 salePrice\n    ) external view returns (address receiver, uint256 royaltyAmount);\n}\n"
      },
      "contracts/extension/Multicall.sol": {
        "content": "// SPDX-License-Identifier: Apache 2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\nimport \"../lib/Address.sol\";\nimport \"./interface/IMulticall.sol\";\n\n/**\n * @dev Provides a function to batch together multiple calls in a single external call.\n *\n * _Available since v4.1._\n */\ncontract Multicall is IMulticall {\n    /**\n     *  @notice Receives and executes a batch of function calls on this contract.\n     *  @dev Receives and executes a batch of function calls on this contract.\n     *\n     *  @param data The bytes data that makes up the batch of function calls to execute.\n     *  @return results The bytes data that makes up the result of the batch of function calls executed.\n     */\n    function multicall(bytes[] calldata data) external returns (bytes[] memory results) {\n        results = new bytes[](data.length);\n        address sender = _msgSender();\n        bool isForwarder = msg.sender != sender;\n        for (uint256 i = 0; i < data.length; i++) {\n            if (isForwarder) {\n                results[i] = Address.functionDelegateCall(address(this), abi.encodePacked(data[i], sender));\n            } else {\n                results[i] = Address.functionDelegateCall(address(this), data[i]);\n            }\n        }\n        return results;\n    }\n\n    /// @notice Returns the sender in the given execution context.\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n}\n"
      },
      "contracts/extension/interface/IContractMetadata.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\n/**\n *  Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI\n *  for you contract.\n *\n *  Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.\n */\n\ninterface IContractMetadata {\n    /// @dev Returns the metadata URI of the contract.\n    function contractURI() external view returns (string memory);\n\n    /**\n     *  @dev Sets contract URI for the storefront-level metadata of the contract.\n     *       Only module admin can call this function.\n     */\n    function setContractURI(string calldata _uri) external;\n\n    /// @dev Emitted when the contract URI is updated.\n    event ContractURIUpdated(string prevURI, string newURI);\n}\n"
      },
      "contracts/extension/interface/IERC2771Context.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\ninterface IERC2771Context {\n    function isTrustedForwarder(address forwarder) external view returns (bool);\n}\n"
      },
      "contracts/extension/interface/IMulticall.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\n/**\n * @dev Provides a function to batch together multiple calls in a single external call.\n *\n * _Available since v4.1._\n */\ninterface IMulticall {\n    /**\n     * @dev Receives and executes a batch of function calls on this contract.\n     */\n    function multicall(bytes[] calldata data) external returns (bytes[] memory results);\n}\n"
      },
      "contracts/extension/interface/IPermissions.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IPermissions {\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     *\n     * _Available since v3.1._\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {AccessControl-_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) external;\n}\n"
      },
      "contracts/extension/interface/IPermissionsEnumerable.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\nimport \"./IPermissions.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IPermissionsEnumerable is IPermissions {\n    /**\n     * @dev Returns one of the accounts that have `role`. `index` must be a\n     * value between 0 and {getRoleMemberCount}, non-inclusive.\n     *\n     * Role bearers are not sorted in any particular way, and their ordering may\n     * change at any point.\n     *\n     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n     * you perform all queries on the same block. See the following\n     * [forum post](https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296)\n     * for more information.\n     */\n    function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n    /**\n     * @dev Returns the number of accounts that have `role`. Can be used\n     * together with {getRoleMember} to enumerate all bearers of a role.\n     */\n    function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n"
      },
      "contracts/extension/interface/IPlatformFee.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\n/**\n *  Thirdweb's `PlatformFee` is a contract extension to be used with any base contract. It exposes functions for setting and reading\n *  the recipient of platform fee and the platform fee basis points, and lets the inheriting contract perform conditional logic\n *  that uses information about platform fees, if desired.\n */\n\ninterface IPlatformFee {\n    /// @dev Fee type variants: percentage fee and flat fee\n    enum PlatformFeeType {\n        Bps,\n        Flat\n    }\n\n    /// @dev Returns the platform fee bps and recipient.\n    function getPlatformFeeInfo() external view returns (address, uint16);\n\n    /// @dev Lets a module admin update the fees on primary sales.\n    function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external;\n\n    /// @dev Emitted when fee on primary sales is updated.\n    event PlatformFeeInfoUpdated(address indexed platformFeeRecipient, uint256 platformFeeBps);\n\n    /// @dev Emitted when the flat platform fee is updated.\n    event FlatPlatformFeeUpdated(address platformFeeRecipient, uint256 flatFee);\n\n    /// @dev Emitted when the platform fee type is updated.\n    event PlatformFeeTypeUpdated(PlatformFeeType feeType);\n}\n"
      },
      "contracts/extension/interface/IRoyaltyEngineV1.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 Lookup engine interface\n */\ninterface IRoyaltyEngineV1 is IERC165 {\n    /**\n     * Get the royalty for a given token (address, id) and value amount.  Does not cache the bps/amounts.  Caches the spec for a given token address\n     *\n     * @param tokenAddress - The address of the token\n     * @param tokenId      - The id of the token\n     * @param value        - The value you wish to get the royalty of\n     *\n     * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get\n     */\n    function getRoyalty(\n        address tokenAddress,\n        uint256 tokenId,\n        uint256 value\n    ) external returns (address payable[] memory recipients, uint256[] memory amounts);\n\n    /**\n     * View only version of getRoyalty\n     *\n     * @param tokenAddress - The address of the token\n     * @param tokenId      - The id of the token\n     * @param value        - The value you wish to get the royalty of\n     *\n     * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get\n     */\n    function getRoyaltyView(\n        address tokenAddress,\n        uint256 tokenId,\n        uint256 value\n    ) external view returns (address payable[] memory recipients, uint256[] memory amounts);\n}\n"
      },
      "contracts/extension/interface/IRoyaltyPayments.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Read royalty info for a token.\n *      Supports RoyaltyEngineV1 and RoyaltyRegistry by manifold.xyz.\n */\ninterface IRoyaltyPayments is IERC165 {\n    /// @dev Emitted when the address of RoyaltyEngine is set or updated.\n    event RoyaltyEngineUpdated(address indexed previousAddress, address indexed newAddress);\n\n    /**\n     * Get the royalty for a given token (address, id) and value amount.\n     *\n     * @param tokenAddress - The address of the token\n     * @param tokenId      - The id of the token\n     * @param value        - The value you wish to get the royalty of\n     *\n     * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get\n     */\n    function getRoyalty(\n        address tokenAddress,\n        uint256 tokenId,\n        uint256 value\n    ) external returns (address payable[] memory recipients, uint256[] memory amounts);\n\n    /**\n     * Set or override RoyaltyEngine address\n     *\n     * @param _royaltyEngineAddress - RoyaltyEngineV1 address\n     */\n    function setRoyaltyEngine(address _royaltyEngineAddress) external;\n}\n"
      },
      "contracts/extension/upgradeable/ContractMetadata.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\nimport \"../interface/IContractMetadata.sol\";\n\n/**\n *  @author  thirdweb.com\n *\n *  @title   Contract Metadata\n *  @notice  Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI\n *           for you contract.\n *           Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.\n */\n\nlibrary ContractMetadataStorage {\n    /// @custom:storage-location erc7201:contract.metadata.storage\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"contract.metadata.storage\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 public constant CONTRACT_METADATA_STORAGE_POSITION =\n        0x4bc804ba64359c0e35e5ed5d90ee596ecaa49a3a930ddcb1470ea0dd625da900;\n\n    struct Data {\n        /// @notice Returns the contract metadata URI.\n        string contractURI;\n    }\n\n    function data() internal pure returns (Data storage data_) {\n        bytes32 position = CONTRACT_METADATA_STORAGE_POSITION;\n        assembly {\n            data_.slot := position\n        }\n    }\n}\n\nabstract contract ContractMetadata is IContractMetadata {\n    /**\n     *  @notice         Lets a contract admin set the URI for contract-level metadata.\n     *  @dev            Caller should be authorized to setup contractURI, e.g. contract admin.\n     *                  See {_canSetContractURI}.\n     *                  Emits {ContractURIUpdated Event}.\n     *\n     *  @param _uri     keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n     */\n    function setContractURI(string memory _uri) external override {\n        if (!_canSetContractURI()) {\n            revert(\"Not authorized\");\n        }\n\n        _setupContractURI(_uri);\n    }\n\n    /// @dev Lets a contract admin set the URI for contract-level metadata.\n    function _setupContractURI(string memory _uri) internal {\n        string memory prevURI = _contractMetadataStorage().contractURI;\n        _contractMetadataStorage().contractURI = _uri;\n\n        emit ContractURIUpdated(prevURI, _uri);\n    }\n\n    /// @notice Returns the contract metadata URI.\n    function contractURI() public view virtual override returns (string memory) {\n        return _contractMetadataStorage().contractURI;\n    }\n\n    /// @dev Returns the AccountPermissions storage.\n    function _contractMetadataStorage() internal pure returns (ContractMetadataStorage.Data storage data) {\n        data = ContractMetadataStorage.data();\n    }\n\n    /// @dev Returns whether contract metadata can be set in the given execution context.\n    function _canSetContractURI() internal view virtual returns (bool);\n}\n"
      },
      "contracts/extension/upgradeable/ERC2771ContextUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: Apache 2.0\npragma solidity ^0.8.0;\n\nimport \"../interface/IERC2771Context.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev Context variant with ERC2771 support.\n */\n\nlibrary ERC2771ContextStorage {\n    /// @custom:storage-location erc7201:erc2771.context.storage\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"erc2771.context.storage\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 public constant ERC2771_CONTEXT_STORAGE_POSITION =\n        0x82aadcdf5bea62fd30615b6c0754b644e71b6c1e8c55b71bb927ad005b504f00;\n\n    struct Data {\n        mapping(address => bool) trustedForwarder;\n    }\n\n    function data() internal pure returns (Data storage data_) {\n        bytes32 position = ERC2771_CONTEXT_STORAGE_POSITION;\n        assembly {\n            data_.slot := position\n        }\n    }\n}\n\n/**\n * @dev Context variant with ERC2771 support.\n */\nabstract contract ERC2771ContextUpgradeable is Initializable {\n    function __ERC2771Context_init(address[] memory trustedForwarder) internal onlyInitializing {\n        __ERC2771Context_init_unchained(trustedForwarder);\n    }\n\n    function __ERC2771Context_init_unchained(address[] memory trustedForwarder) internal onlyInitializing {\n        for (uint256 i = 0; i < trustedForwarder.length; i++) {\n            _erc2771ContextStorage().trustedForwarder[trustedForwarder[i]] = true;\n        }\n    }\n\n    function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\n        return _erc2771ContextStorage().trustedForwarder[forwarder];\n    }\n\n    function _msgSender() internal view virtual returns (address sender) {\n        if (isTrustedForwarder(msg.sender)) {\n            // The assembly code is more direct than the Solidity version using `abi.decode`.\n            assembly {\n                sender := shr(96, calldataload(sub(calldatasize(), 20)))\n            }\n        } else {\n            return msg.sender;\n        }\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        if (isTrustedForwarder(msg.sender)) {\n            return msg.data[:msg.data.length - 20];\n        } else {\n            return msg.data;\n        }\n    }\n\n    /// @dev Returns the ERC2771ContextStorage storage.\n    function _erc2771ContextStorage() internal pure returns (ERC2771ContextStorage.Data storage data) {\n        data = ERC2771ContextStorage.data();\n    }\n\n    uint256[49] private __gap;\n}\n"
      },
      "contracts/extension/upgradeable/Initializable.sol": {
        "content": "// SPDX-License-Identifier: Apache 2.0\npragma solidity ^0.8.0;\n\nimport \"../../lib/Address.sol\";\n\nlibrary InitStorage {\n    /// @custom:storage-location erc7201:init.storage\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"init.storage\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 constant INIT_STORAGE_POSITION = 0x322cf19c484104d3b1a9c2982ebae869ede3fa5f6c4703ca41b9a48c76ee0300;\n\n    /// @dev Layout of the entrypoint contract's storage.\n    struct Data {\n        uint8 initialized;\n        bool initializing;\n    }\n\n    /// @dev Returns the entrypoint contract's data at the relevant storage location.\n    function data() internal pure returns (Data storage data_) {\n        bytes32 position = INIT_STORAGE_POSITION;\n        assembly {\n            data_.slot := position\n        }\n    }\n}\n\nabstract contract Initializable {\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint8 version);\n\n    /**\n     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n     */\n    modifier initializer() {\n        uint8 _initialized = _initStorage().initialized;\n        bool _initializing = _initStorage().initializing;\n\n        bool isTopLevelCall = !_initializing;\n        require(\n            (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n            \"Initializable: contract is already initialized\"\n        );\n        _initStorage().initialized = 1;\n        if (isTopLevelCall) {\n            _initStorage().initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            _initStorage().initializing = false;\n            emit Initialized(1);\n        }\n    }\n\n    /**\n     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n     * used to initialize parent contracts.\n     *\n     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n     * initialization step. This is essential to configure modules that are added through upgrades and that require\n     * initialization.\n     *\n     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n     * a contract, executing them in the right order is up to the developer or operator.\n     */\n    modifier reinitializer(uint8 version) {\n        uint8 _initialized = _initStorage().initialized;\n        bool _initializing = _initStorage().initializing;\n\n        require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n        _initStorage().initialized = version;\n        _initStorage().initializing = true;\n        _;\n        _initStorage().initializing = false;\n        emit Initialized(version);\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} and {reinitializer} modifiers, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        require(_initStorage().initializing, \"Initializable: contract is not initializing\");\n        _;\n    }\n\n    /**\n     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n     * through proxies.\n     */\n    function _disableInitializers() internal virtual {\n        uint8 _initialized = _initStorage().initialized;\n        bool _initializing = _initStorage().initializing;\n\n        require(!_initializing, \"Initializable: contract is initializing\");\n        if (_initialized < type(uint8).max) {\n            _initStorage().initialized = type(uint8).max;\n            emit Initialized(type(uint8).max);\n        }\n    }\n\n    /// @dev Returns the InitStorage storage.\n    function _initStorage() internal pure returns (InitStorage.Data storage data) {\n        data = InitStorage.data();\n    }\n}\n"
      },
      "contracts/extension/upgradeable/Permissions.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\nimport \"../interface/IPermissions.sol\";\nimport \"../../lib/Strings.sol\";\n\n/**\n *  @title   Permissions\n *  @dev     This contracts provides extending-contracts with role-based access control mechanisms\n */\n\nlibrary PermissionsStorage {\n    /// @custom:storage-location erc7201:permissions.storage\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"permissions.storage\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 public constant PERMISSIONS_STORAGE_POSITION =\n        0x0a7b0f5c59907924802379ebe98cdc23e2ee7820f63d30126e10b3752010e500;\n\n    struct Data {\n        /// @dev Map from keccak256 hash of a role => a map from address => whether address has role.\n        mapping(bytes32 => mapping(address => bool)) _hasRole;\n        /// @dev Map from keccak256 hash of a role to role admin. See {getRoleAdmin}.\n        mapping(bytes32 => bytes32) _getRoleAdmin;\n    }\n\n    function data() internal pure returns (Data storage data_) {\n        bytes32 position = PERMISSIONS_STORAGE_POSITION;\n        assembly {\n            data_.slot := position\n        }\n    }\n}\n\ncontract Permissions is IPermissions {\n    /// @dev Default admin role for all roles. Only accounts with this role can grant/revoke other roles.\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /// @dev Modifier that checks if an account has the specified role; reverts otherwise.\n    modifier onlyRole(bytes32 role) {\n        _checkRole(role, _msgSender());\n        _;\n    }\n\n    /**\n     *  @notice         Checks whether an account has a particular role.\n     *  @dev            Returns `true` if `account` has been granted `role`.\n     *\n     *  @param role     keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n     *  @param account  Address of the account for which the role is being checked.\n     */\n    function hasRole(bytes32 role, address account) public view override returns (bool) {\n        return _permissionsStorage()._hasRole[role][account];\n    }\n\n    /**\n     *  @notice         Checks whether an account has a particular role;\n     *                  role restrictions can be swtiched on and off.\n     *\n     *  @dev            Returns `true` if `account` has been granted `role`.\n     *                  Role restrictions can be swtiched on and off:\n     *                      - If address(0) has ROLE, then the ROLE restrictions\n     *                        don't apply.\n     *                      - If address(0) does not have ROLE, then the ROLE\n     *                        restrictions will apply.\n     *\n     *  @param role     keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n     *  @param account  Address of the account for which the role is being checked.\n     */\n    function hasRoleWithSwitch(bytes32 role, address account) public view returns (bool) {\n        if (!_permissionsStorage()._hasRole[role][address(0)]) {\n            return _permissionsStorage()._hasRole[role][account];\n        }\n\n        return true;\n    }\n\n    /**\n     *  @notice         Returns the admin role that controls the specified role.\n     *  @dev            See {grantRole} and {revokeRole}.\n     *                  To change a role's admin, use {_setRoleAdmin}.\n     *\n     *  @param role     keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n     */\n    function getRoleAdmin(bytes32 role) external view override returns (bytes32) {\n        return _permissionsStorage()._getRoleAdmin[role];\n    }\n\n    /**\n     *  @notice         Grants a role to an account, if not previously granted.\n     *  @dev            Caller must have admin role for the `role`.\n     *                  Emits {RoleGranted Event}.\n     *\n     *  @param role     keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n     *  @param account  Address of the account to which the role is being granted.\n     */\n    function grantRole(bytes32 role, address account) public virtual override {\n        _checkRole(_permissionsStorage()._getRoleAdmin[role], _msgSender());\n        if (_permissionsStorage()._hasRole[role][account]) {\n            revert(\"Can only grant to non holders\");\n        }\n        _setupRole(role, account);\n    }\n\n    /**\n     *  @notice         Revokes role from an account.\n     *  @dev            Caller must have admin role for the `role`.\n     *                  Emits {RoleRevoked Event}.\n     *\n     *  @param role     keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n     *  @param account  Address of the account from which the role is being revoked.\n     */\n    function revokeRole(bytes32 role, address account) public virtual override {\n        _checkRole(_permissionsStorage()._getRoleAdmin[role], _msgSender());\n        _revokeRole(role, account);\n    }\n\n    /**\n     *  @notice         Revokes role from the account.\n     *  @dev            Caller must have the `role`, with caller being the same as `account`.\n     *                  Emits {RoleRevoked Event}.\n     *\n     *  @param role     keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n     *  @param account  Address of the account from which the role is being revoked.\n     */\n    function renounceRole(bytes32 role, address account) public virtual override {\n        if (_msgSender() != account) {\n            revert(\"Can only renounce for self\");\n        }\n        _revokeRole(role, account);\n    }\n\n    /// @dev Sets `adminRole` as `role`'s admin role.\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        bytes32 previousAdminRole = _permissionsStorage()._getRoleAdmin[role];\n        _permissionsStorage()._getRoleAdmin[role] = adminRole;\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\n    }\n\n    /// @dev Sets up `role` for `account`\n    function _setupRole(bytes32 role, address account) internal virtual {\n        _permissionsStorage()._hasRole[role][account] = true;\n        emit RoleGranted(role, account, _msgSender());\n    }\n\n    /// @dev Revokes `role` from `account`\n    function _revokeRole(bytes32 role, address account) internal virtual {\n        _checkRole(role, account);\n        delete _permissionsStorage()._hasRole[role][account];\n        emit RoleRevoked(role, account, _msgSender());\n    }\n\n    /// @dev Checks `role` for `account`. Reverts with a message including the required role.\n    function _checkRole(bytes32 role, address account) internal view virtual {\n        if (!_permissionsStorage()._hasRole[role][account]) {\n            revert(\n                string(\n                    abi.encodePacked(\n                        \"Permissions: account \",\n                        Strings.toHexString(uint160(account), 20),\n                        \" is missing role \",\n                        Strings.toHexString(uint256(role), 32)\n                    )\n                )\n            );\n        }\n    }\n\n    /// @dev Checks `role` for `account`. Reverts with a message including the required role.\n    function _checkRoleWithSwitch(bytes32 role, address account) internal view virtual {\n        if (!hasRoleWithSwitch(role, account)) {\n            revert(\n                string(\n                    abi.encodePacked(\n                        \"Permissions: account \",\n                        Strings.toHexString(uint160(account), 20),\n                        \" is missing role \",\n                        Strings.toHexString(uint256(role), 32)\n                    )\n                )\n            );\n        }\n    }\n\n    function _msgSender() internal view virtual returns (address sender) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    /// @dev Returns the Permissions storage.\n    function _permissionsStorage() internal pure returns (PermissionsStorage.Data storage data) {\n        data = PermissionsStorage.data();\n    }\n}\n"
      },
      "contracts/extension/upgradeable/PermissionsEnumerable.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\nimport \"../interface/IPermissionsEnumerable.sol\";\nimport \"./Permissions.sol\";\n\n/**\n *  @title   PermissionsEnumerable\n *  @dev     This contracts provides extending-contracts with role-based access control mechanisms.\n *           Also provides interfaces to view all members with a given role, and total count of members.\n */\n\nlibrary PermissionsEnumerableStorage {\n    /// @custom:storage-location erc7201:extension.manager.storage\n    bytes32 public constant PERMISSIONS_ENUMERABLE_STORAGE_POSITION =\n        keccak256(abi.encode(uint256(keccak256(\"permissions.enumerable.storage\")) - 1)) & ~bytes32(uint256(0xff));\n\n    /**\n     *  @notice A data structure to store data of members for a given role.\n     *\n     *  @param index    Current index in the list of accounts that have a role.\n     *  @param members  map from index => address of account that has a role\n     *  @param indexOf  map from address => index which the account has.\n     */\n    struct RoleMembers {\n        uint256 index;\n        mapping(uint256 => address) members;\n        mapping(address => uint256) indexOf;\n    }\n\n    struct Data {\n        /// @dev map from keccak256 hash of a role to its members' data. See {RoleMembers}.\n        mapping(bytes32 => RoleMembers) roleMembers;\n    }\n\n    function data() internal pure returns (Data storage data_) {\n        bytes32 position = PERMISSIONS_ENUMERABLE_STORAGE_POSITION;\n        assembly {\n            data_.slot := position\n        }\n    }\n}\n\ncontract PermissionsEnumerable is IPermissionsEnumerable, Permissions {\n    /**\n     *  @notice         Returns the role-member from a list of members for a role,\n     *                  at a given index.\n     *  @dev            Returns `member` who has `role`, at `index` of role-members list.\n     *                  See struct {RoleMembers}, and mapping {roleMembers}\n     *\n     *  @param role     keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n     *  @param index    Index in list of current members for the role.\n     *\n     *  @return member  Address of account that has `role`\n     */\n    function getRoleMember(bytes32 role, uint256 index) external view override returns (address member) {\n        uint256 currentIndex = _permissionsEnumerableStorage().roleMembers[role].index;\n        uint256 check;\n\n        for (uint256 i = 0; i < currentIndex; i += 1) {\n            if (_permissionsEnumerableStorage().roleMembers[role].members[i] != address(0)) {\n                if (check == index) {\n                    member = _permissionsEnumerableStorage().roleMembers[role].members[i];\n                    return member;\n                }\n                check += 1;\n            } else if (\n                hasRole(role, address(0)) && i == _permissionsEnumerableStorage().roleMembers[role].indexOf[address(0)]\n            ) {\n                check += 1;\n            }\n        }\n    }\n\n    /**\n     *  @notice         Returns total number of accounts that have a role.\n     *  @dev            Returns `count` of accounts that have `role`.\n     *                  See struct {RoleMembers}, and mapping {roleMembers}\n     *\n     *  @param role     keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n     *\n     *  @return count   Total number of accounts that have `role`\n     */\n    function getRoleMemberCount(bytes32 role) external view override returns (uint256 count) {\n        uint256 currentIndex = _permissionsEnumerableStorage().roleMembers[role].index;\n\n        for (uint256 i = 0; i < currentIndex; i += 1) {\n            if (_permissionsEnumerableStorage().roleMembers[role].members[i] != address(0)) {\n                count += 1;\n            }\n        }\n        if (hasRole(role, address(0))) {\n            count += 1;\n        }\n    }\n\n    /// @dev Revokes `role` from `account`, and removes `account` from {roleMembers}\n    ///      See {_removeMember}\n    function _revokeRole(bytes32 role, address account) internal virtual override {\n        super._revokeRole(role, account);\n        _removeMember(role, account);\n    }\n\n    /// @dev Grants `role` to `account`, and adds `account` to {roleMembers}\n    ///      See {_addMember}\n    function _setupRole(bytes32 role, address account) internal virtual override {\n        super._setupRole(role, account);\n        _addMember(role, account);\n    }\n\n    /// @dev adds `account` to {roleMembers}, for `role`\n    function _addMember(bytes32 role, address account) internal {\n        uint256 idx = _permissionsEnumerableStorage().roleMembers[role].index;\n        _permissionsEnumerableStorage().roleMembers[role].index += 1;\n\n        _permissionsEnumerableStorage().roleMembers[role].members[idx] = account;\n        _permissionsEnumerableStorage().roleMembers[role].indexOf[account] = idx;\n    }\n\n    /// @dev removes `account` from {roleMembers}, for `role`\n    function _removeMember(bytes32 role, address account) internal {\n        uint256 idx = _permissionsEnumerableStorage().roleMembers[role].indexOf[account];\n\n        delete _permissionsEnumerableStorage().roleMembers[role].members[idx];\n        delete _permissionsEnumerableStorage().roleMembers[role].indexOf[account];\n    }\n\n    /// @dev Returns the PermissionsEnumerable storage.\n    function _permissionsEnumerableStorage() internal pure returns (PermissionsEnumerableStorage.Data storage data) {\n        data = PermissionsEnumerableStorage.data();\n    }\n}\n"
      },
      "contracts/extension/upgradeable/PlatformFee.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\nimport \"../interface/IPlatformFee.sol\";\n\n/**\n *  @author  thirdweb.com\n */\nlibrary PlatformFeeStorage {\n    /// @custom:storage-location erc7201:platform.fee.storage\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"platform.fee.storage\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 public constant PLATFORM_FEE_STORAGE_POSITION =\n        0xc0c34308b4a2f4c5ee9af8ba82541cfb3c33b076d1fd05c65f9ce7060c64c400;\n\n    struct Data {\n        /// @dev The address that receives all platform fees from all sales.\n        address platformFeeRecipient;\n        /// @dev The % of primary sales collected as platform fees.\n        uint16 platformFeeBps;\n        /// @dev Fee type variants: percentage fee and flat fee\n        IPlatformFee.PlatformFeeType platformFeeType;\n        /// @dev The flat amount collected by the contract as fees on primary sales.\n        uint256 flatPlatformFee;\n    }\n\n    function data() internal pure returns (Data storage data_) {\n        bytes32 position = PLATFORM_FEE_STORAGE_POSITION;\n        assembly {\n            data_.slot := position\n        }\n    }\n}\n\n/**\n *  @author  thirdweb.com\n *\n *  @title   Platform Fee\n *  @notice  Thirdweb's `PlatformFee` is a contract extension to be used with any base contract. It exposes functions for setting and reading\n *           the recipient of platform fee and the platform fee basis points, and lets the inheriting contract perform conditional logic\n *           that uses information about platform fees, if desired.\n */\n\nabstract contract PlatformFee is IPlatformFee {\n    /// @dev Returns the platform fee recipient and bps.\n    function getPlatformFeeInfo() public view override returns (address, uint16) {\n        return (_platformFeeStorage().platformFeeRecipient, uint16(_platformFeeStorage().platformFeeBps));\n    }\n\n    /// @dev Returns the platform fee bps and recipient.\n    function getFlatPlatformFeeInfo() public view returns (address, uint256) {\n        return (_platformFeeStorage().platformFeeRecipient, _platformFeeStorage().flatPlatformFee);\n    }\n\n    /// @dev Returns the platform fee type.\n    function getPlatformFeeType() public view returns (PlatformFeeType) {\n        return _platformFeeStorage().platformFeeType;\n    }\n\n    /**\n     *  @notice         Updates the platform fee recipient and bps.\n     *  @dev            Caller should be authorized to set platform fee info.\n     *                  See {_canSetPlatformFeeInfo}.\n     *                  Emits {PlatformFeeInfoUpdated Event}; See {_setupPlatformFeeInfo}.\n     *\n     *  @param _platformFeeRecipient   Address to be set as new platformFeeRecipient.\n     *  @param _platformFeeBps         Updated platformFeeBps.\n     */\n    function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external override {\n        if (!_canSetPlatformFeeInfo()) {\n            revert(\"Not authorized\");\n        }\n        _setupPlatformFeeInfo(_platformFeeRecipient, _platformFeeBps);\n    }\n\n    /// @dev Lets a contract admin update the platform fee recipient and bps\n    function _setupPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) internal {\n        if (_platformFeeBps > 10_000) {\n            revert(\"Exceeds max bps\");\n        }\n        if (_platformFeeRecipient == address(0)) {\n            revert(\"Invalid recipient\");\n        }\n\n        _platformFeeStorage().platformFeeBps = uint16(_platformFeeBps);\n        _platformFeeStorage().platformFeeRecipient = _platformFeeRecipient;\n\n        emit PlatformFeeInfoUpdated(_platformFeeRecipient, _platformFeeBps);\n    }\n\n    /// @notice Lets a module admin set a flat fee on primary sales.\n    function setFlatPlatformFeeInfo(address _platformFeeRecipient, uint256 _flatFee) external {\n        if (!_canSetPlatformFeeInfo()) {\n            revert(\"Not authorized\");\n        }\n\n        _setupFlatPlatformFeeInfo(_platformFeeRecipient, _flatFee);\n    }\n\n    /// @dev Sets a flat fee on primary sales.\n    function _setupFlatPlatformFeeInfo(address _platformFeeRecipient, uint256 _flatFee) internal {\n        _platformFeeStorage().flatPlatformFee = _flatFee;\n        _platformFeeStorage().platformFeeRecipient = _platformFeeRecipient;\n\n        emit FlatPlatformFeeUpdated(_platformFeeRecipient, _flatFee);\n    }\n\n    /// @notice Lets a module admin set platform fee type.\n    function setPlatformFeeType(PlatformFeeType _feeType) external {\n        if (!_canSetPlatformFeeInfo()) {\n            revert(\"Not authorized\");\n        }\n        _setupPlatformFeeType(_feeType);\n    }\n\n    /// @dev Sets platform fee type.\n    function _setupPlatformFeeType(PlatformFeeType _feeType) internal {\n        _platformFeeStorage().platformFeeType = _feeType;\n\n        emit PlatformFeeTypeUpdated(_feeType);\n    }\n\n    /// @dev Returns the PlatformFee storage.\n    function _platformFeeStorage() internal pure returns (PlatformFeeStorage.Data storage data) {\n        data = PlatformFeeStorage.data();\n    }\n\n    /// @dev Returns whether platform fee info can be set in the given execution context.\n    function _canSetPlatformFeeInfo() internal view virtual returns (bool);\n}\n"
      },
      "contracts/extension/upgradeable/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\nlibrary ReentrancyGuardStorage {\n    /// @custom:storage-location erc7201:reentrancy.guard.storage\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"reentrancy.guard.storage\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 public constant REENTRANCY_GUARD_STORAGE_POSITION =\n        0x1d281c488dae143b6ea4122e80c65059929950b9c32f17fc57be22089d9c3b00;\n\n    struct Data {\n        uint256 _status;\n    }\n\n    function data() internal pure returns (Data storage data_) {\n        bytes32 position = REENTRANCY_GUARD_STORAGE_POSITION;\n        assembly {\n            data_.slot := position\n        }\n    }\n}\n\nabstract contract ReentrancyGuard {\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    constructor() {\n        _reentrancyGuardStorage()._status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     */\n    modifier nonReentrant() {\n        // On the first call to nonReentrant, _notEntered will be true\n        require(_reentrancyGuardStorage()._status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _reentrancyGuardStorage()._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        _reentrancyGuardStorage()._status = _NOT_ENTERED;\n    }\n\n    /// @dev Returns the ReentrancyGuard storage.\n    function _reentrancyGuardStorage() internal pure returns (ReentrancyGuardStorage.Data storage data) {\n        data = ReentrancyGuardStorage.data();\n    }\n}\n"
      },
      "contracts/extension/upgradeable/RoyaltyPayments.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\nimport \"../interface/IRoyaltyPayments.sol\";\nimport \"../interface/IRoyaltyEngineV1.sol\";\nimport { IERC2981 } from \"../../eip/interface/IERC2981.sol\";\n\nlibrary RoyaltyPaymentsStorage {\n    /// @custom:storage-location erc7201:royalty.payments.storage\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"royalty.payments.storage\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 public constant ROYALTY_PAYMENTS_STORAGE_POSITION =\n        0xc802b338f3fb784853cf3c808df5ff08335200e394ea2c687d12571a91045000;\n\n    struct Data {\n        /// @dev The address of RoyaltyEngineV1, replacing the one set during construction.\n        address royaltyEngineAddressOverride;\n    }\n\n    function royaltyPaymentsStorage() internal pure returns (Data storage royaltyPaymentsData) {\n        bytes32 position = ROYALTY_PAYMENTS_STORAGE_POSITION;\n        assembly {\n            royaltyPaymentsData.slot := position\n        }\n    }\n}\n\n/**\n *  @author  thirdweb.com\n *\n *  @title   Royalty Payments\n *  @notice  Thirdweb's `RoyaltyPayments` is a contract extension to be used with a marketplace contract.\n *           It exposes functions for fetching royalty settings for a token.\n *           It Supports RoyaltyEngineV1 and RoyaltyRegistry by manifold.xyz.\n */\n\nabstract contract RoyaltyPaymentsLogic is IRoyaltyPayments {\n    // solhint-disable-next-line var-name-mixedcase\n    address immutable ROYALTY_ENGINE_ADDRESS;\n\n    constructor(address _royaltyEngineAddress) {\n        // allow address(0) in case RoyaltyEngineV1 not present on a network\n        require(\n            _royaltyEngineAddress == address(0) ||\n                IERC165(_royaltyEngineAddress).supportsInterface(type(IRoyaltyEngineV1).interfaceId),\n            \"Doesn't support IRoyaltyEngineV1 interface\"\n        );\n\n        ROYALTY_ENGINE_ADDRESS = _royaltyEngineAddress;\n    }\n\n    /**\n     * Get the royalty for a given token (address, id) and value amount.  Does not cache the bps/amounts.  Caches the spec for a given token address\n     *\n     * @param tokenAddress - The address of the token\n     * @param tokenId      - The id of the token\n     * @param value        - The value you wish to get the royalty of\n     *\n     * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get\n     */\n    function getRoyalty(\n        address tokenAddress,\n        uint256 tokenId,\n        uint256 value\n    ) external returns (address payable[] memory recipients, uint256[] memory amounts) {\n        address royaltyEngineAddress = getRoyaltyEngineAddress();\n\n        if (royaltyEngineAddress == address(0)) {\n            try IERC2981(tokenAddress).royaltyInfo(tokenId, value) returns (address recipient, uint256 amount) {\n                require(amount <= value, \"Invalid royalty amount\");\n\n                recipients = new address payable[](1);\n                amounts = new uint256[](1);\n                recipients[0] = payable(recipient);\n                amounts[0] = amount;\n            } catch {}\n        } else {\n            (recipients, amounts) = IRoyaltyEngineV1(royaltyEngineAddress).getRoyalty(tokenAddress, tokenId, value);\n        }\n    }\n\n    /**\n     * Set or override RoyaltyEngine address\n     *\n     * @param _royaltyEngineAddress - RoyaltyEngineV1 address\n     */\n    function setRoyaltyEngine(address _royaltyEngineAddress) external {\n        if (!_canSetRoyaltyEngine()) {\n            revert(\"Not authorized\");\n        }\n\n        require(\n            _royaltyEngineAddress != address(0) &&\n                IERC165(_royaltyEngineAddress).supportsInterface(type(IRoyaltyEngineV1).interfaceId),\n            \"Doesn't support IRoyaltyEngineV1 interface\"\n        );\n\n        _setupRoyaltyEngine(_royaltyEngineAddress);\n    }\n\n    /// @dev Returns original or overridden address for RoyaltyEngineV1\n    function getRoyaltyEngineAddress() public view returns (address royaltyEngineAddress) {\n        RoyaltyPaymentsStorage.Data storage data = RoyaltyPaymentsStorage.royaltyPaymentsStorage();\n        address royaltyEngineOverride = data.royaltyEngineAddressOverride;\n        royaltyEngineAddress = royaltyEngineOverride != address(0) ? royaltyEngineOverride : ROYALTY_ENGINE_ADDRESS;\n    }\n\n    /// @dev Lets a contract admin update the royalty engine address\n    function _setupRoyaltyEngine(address _royaltyEngineAddress) internal {\n        RoyaltyPaymentsStorage.Data storage data = RoyaltyPaymentsStorage.royaltyPaymentsStorage();\n        address currentAddress = data.royaltyEngineAddressOverride;\n\n        data.royaltyEngineAddressOverride = _royaltyEngineAddress;\n\n        emit RoyaltyEngineUpdated(currentAddress, _royaltyEngineAddress);\n    }\n\n    /// @dev Returns whether royalty engine address can be set in the given execution context.\n    function _canSetRoyaltyEngine() internal view virtual returns (bool);\n}\n"
      },
      "contracts/extension/upgradeable/init/ReentrancyGuardInit.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport { ReentrancyGuardStorage } from \"../ReentrancyGuard.sol\";\nimport \"../Initializable.sol\";\n\ncontract ReentrancyGuardInit is Initializable {\n    uint256 private constant _NOT_ENTERED = 1;\n\n    function __ReentrancyGuard_init() internal onlyInitializing {\n        __ReentrancyGuard_init_unchained();\n    }\n\n    function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n        ReentrancyGuardStorage.Data storage data = ReentrancyGuardStorage.data();\n        data._status = _NOT_ENTERED;\n    }\n}\n"
      },
      "contracts/lib/Address.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.1;\n\n/// @author thirdweb, OpenZeppelin Contracts (v4.9.0)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\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     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, \"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(address target, bytes memory data, uint256 value) 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        (bool success, bytes memory returndata) = target.call{ value: value }(data);\n        return verifyCallResultFromTarget(target, 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        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or 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            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\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"
      },
      "contracts/lib/Strings.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\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    /// @dev Returns the hexadecimal representation of `value`.\n    /// The output is prefixed with \"0x\", encoded using 2 hexadecimal digits per byte,\n    /// and the alphabets are capitalized conditionally according to\n    /// https://eips.ethereum.org/EIPS/eip-55\n    function toHexStringChecksummed(address value) internal pure returns (string memory str) {\n        str = toHexString(value);\n        /// @solidity memory-safe-assembly\n        assembly {\n            let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...`\n            let o := add(str, 0x22)\n            let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... `\n            let t := shl(240, 136) // `0b10001000 << 240`\n            for {\n                let i := 0\n            } 1 {\n\n            } {\n                mstore(add(i, i), mul(t, byte(i, hashed)))\n                i := add(i, 1)\n                if eq(i, 20) {\n                    break\n                }\n            }\n            mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask)))))\n            o := add(o, 0x20)\n            mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask)))))\n        }\n    }\n\n    /// @dev Returns the hexadecimal representation of `value`.\n    /// The output is prefixed with \"0x\" and encoded using 2 hexadecimal digits per byte.\n    function toHexString(address value) internal pure returns (string memory str) {\n        str = toHexStringNoPrefix(value);\n        /// @solidity memory-safe-assembly\n        assembly {\n            let strLength := add(mload(str), 2) // Compute the length.\n            mstore(str, 0x3078) // Write the \"0x\" prefix.\n            str := sub(str, 2) // Move the pointer.\n            mstore(str, strLength) // Write the length.\n        }\n    }\n\n    /// @dev Returns the hexadecimal representation of `value`.\n    /// The output is encoded using 2 hexadecimal digits per byte.\n    function toHexStringNoPrefix(address value) internal pure returns (string memory str) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            str := mload(0x40)\n\n            // Allocate the memory.\n            // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,\n            // 0x02 bytes for the prefix, and 0x28 bytes for the digits.\n            // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80.\n            mstore(0x40, add(str, 0x80))\n\n            // Store \"0123456789abcdef\" in scratch space.\n            mstore(0x0f, 0x30313233343536373839616263646566)\n\n            str := add(str, 2)\n            mstore(str, 40)\n\n            let o := add(str, 0x20)\n            mstore(add(o, 40), 0)\n\n            value := shl(96, value)\n\n            // We write the string from rightmost digit to leftmost digit.\n            // The following is essentially a do-while loop that also handles the zero case.\n            for {\n                let i := 0\n            } 1 {\n\n            } {\n                let p := add(o, add(i, i))\n                let temp := byte(i, value)\n                mstore8(add(p, 1), mload(and(temp, 15)))\n                mstore8(p, mload(shr(4, temp)))\n                i := add(i, 1)\n                if eq(i, 20) {\n                    break\n                }\n            }\n        }\n    }\n\n    /// @dev Returns the hex encoded string from the raw bytes.\n    /// The output is encoded using 2 hexadecimal digits per byte.\n    function toHexString(bytes memory raw) internal pure returns (string memory str) {\n        str = toHexStringNoPrefix(raw);\n        /// @solidity memory-safe-assembly\n        assembly {\n            let strLength := add(mload(str), 2) // Compute the length.\n            mstore(str, 0x3078) // Write the \"0x\" prefix.\n            str := sub(str, 2) // Move the pointer.\n            mstore(str, strLength) // Write the length.\n        }\n    }\n\n    /// @dev Returns the hex encoded string from the raw bytes.\n    /// The output is encoded using 2 hexadecimal digits per byte.\n    function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let length := mload(raw)\n            str := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix.\n            mstore(str, add(length, length)) // Store the length of the output.\n\n            // Store \"0123456789abcdef\" in scratch space.\n            mstore(0x0f, 0x30313233343536373839616263646566)\n\n            let o := add(str, 0x20)\n            let end := add(raw, length)\n\n            for {\n\n            } iszero(eq(raw, end)) {\n\n            } {\n                raw := add(raw, 1)\n                mstore8(add(o, 1), mload(and(mload(raw), 15)))\n                mstore8(o, mload(and(shr(4, mload(raw)), 15)))\n                o := add(o, 2)\n            }\n            mstore(o, 0) // Zeroize the slot after the string.\n            mstore(0x40, add(o, 0x20)) // Allocate the memory.\n        }\n    }\n}\n"
      },
      "contracts/prebuilts/marketplace/entrypoint/MarketplaceV3.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @author thirdweb\n\n//   $$\\     $$\\       $$\\                 $$\\                         $$\\\n//   $$ |    $$ |      \\__|                $$ |                        $$ |\n// $$$$$$\\   $$$$$$$\\  $$\\  $$$$$$\\   $$$$$$$ |$$\\  $$\\  $$\\  $$$$$$\\  $$$$$$$\\\n// \\_$$  _|  $$  __$$\\ $$ |$$  __$$\\ $$  __$$ |$$ | $$ | $$ |$$  __$$\\ $$  __$$\\\n//   $$ |    $$ |  $$ |$$ |$$ |  \\__|$$ /  $$ |$$ | $$ | $$ |$$$$$$$$ |$$ |  $$ |\n//   $$ |$$\\ $$ |  $$ |$$ |$$ |      $$ |  $$ |$$ | $$ | $$ |$$   ____|$$ |  $$ |\n//   \\$$$$  |$$ |  $$ |$$ |$$ |      \\$$$$$$$ |\\$$$$$\\$$$$  |\\$$$$$$$\\ $$$$$$$  |\n//    \\____/ \\__|  \\__|\\__|\\__|       \\_______| \\_____\\____/  \\_______|\\_______/\n\n// ====== External imports ======\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\n\nimport { ERC721Holder } from \"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\";\nimport { ERC1155Holder, ERC1155Receiver } from \"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\";\n\n//  ==========  Internal imports    ==========\nimport { BaseRouter, IRouter, IRouterState } from \"@thirdweb-dev/dynamic-contracts/src/presets/BaseRouter.sol\";\nimport { ERC165 } from \"../../../eip/ERC165.sol\";\n\nimport \"../../../extension/Multicall.sol\";\nimport \"../../../extension/upgradeable/Initializable.sol\";\nimport \"../../../extension/upgradeable/ContractMetadata.sol\";\nimport \"../../../extension/upgradeable/PlatformFee.sol\";\nimport \"../../../extension/upgradeable/PermissionsEnumerable.sol\";\nimport \"../../../extension/upgradeable/init/ReentrancyGuardInit.sol\";\nimport \"../../../extension/upgradeable/ERC2771ContextUpgradeable.sol\";\nimport { RoyaltyPaymentsLogic } from \"../../../extension/upgradeable/RoyaltyPayments.sol\";\n\n/**\n * @author  thirdweb.com\n */\ncontract MarketplaceV3 is\n    Initializable,\n    Multicall,\n    BaseRouter,\n    ContractMetadata,\n    PlatformFee,\n    PermissionsEnumerable,\n    ReentrancyGuardInit,\n    ERC2771ContextUpgradeable,\n    RoyaltyPaymentsLogic,\n    ERC721Holder,\n    ERC1155Holder,\n    ERC165\n{\n    /// @dev Only EXTENSION_ROLE holders can perform upgrades.\n    bytes32 private constant EXTENSION_ROLE = keccak256(\"EXTENSION_ROLE\");\n\n    bytes32 private constant MODULE_TYPE = bytes32(\"MarketplaceV3\");\n    uint256 private constant VERSION = 3;\n\n    /// @dev The address of the native token wrapper contract.\n    address private immutable nativeTokenWrapper;\n\n    /*///////////////////////////////////////////////////////////////\n                    Constructor + initializer logic\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev We accept constructor params as a struct to avoid `Stack too deep` errors.\n    struct MarketplaceConstructorParams {\n        Extension[] extensions;\n        address royaltyEngineAddress;\n        address nativeTokenWrapper;\n    }\n\n    constructor(\n        MarketplaceConstructorParams memory _marketplaceV3Params\n    ) BaseRouter(_marketplaceV3Params.extensions) RoyaltyPaymentsLogic(_marketplaceV3Params.royaltyEngineAddress) {\n        nativeTokenWrapper = _marketplaceV3Params.nativeTokenWrapper;\n        _disableInitializers();\n    }\n\n    receive() external payable {\n        assert(msg.sender == nativeTokenWrapper); // only accept ETH via fallback from the native token wrapper contract\n    }\n\n    /// @dev Initializes the contract, like a constructor.\n    function initialize(\n        address _defaultAdmin,\n        string memory _contractURI,\n        address[] memory _trustedForwarders,\n        address _platformFeeRecipient,\n        uint16 _platformFeeBps\n    ) external initializer {\n        // Initialize BaseRouter\n        __BaseRouter_init();\n\n        // Initialize inherited contracts, most base-like -> most derived.\n        __ReentrancyGuard_init();\n        __ERC2771Context_init(_trustedForwarders);\n\n        // Initialize this contract's state.\n        _setupContractURI(_contractURI);\n        _setupPlatformFeeInfo(_platformFeeRecipient, _platformFeeBps);\n\n        _setupRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\n        _setupRole(EXTENSION_ROLE, _defaultAdmin);\n        _setupRole(keccak256(\"LISTER_ROLE\"), address(0));\n        _setupRole(keccak256(\"ASSET_ROLE\"), address(0));\n\n        _setupRole(EXTENSION_ROLE, _defaultAdmin);\n        _setRoleAdmin(EXTENSION_ROLE, EXTENSION_ROLE);\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                        Generic contract logic\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev Returns the type of the contract.\n    function contractType() external pure returns (bytes32) {\n        return MODULE_TYPE;\n    }\n\n    /// @dev Returns the version of the contract.\n    function contractVersion() external pure returns (uint8) {\n        return uint8(VERSION);\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                        ERC 165 / 721 / 1155 logic\n    //////////////////////////////////////////////////////////////*/\n\n    function supportsInterface(\n        bytes4 interfaceId\n    ) public view virtual override(ERC165, IERC165, ERC1155Receiver) returns (bool) {\n        return\n            interfaceId == type(IERC1155Receiver).interfaceId ||\n            interfaceId == type(IERC721Receiver).interfaceId ||\n            interfaceId == type(IRouter).interfaceId ||\n            interfaceId == type(IRouterState).interfaceId ||\n            super.supportsInterface(interfaceId);\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                        Overridable Permissions\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev Checks whether platform fee info can be set in the given execution context.\n    function _canSetPlatformFeeInfo() internal view override returns (bool) {\n        return _hasRole(DEFAULT_ADMIN_ROLE, _msgSender());\n    }\n\n    /// @dev Checks whether contract metadata can be set in the given execution context.\n    function _canSetContractURI() internal view override returns (bool) {\n        return _hasRole(DEFAULT_ADMIN_ROLE, _msgSender());\n    }\n\n    /// @dev Returns whether royalty engine address can be set in the given execution context.\n    function _canSetRoyaltyEngine() internal view override returns (bool) {\n        return _hasRole(DEFAULT_ADMIN_ROLE, _msgSender());\n    }\n\n    /// @dev Checks whether an account has a particular role.\n    function _hasRole(bytes32 _role, address _account) internal view returns (bool) {\n        PermissionsStorage.Data storage data = PermissionsStorage.data();\n        return data._hasRole[_role][_account];\n    }\n\n    /// @dev Returns whether all relevant permission and other checks are met before any upgrade.\n    function _isAuthorizedCallToUpgrade() internal view virtual override returns (bool) {\n        return _hasRole(EXTENSION_ROLE, msg.sender);\n    }\n\n    function _msgSender()\n        internal\n        view\n        override(ERC2771ContextUpgradeable, Permissions, Multicall)\n        returns (address sender)\n    {\n        return ERC2771ContextUpgradeable._msgSender();\n    }\n\n    function _msgData() internal view override(ERC2771ContextUpgradeable, Permissions) returns (bytes calldata) {\n        return ERC2771ContextUpgradeable._msgData();\n    }\n}\n"
      },
      "lib/dynamic-contracts/lib/sstore2/contracts/SSTORE2.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./utils/Bytecode.sol\";\n\n/**\n  @title A key-value storage with auto-generated keys for storing chunks of data with a lower write & read cost.\n  @author Agustin Aguilar <aa@horizon.io>\n\n  Readme: https://github.com/0xsequence/sstore2#readme\n*/\nlibrary SSTORE2 {\n  error WriteError();\n\n  /**\n    @notice Stores `_data` and returns `pointer` as key for later retrieval\n    @dev The pointer is a contract address with `_data` as code\n    @param _data to be written\n    @return pointer Pointer to the written `_data`\n  */\n  function write(bytes memory _data) internal returns (address pointer) {\n    // Append 00 to _data so contract can't be called\n    // Build init code\n    bytes memory code = Bytecode.creationCodeFor(\n      abi.encodePacked(\n        hex'00',\n        _data\n      )\n    );\n\n    // Deploy contract using create\n    assembly { pointer := create(0, add(code, 32), mload(code)) }\n\n    // Address MUST be non-zero\n    if (pointer == address(0)) revert WriteError();\n  }\n\n  /**\n    @notice Reads the contents of the `_pointer` code as data, skips the first byte \n    @dev The function is intended for reading pointers generated by `write`\n    @param _pointer to be read\n    @return data read from `_pointer` contract\n  */\n  function read(address _pointer) internal view returns (bytes memory) {\n    return Bytecode.codeAt(_pointer, 1, type(uint256).max);\n  }\n\n  /**\n    @notice Reads the contents of the `_pointer` code as data, skips the first byte \n    @dev The function is intended for reading pointers generated by `write`\n    @param _pointer to be read\n    @param _start number of bytes to skip\n    @return data read from `_pointer` contract\n  */\n  function read(address _pointer, uint256 _start) internal view returns (bytes memory) {\n    return Bytecode.codeAt(_pointer, _start + 1, type(uint256).max);\n  }\n\n  /**\n    @notice Reads the contents of the `_pointer` code as data, skips the first byte \n    @dev The function is intended for reading pointers generated by `write`\n    @param _pointer to be read\n    @param _start number of bytes to skip\n    @param _end index before which to end extraction\n    @return data read from `_pointer` contract\n  */\n  function read(address _pointer, uint256 _start, uint256 _end) internal view returns (bytes memory) {\n    return Bytecode.codeAt(_pointer, _start + 1, _end + 1);\n  }\n}\n"
      },
      "lib/dynamic-contracts/lib/sstore2/contracts/utils/Bytecode.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n\nlibrary Bytecode {\n  error InvalidCodeAtRange(uint256 _size, uint256 _start, uint256 _end);\n\n  /**\n    @notice Generate a creation code that results on a contract with `_code` as bytecode\n    @param _code The returning value of the resulting `creationCode`\n    @return creationCode (constructor) for new contract\n  */\n  function creationCodeFor(bytes memory _code) internal pure returns (bytes memory) {\n    /*\n      0x00    0x63         0x63XXXXXX  PUSH4 _code.length  size\n      0x01    0x80         0x80        DUP1                size size\n      0x02    0x60         0x600e      PUSH1 14            14 size size\n      0x03    0x60         0x6000      PUSH1 00            0 14 size size\n      0x04    0x39         0x39        CODECOPY            size\n      0x05    0x60         0x6000      PUSH1 00            0 size\n      0x06    0xf3         0xf3        RETURN\n      <CODE>\n    */\n\n    return abi.encodePacked(\n      hex\"63\",\n      uint32(_code.length),\n      hex\"80_60_0E_60_00_39_60_00_F3\",\n      _code\n    );\n  }\n\n  /**\n    @notice Returns the size of the code on a given address\n    @param _addr Address that may or may not contain code\n    @return size of the code on the given `_addr`\n  */\n  function codeSize(address _addr) internal view returns (uint256 size) {\n    assembly { size := extcodesize(_addr) }\n  }\n\n  /**\n    @notice Returns the code of a given address\n    @dev It will fail if `_end < _start`\n    @param _addr Address that may or may not contain code\n    @param _start number of bytes of code to skip on read\n    @param _end index before which to end extraction\n    @return oCode read from `_addr` deployed bytecode\n\n    Forked from: https://gist.github.com/KardanovIR/fe98661df9338c842b4a30306d507fbd\n  */\n  function codeAt(address _addr, uint256 _start, uint256 _end) internal view returns (bytes memory oCode) {\n    uint256 csize = codeSize(_addr);\n    if (csize == 0) return bytes(\"\");\n\n    if (_start > csize) return bytes(\"\");\n    if (_end < _start) revert InvalidCodeAtRange(csize, _start, _end); \n\n    unchecked {\n      uint256 reqSize = _end - _start;\n      uint256 maxSize = csize - _start;\n\n      uint256 size = maxSize < reqSize ? maxSize : reqSize;\n\n      assembly {\n        // allocate output byte array - this could also be done without assembly\n        // by using o_code = new bytes(size)\n        oCode := mload(0x40)\n        // new \"memory end\" including padding\n        mstore(0x40, add(oCode, and(add(add(size, 0x20), 0x1f), not(0x1f))))\n        // store length in memory\n        mstore(oCode, size)\n        // actually retrieve the code, this needs assembly\n        extcodecopy(_addr, add(oCode, 0x20), _start, size)\n      }\n    }\n  }\n}\n"
      },
      "lib/dynamic-contracts/src/core/Router.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../interface/IRouter.sol\";\n\n/// @title ERC-7504 Dynamic Contracts: Router.\n/// @author thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)\n/// @notice Routes an incoming call to an appropriate implementation address.\n\nabstract contract Router is IRouter {\n\n    /**\n\t *\t@notice delegateCalls the appropriate implementation address for the given incoming function call.\n\t *\t@dev The implementation address to delegateCall MUST be retrieved from calling `getImplementationForFunction` with the\n     *       incoming call's function selector.\n\t */\n    fallback() external payable virtual {\n        if(msg.data.length == 0) return;\n        \n        address implementation = getImplementationForFunction(msg.sig);\n        require(implementation != address(0), \"Router: function does not exist.\");\n        _delegate(implementation);\n    }\n\n    /// @dev delegateCalls an `implementation` smart contract.\n    function _delegate(address implementation) internal virtual {\n        assembly {\n            // Copy msg.data. We take full control of memory in this inline assembly\n            // block because it will not return to Solidity code. We overwrite the\n            // Solidity scratch pad at memory position 0.\n            calldatacopy(0, 0, calldatasize())\n\n            // Call the implementation.\n            // out and outsize are 0 because we don't know the size yet.\n            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n            // Copy the returned data.\n            returndatacopy(0, 0, returndatasize())\n\n            switch result\n            // delegatecall returns 0 on error.\n            case 0 {\n                revert(0, returndatasize())\n            }\n            default {\n                return(0, returndatasize())\n            }\n        }\n    }\n\n    /**\n\t *\t@notice Returns the implementation address to delegateCall for the given function selector.\n\t *\t@param _functionSelector The function selector to get the implementation address for.\n\t *\t@return implementation The implementation address to delegateCall for the given function selector.\n\t */\n    function getImplementationForFunction(bytes4 _functionSelector) public view virtual returns (address implementation);\n}"
      },
      "lib/dynamic-contracts/src/interface/IExtension.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n\n/// @title IExtension\n/// @author thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)\n/// @notice Provides an `Extension` abstraction for a router's implementation contracts.\n\ninterface IExtension {\n    /*///////////////////////////////////////////////////////////////\n                                Structs\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     *  @notice An interface to describe an extension's metadata.\n     *\n     *  @param name             The unique name of the extension.\n     *  @param metadataURI      The URI where the metadata for the extension lives.\n     *  @param implementation   The implementation smart contract address of the extension.\n     */\n    struct ExtensionMetadata {\n        string name;\n        string metadataURI;\n        address implementation;\n    }\n\n    /**\n     *  @notice An interface to describe an extension's function.\n     *\n     *  @param functionSelector    The 4 byte selector of the function.\n     *  @param functionSignature   Function signature as a string. E.g. \"transfer(address,address,uint256)\"\n     */\n    struct ExtensionFunction {\n        bytes4 functionSelector;\n        string functionSignature;\n    }\n\n    /**\n     *  @notice An interface to describe an extension.\n     *\n     *  @param metadata     The extension's metadata; it's name, metadata URI and implementation contract address.\n     *  @param functions    The functions that belong to the extension.\n     */\n    struct Extension {\n        ExtensionMetadata metadata;\n        ExtensionFunction[] functions;\n    }\n}\n"
      },
      "lib/dynamic-contracts/src/interface/IExtensionManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./IExtension.sol\";\n\n/// @title IExtensionManager\n/// @author thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)\n/// @notice Defined storage and API for managing a router's extensions.\n\ninterface IExtensionManager is IExtension {\n\n    /*///////////////////////////////////////////////////////////////\n                                Events\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev Emitted when a extension is added.\n    event ExtensionAdded(string indexed name, address indexed implementation, Extension extension);\n\n    /// @dev Emitted when a extension is replaced.\n    event ExtensionReplaced(string indexed name, address indexed implementation, Extension extension);\n\n    /// @dev Emitted when a extension is removed.\n    event ExtensionRemoved(string indexed name, Extension extension);\n\n    /// @dev Emitted when a function is enabled i.e. made callable.\n    event FunctionEnabled(string indexed name, bytes4 indexed functionSelector, ExtensionFunction extFunction, ExtensionMetadata extMetadata);\n\n    /// @dev Emitted when a function is disabled i.e. made un-callable.\n    event FunctionDisabled(string indexed name, bytes4 indexed functionSelector, ExtensionMetadata extMetadata);\n\n    /*///////////////////////////////////////////////////////////////\n                            External functions\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     *  @notice Add a new extension to the router.\n     *  @param extension The extension to add.\n     */\n    function addExtension(Extension memory extension) external;\n\n    /**\n     *  @notice Fully replace an existing extension of the router.\n     *  @dev The extension with name `extension.name` is the extension being replaced.\n     *  @param extension The extension to replace or overwrite.\n     */\n    function replaceExtension(Extension memory extension) external;\n\n    /**\n     *  @notice Remove an existing extension from the router.\n     *  @param extensionName The name of the extension to remove.\n     */\n    function removeExtension(string memory extensionName) external;\n\n    /**\n     *  @notice Enables a single function in an existing extension.\n     *  @dev Makes the given function callable on the router.\n     *\n     *  @param extensionName The name of the extension to which `extFunction` belongs.\n     *  @param extFunction The function to enable.\n     */\n    function enableFunctionInExtension(string memory extensionName, ExtensionFunction memory extFunction) external;\n    \n    /**\n     *  @notice Disables a single function in an Extension.\n     *\n     *  @param extensionName The name of the extension to which the function of `functionSelector` belongs.\n     *  @param functionSelector The function to disable.\n     */\n    function disableFunctionInExtension(string memory extensionName, bytes4 functionSelector) external;\n}"
      },
      "lib/dynamic-contracts/src/interface/IRouter.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title ERC-7504 Dynamic Contracts: IRouter.\n/// @author thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)\n/// @notice Routes an incoming call to an appropriate implementation address.\n/// @dev Fallback function delegateCalls `getImplementationForFunction(msg.sig)` for a given incoming call.\n/// NOTE: The ERC-165 identifier for this interface is 0xce0b6013.\n\ninterface IRouter {\n\n\t/**\n\t *\t@notice delegateCalls the appropriate implementation address for the given incoming function call.\n\t *\t@dev The implementation address to delegateCall MUST be retrieved from calling `getImplementationForFunction` with the\n     *       incoming call's function selector.\n\t */\n\tfallback() external payable;\n\n\t/*///////////////////////////////////////////////////////////////\n                            View Functions\n    //////////////////////////////////////////////////////////////*/\n\n\t/**\n\t *\t@notice Returns the implementation address to delegateCall for the given function selector.\n\t *\t@param _functionSelector The function selector to get the implementation address for.\n\t *\t@return implementation The implementation address to delegateCall for the given function selector.\n\t */\n    function getImplementationForFunction(bytes4 _functionSelector) external view returns (address implementation);\n}"
      },
      "lib/dynamic-contracts/src/interface/IRouterState.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./IExtension.sol\";\n\n/// @title ERC-7504 Dynamic Contracts: IRouterState.\n/// @author thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)\n/// @notice Defines an API to expose a router's extensions.\n\ninterface IRouterState is IExtension {\n\n    /*///////////////////////////////////////////////////////////////\n                            View Functions\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     *  @notice Returns all extensions of the Router.\n     *  @return allExtensions An array of all extensions.\n     */\n    function getAllExtensions() external view returns (Extension[] memory allExtensions);\n}"
      },
      "lib/dynamic-contracts/src/interface/IRouterStateGetters.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./IExtension.sol\";\n\n/// @title IRouterStateGetters.\n/// @author thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)\n/// @notice Helper view functions to inspect a router's state.\n\ninterface IRouterStateGetters is IExtension {\n\n    /*///////////////////////////////////////////////////////////////\n                            View functions\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     *  @notice Returns the extension metadata for a given function.\n     *  @param functionSelector The function selector to get the extension metadata for.\n     *  @return metadata The extension metadata for a given function.\n     */\n    function getMetadataForFunction(bytes4 functionSelector) external view returns (ExtensionMetadata memory metadata);\n\n    /**\n     *  @notice Returns the extension metadata and functions for a given extension.\n     *  @param extensionName The name of the extension to get the metadata and functions for.\n     *  @return extension The extension metadata and functions for a given extension.\n     */\n    function getExtension(string memory extensionName) external view returns (Extension memory);\n}"
      },
      "lib/dynamic-contracts/src/lib/BaseRouterStorage.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title BaseRouterStorage\n/// @author thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)\n/// @notice Defined storage for base router\n\nlibrary BaseRouterStorage {\n\n    /// @custom:storage-location erc7201:base.router.storage\n    bytes32 public constant BASE_ROUTER_STORAGE_POSITION = keccak256(abi.encode(uint256(keccak256(\"base.router.storage\")) - 1));\n\n    struct Data {\n        /// @dev Mapping used only for checking default extension validity in constructor.\n        mapping(bytes4 => bool) functionMap;\n        /// @dev Mapping used only for checking default extension validity in constructor.\n        mapping(string => bool) extensionMap;\n    }\n\n    /// @dev Returns access to base router storage.\n    function data() internal pure returns (Data storage data_) {\n        bytes32 position = BASE_ROUTER_STORAGE_POSITION;\n        assembly {\n            data_.slot := position\n        }\n    }\n}"
      },
      "lib/dynamic-contracts/src/lib/ExtensionManagerStorage.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./StringSet.sol\";\nimport \"../interface/IExtension.sol\";\n\n/// @title IExtensionManagerStorage\n/// @author thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)\n/// @notice Defined storage for managing a router's extensions.\n\nlibrary ExtensionManagerStorage {\n\n    /// @custom:storage-location erc7201:extension.manager.storage\n    bytes32 public constant EXTENSION_MANAGER_STORAGE_POSITION = keccak256(abi.encode(uint256(keccak256(\"extension.manager.storage\")) - 1));\n\n    struct Data {\n        /// @dev Set of names of all extensions of the router.\n        StringSet.Set extensionNames;\n        /// @dev Mapping from extension name => `Extension` i.e. extension metadata and functions.\n        mapping(string => IExtension.Extension) extensions;\n        /// @dev Mapping from function selector => metadata of the extension the function belongs to.\n        mapping(bytes4 => IExtension.ExtensionMetadata) extensionMetadata;\n    }\n\n    /// @dev Returns access to the extension manager's storage.\n    function data() internal pure returns (Data storage data_) {\n        bytes32 position = EXTENSION_MANAGER_STORAGE_POSITION;\n        assembly {\n            data_.slot := position\n        }\n    }\n}"
      },
      "lib/dynamic-contracts/src/lib/StringSet.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary StringSet {\n    struct Set {\n        // Storage of set values\n        string[] _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(string => 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, string memory 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, string memory 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                string memory 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, string memory 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 (string memory) {\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 (string[] memory) {\n        return set._values;\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, string memory value) internal returns (bool) {\n        return _add(set, 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(Set storage set, string memory value) internal returns (bool) {\n        return _remove(set, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Set storage set, string memory value) internal view returns (bool) {\n        return _contains(set, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Set storage set) internal view returns (uint256) {\n        return _length(set);\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) internal view returns (string memory) {\n        return _at(set, 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) internal view returns (string[] memory) {\n        return _values(set);\n    }\n}"
      },
      "lib/dynamic-contracts/src/presets/BaseRouter.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport { Router, IRouter } from \"../core/Router.sol\";\nimport { IRouterState } from \"../interface/IRouterState.sol\";\nimport { IRouterStateGetters } from \"../interface/IRouterStateGetters.sol\";\nimport { BaseRouterStorage } from \"../lib/BaseRouterStorage.sol\";\nimport { ExtensionManager } from \"./ExtensionManager.sol\";\nimport { StringSet } from \"../lib/StringSet.sol\";\nimport \"lib/sstore2/contracts/SSTORE2.sol\";\n\n/// @title BaseRouter\n/// @author thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)\n/// @notice A router with an API to manage its extensions.\n\nabstract contract BaseRouter is Router, ExtensionManager {\n\n    using StringSet for StringSet.Set;\n\n    /// @notice The address where the router's default extension set is stored.\n    address public immutable defaultExtensions;\n    \n    /// @notice Initialize the Router with a set of default extensions.\n    constructor(Extension[] memory _extensions) {\n        address pointer;\n        if(_extensions.length > 0) {\n            _validateExtensions(_extensions);\n            pointer = SSTORE2.write(abi.encode(_extensions));\n        }\n\n        defaultExtensions = pointer;\n    }\n\n    /// @notice Initialize the Router with a set of default extensions.\n    function __BaseRouter_init() internal {\n        if(defaultExtensions == address(0)) {\n            return;\n        }\n        \n        bytes memory data = SSTORE2.read(defaultExtensions);\n        Extension[] memory defaults = abi.decode(data, (Extension[]));\n\n        // Unchecked since we already validated extensions in constructor.\n        __BaseRouter_init_unchecked(defaults);\n    }\n\n    /// @notice Initializes the Router with a set of extensions.\n    function __BaseRouter_init_checked(Extension[] memory _extensions) internal {\n        _validateExtensions(_extensions);\n        __BaseRouter_init_unchecked(_extensions);\n    }\n\n    /// @notice Initializes the Router with a set of extensions.\n    function __BaseRouter_init_unchecked(Extension[] memory _extensions) internal {\n        for(uint256 i = 0; i < _extensions.length; i += 1) {\n\n            Extension memory extension = _extensions[i];\n            // Store: new extension name.\n            _extensionManagerStorage().extensionNames.add(extension.metadata.name);\n\n            // 1. Store: metadata for extension.\n            _setMetadataForExtension(extension.metadata.name, extension.metadata);\n\n            uint256 len = extension.functions.length;\n            for (uint256 j = 0; j < len; j += 1) {                \n                // 2. Store: name -> extension.functions map\n                _extensionManagerStorage().extensions[extension.metadata.name].functions.push(extension.functions[j]);\n                // 3. Store: metadata for function.\n                _setMetadataForFunction(extension.functions[j].functionSelector, extension.metadata);\n            }\n\n            emit ExtensionAdded(extension.metadata.name, extension.metadata.implementation, extension);\n        }\n    }\n\n    /// @notice Returns the implementation contract address for a given function signature.\n    function getImplementationForFunction(bytes4 _functionSelector) public view virtual override returns (address) {\n        return getMetadataForFunction(_functionSelector).implementation;\n    }\n\n    /// @dev Validates default extensions.\n    function _validateExtensions(Extension[] memory _extensions) internal {  \n        uint256 len = _extensions.length;\n\n        bool isValid = true;\n\n        for (uint256 i = 0; i < len; i += 1) {\n            isValid = _isValidExtension(_extensions[i]);\n            if(!isValid) {\n                break;\n            }\n        }\n        require(isValid, \"BaseRouter: invalid extension.\");\n    }\n\n    function _isValidExtension(Extension memory _extension) internal returns (bool isValid) {\n        isValid  = bytes(_extension.metadata.name).length > 0 // non-empty name\n            && !BaseRouterStorage.data().extensionMap[_extension.metadata.name] // unused name\n            && _extension.metadata.implementation != address(0); // non-empty implementation\n        \n        BaseRouterStorage.data().extensionMap[_extension.metadata.name] = true;\n\n        if(!isValid) {\n            return false;\n        }\n        \n        uint256 len = _extension.functions.length;\n\n        for(uint256 i = 0; i < len; i += 1) {\n\n            if(!isValid) {\n                break;\n            }\n\n            ExtensionFunction memory _extFunction = _extension.functions[i];\n\n            /**\n            *  Note: `bytes4(0)` is the function selector for the `receive` function.\n            *        So, we maintain a special fn selector-signature mismatch check for the `receive` function.\n            **/\n            bool mismatch = false;\n            if(_extFunction.functionSelector == bytes4(0)) {\n                mismatch = keccak256(abi.encode(_extFunction.functionSignature)) != keccak256(abi.encode(\"receive()\"));\n            } else {\n                mismatch = _extFunction.functionSelector !=\n                    bytes4(keccak256(abi.encodePacked(_extFunction.functionSignature)));\n            }\n\n            // No fn signature-selector mismatch and no duplicate function.\n            isValid = !mismatch && !BaseRouterStorage.data().functionMap[_extFunction.functionSelector];\n            \n            BaseRouterStorage.data().functionMap[_extFunction.functionSelector] = true;\n        }\n    }\n}"
      },
      "lib/dynamic-contracts/src/presets/ExtensionManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../interface/IExtensionManager.sol\";\nimport \"../interface/IRouterState.sol\";\nimport \"../interface/IRouterStateGetters.sol\";\nimport \"../lib/ExtensionManagerStorage.sol\";\n\n/// @title ExtensionManager\n/// @author thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)\n/// @notice Defined storage and API for managing a router's extensions.\n\nabstract contract ExtensionManager is IExtensionManager, IRouterState, IRouterStateGetters {\n\n    using StringSet for StringSet.Set;\n\n    /*///////////////////////////////////////////////////////////////\n                            Modifier\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Checks that a call to any external function is authorized.\n    modifier onlyAuthorizedCall() {\n        require(_isAuthorizedCallToUpgrade(), \"ExtensionManager: unauthorized.\");\n        _;\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                            View functions\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     *  @notice Returns all extensions of the Router.\n     *  @return allExtensions An array of all extensions.\n     */\n    function getAllExtensions() external view virtual override returns (Extension[] memory allExtensions) {\n\n        string[] memory names = _extensionManagerStorage().extensionNames.values();\n        uint256 len = names.length;\n        \n        allExtensions = new Extension[](len);\n\n        for (uint256 i = 0; i < len; i += 1) {\n            allExtensions[i] = _getExtension(names[i]);\n        }\n    }\n\n    /**\n     *  @notice Returns the extension metadata for a given function.\n     *  @param functionSelector The function selector to get the extension metadata for.\n     *  @return metadata The extension metadata for a given function.\n     */\n    function getMetadataForFunction(bytes4 functionSelector) public view virtual returns (ExtensionMetadata memory) {\n        return _extensionManagerStorage().extensionMetadata[functionSelector];\n    }\n\n    /**\n     *  @notice Returns the extension metadata and functions for a given extension.\n     *  @param extensionName The name of the extension to get the metadata and functions for.\n     *  @return extension The extension metadata and functions for a given extension.\n     */\n    function getExtension(string memory extensionName) public view virtual returns (Extension memory) {\n        return _getExtension(extensionName);\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                            External functions\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     *  @notice Add a new extension to the router.\n     *  @param _extension The extension to add.\n     */\n    function addExtension(Extension memory _extension) public virtual onlyAuthorizedCall {    \n        _addExtension(_extension);\n    }\n\n    /**\n     *  @notice Fully replace an existing extension of the router.\n     *  @dev The extension with name `extension.name` is the extension being replaced.\n     *  @param _extension The extension to replace or overwrite.\n     */\n    function replaceExtension(Extension memory _extension) public virtual onlyAuthorizedCall {\n        _replaceExtension(_extension);\n    }\n\n    /**\n     *  @notice Remove an existing extension from the router.\n     *  @param _extensionName The name of the extension to remove.\n     */\n    function removeExtension(string memory _extensionName) public virtual onlyAuthorizedCall {\n        _removeExtension(_extensionName);\n    }\n\n    /**\n     *  @notice Enables a single function in an existing extension.\n     *  @dev Makes the given function callable on the router.\n     *\n     *  @param _extensionName The name of the extension to which `extFunction` belongs.\n     *  @param _function The function to enable.\n     */\n    function enableFunctionInExtension(string memory _extensionName, ExtensionFunction memory _function) public virtual onlyAuthorizedCall {\n        _enableFunctionInExtension(_extensionName, _function);\n    }\n\n    /**\n     *  @notice Disables a single function in an Extension.\n     *\n     *  @param _extensionName The name of the extension to which the function of `functionSelector` belongs.\n     *  @param _functionSelector The function to disable.\n     */\n    function disableFunctionInExtension(string memory _extensionName, bytes4 _functionSelector) public virtual onlyAuthorizedCall {\n        _disableFunctionInExtension(_extensionName, _functionSelector);\n    }\n    \n    /*///////////////////////////////////////////////////////////////\n                            Internal functions\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev Add a new extension to the router.\n    function _addExtension(Extension memory _extension) internal virtual {    \n        // Check: extension namespace must not already exist.\n        // Check: provided extension namespace must not be empty.\n        // Check: provided extension implementation must be non-zero.\n        // Store: new extension name.\n        require(_canAddExtension(_extension), \"ExtensionManager: cannot add extension.\");\n\n        // 1. Store: metadata for extension.\n        _setMetadataForExtension(_extension.metadata.name, _extension.metadata);\n\n        uint256 len = _extension.functions.length;\n        for (uint256 i = 0; i < len; i += 1) {\n            // 2. Store: function for extension.\n            _addToFunctionMap(_extension.metadata.name, _extension.functions[i]);\n            // 3. Store: metadata for function.\n            _setMetadataForFunction(_extension.functions[i].functionSelector, _extension.metadata);\n        }\n\n        emit ExtensionAdded(_extension.metadata.name, _extension.metadata.implementation, _extension);\n    }\n\n    /// @dev Fully replace an existing extension of the router.\n    function _replaceExtension(Extension memory _extension) internal virtual {\n        // Check: extension namespace must already exist.\n        // Check: provided extension implementation must be non-zero.\n        require(_canReplaceExtension(_extension), \"ExtensionManager: cannot replace extension.\");\n        \n        // 1. Store: metadata for extension.\n        _setMetadataForExtension(_extension.metadata.name, _extension.metadata);\n        // 2. Delete: existing extension.functions and metadata for each function.\n        _removeAllFunctionsFromExtension(_extension.metadata.name);\n        \n        uint256 len = _extension.functions.length;\n        for (uint256 i = 0; i < len; i += 1) {\n            // 2. Store: function for extension.\n            _addToFunctionMap(_extension.metadata.name, _extension.functions[i]);\n            // 3. Store: metadata for function.\n            _setMetadataForFunction(_extension.functions[i].functionSelector, _extension.metadata);\n        }\n\n        emit ExtensionReplaced(_extension.metadata.name, _extension.metadata.implementation, _extension);\n    }\n\n    /// @dev Remove an existing extension from the router.\n    function _removeExtension(string memory _extensionName) internal virtual {\n        // Check: extension namespace must already exist.\n        // Delete: extension namespace.\n        require(_canRemoveExtension(_extensionName), \"ExtensionManager: cannot remove extension.\");\n\n        Extension memory extension = _extensionManagerStorage().extensions[_extensionName];\n\n        // 1. Delete: metadata for extension.\n        _deleteMetadataForExtension(_extensionName);\n        // 2. Delete: existing extension.functions and metadata for each function.\n        _removeAllFunctionsFromExtension(_extensionName);\n\n        emit ExtensionRemoved(_extensionName, extension);\n    }\n\n    /// @dev Makes the given function callable on the router.\n    function _enableFunctionInExtension(string memory _extensionName, ExtensionFunction memory _function) internal virtual {\n        // Check: extension namespace must already exist.\n        require(_canEnableFunctionInExtension(_extensionName, _function), \"ExtensionManager: cannot Store: function for extension.\");\n        \n        // 1. Store: function for extension.\n        _addToFunctionMap(_extensionName, _function);\n\n        ExtensionMetadata memory metadata = _extensionManagerStorage().extensions[_extensionName].metadata;\n        // 2. Store: metadata for function.\n        _setMetadataForFunction(_function.functionSelector, metadata);\n\n        emit FunctionEnabled(_extensionName, _function.functionSelector, _function, metadata);\n    }\n\n    /// @dev Disables a single function in an Extension.\n    function _disableFunctionInExtension(string memory _extensionName, bytes4 _functionSelector) public virtual onlyAuthorizedCall {\n        // Check: extension namespace must already exist.\n        // Check: function must be mapped to provided extension.\n        require(_canDisableFunctionInExtension(_extensionName, _functionSelector), \"ExtensionManager: cannot remove function from extension.\");\n    \n        ExtensionMetadata memory extMetadata = _extensionManagerStorage().extensionMetadata[_functionSelector];\n\n        // 1. Delete: function from extension.\n        _deleteFromFunctionMap(_extensionName, _functionSelector);\n        // 2. Delete: metadata for function.\n        _deleteMetadataForFunction(_functionSelector);\n\n        emit FunctionDisabled(_extensionName, _functionSelector, extMetadata);\n    }\n\n    /// @dev Returns the Extension for a given name.\n    function _getExtension(string memory _extensionName) internal view returns (Extension memory) {\n        return _extensionManagerStorage().extensions[_extensionName];\n    }\n\n    /// @dev Sets the ExtensionMetadata for a given extension.\n    function _setMetadataForExtension(string memory _extensionName, ExtensionMetadata memory _metadata) internal {\n        _extensionManagerStorage().extensions[_extensionName].metadata = _metadata;\n    }\n\n    /// @dev Deletes the ExtensionMetadata for a given extension.\n    function _deleteMetadataForExtension(string memory _extensionName) internal {\n        delete _extensionManagerStorage().extensions[_extensionName].metadata;\n    }\n\n    /// @dev Sets the ExtensionMetadata for a given function.\n    function _setMetadataForFunction(bytes4 _functionSelector, ExtensionMetadata memory _metadata) internal {\n        _extensionManagerStorage().extensionMetadata[_functionSelector] = _metadata;\n    }\n\n    /// @dev Deletes the ExtensionMetadata for a given function.\n    function _deleteMetadataForFunction(bytes4 _functionSelector) internal {\n        delete _extensionManagerStorage().extensionMetadata[_functionSelector];\n    }\n\n    /// @dev Adds a function to the function map of an extension.\n    function _addToFunctionMap(string memory _extensionName, ExtensionFunction memory _extFunction) internal virtual {\n        /**\n         *  Note: `bytes4(0)` is the function selector for the `receive` function.\n         *        So, we maintain a special fn selector-signature mismatch check for the `receive` function.\n        **/\n        bool mismatch = false;\n        if(_extFunction.functionSelector == bytes4(0)) {\n            mismatch = keccak256(abi.encode(_extFunction.functionSignature)) != keccak256(abi.encode(\"receive()\"));\n        } else {\n            mismatch = _extFunction.functionSelector !=\n                bytes4(keccak256(abi.encodePacked(_extFunction.functionSignature)));\n        }\n            \n        // Check: function selector and signature must match.\n        require(\n            !mismatch,\n            \"ExtensionManager: fn selector and signature mismatch.\"\n        );\n        // Check: function must not already be mapped to an implementation.\n        require(\n            _extensionManagerStorage().extensionMetadata[_extFunction.functionSelector].implementation == address(0),\n            \"ExtensionManager: function impl already exists.\"\n        );\n\n        // Store: name -> extension.functions map\n        _extensionManagerStorage().extensions[_extensionName].functions.push(_extFunction);\n    }\n\n    /// @dev Deletes a function from an extension's function map.\n    function _deleteFromFunctionMap(string memory _extensionName, bytes4 _functionSelector) internal {\n        ExtensionFunction[] memory extensionFunctions = _extensionManagerStorage().extensions[_extensionName].functions;\n\n        uint256 len = extensionFunctions.length;\n        for (uint256 i = 0; i < len; i += 1) {\n            if(extensionFunctions[i].functionSelector == _functionSelector) {\n\n                // Delete: particular function from name -> extension.functions map\n                _extensionManagerStorage().extensions[_extensionName].functions[i] = _extensionManagerStorage().extensions[_extensionName].functions[len - 1];\n                _extensionManagerStorage().extensions[_extensionName].functions.pop();\n                break;\n            }\n        }\n    }\n\n    /// @dev Removes all functions from an Extension.\n    function _removeAllFunctionsFromExtension(string memory _extensionName) internal {        \n        ExtensionFunction[] memory functions = _extensionManagerStorage().extensions[_extensionName].functions;\n        \n        // Delete: existing name -> extension.functions map\n        delete _extensionManagerStorage().extensions[_extensionName].functions;\n\n        for(uint256 i = 0; i < functions.length; i += 1) {\n            // Delete: metadata for function.\n            _deleteMetadataForFunction(functions[i].functionSelector);\n        }\n    }\n\n    /// @dev Returns whether a new extension can be added in the given execution context.\n    function _canAddExtension(Extension memory _extension) internal virtual returns (bool) {\n        // Check: provided extension namespace must not be empty.\n        require(bytes(_extension.metadata.name).length > 0, \"ExtensionManager: empty name.\");\n        \n        // Check: extension namespace must not already exist.\n        // Store: new extension name.\n        require(_extensionManagerStorage().extensionNames.add(_extension.metadata.name), \"ExtensionManager: extension already exists.\");\n\n        // Check: extension implementation must be non-zero.\n        require(_extension.metadata.implementation != address(0), \"ExtensionManager: adding extension without implementation.\");\n\n        return true;\n    }\n\n    /// @dev Returns whether an extension can be replaced in the given execution context.\n    function _canReplaceExtension(Extension memory _extension) internal virtual returns (bool) {\n        // Check: extension namespace must already exist.\n        require(_extensionManagerStorage().extensionNames.contains(_extension.metadata.name), \"ExtensionManager: extension does not exist.\");\n\n        // Check: extension implementation must be non-zero.\n        require(_extension.metadata.implementation != address(0), \"ExtensionManager: adding extension without implementation.\");\n\n        return true;\n    }\n\n    /// @dev Returns whether an extension can be removed in the given execution context.\n    function _canRemoveExtension(string memory _extensionName) internal virtual returns (bool) {\n        // Check: extension namespace must already exist.\n        // Delete: extension namespace.\n        require(_extensionManagerStorage().extensionNames.remove(_extensionName), \"ExtensionManager: extension does not exist.\");\n\n        return true;\n    }\n\n    /// @dev Returns whether a function can be enabled in an extension in the given execution context.\n    function _canEnableFunctionInExtension(string memory _extensionName, ExtensionFunction memory) internal view virtual returns (bool) {\n        // Check: extension namespace must already exist.\n        require(_extensionManagerStorage().extensionNames.contains(_extensionName), \"ExtensionManager: extension does not exist.\");\n\n        return true;\n    }\n\n    /// @dev Returns whether a function can be disabled in an extension in the given execution context.\n    function _canDisableFunctionInExtension(string memory _extensionName, bytes4 _functionSelector) internal view virtual returns (bool) {\n        // Check: extension namespace must already exist.\n        require(_extensionManagerStorage().extensionNames.contains(_extensionName), \"ExtensionManager: extension does not exist.\");\n        // Check: function must be mapped to provided extension.\n        require(keccak256(abi.encode(_extensionManagerStorage().extensionMetadata[_functionSelector].name)) == keccak256(abi.encode(_extensionName)), \"ExtensionManager: incorrect extension.\");\n\n        return true;\n    }\n\n    \n    /// @dev Returns the ExtensionManager storage.\n    function _extensionManagerStorage() internal pure returns (ExtensionManagerStorage.Data storage data) {\n        data = ExtensionManagerStorage.data();\n    }\n\n    /// @dev To override; returns whether all relevant permission and other checks are met before any upgrade.\n    function _isAuthorizedCallToUpgrade() internal view virtual returns (bool);\n}"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n    /**\n     * @dev Handles the receipt of a single ERC1155 token type. This function is\n     * called at the end of a `safeTransferFrom` after the balance has been updated.\n     *\n     * NOTE: To accept the transfer, this must return\n     * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n     * (i.e. 0xf23a6e61, or its own function selector).\n     *\n     * @param operator The address which initiated the transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param id The ID of the token being transferred\n     * @param value The amount of tokens being transferred\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n     */\n    function onERC1155Received(\n        address operator,\n        address from,\n        uint256 id,\n        uint256 value,\n        bytes calldata data\n    ) external returns (bytes4);\n\n    /**\n     * @dev Handles the receipt of a multiple ERC1155 token types. This function\n     * is called at the end of a `safeBatchTransferFrom` after the balances have\n     * been updated.\n     *\n     * NOTE: To accept the transfer(s), this must return\n     * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n     * (i.e. 0xbc197c81, or its own function selector).\n     *\n     * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param ids An array containing ids of each token being transferred (order and length must match values array)\n     * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n     */\n    function onERC1155BatchReceived(\n        address operator,\n        address from,\n        uint256[] calldata ids,\n        uint256[] calldata values,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Holder.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC1155Receiver.sol\";\n\n/**\n * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.\n *\n * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be\n * stuck.\n *\n * @dev _Available since v3.1._\n */\ncontract ERC1155Holder is ERC1155Receiver {\n    function onERC1155Received(\n        address,\n        address,\n        uint256,\n        uint256,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC1155Received.selector;\n    }\n\n    function onERC1155BatchReceived(\n        address,\n        address,\n        uint256[] memory,\n        uint256[] memory,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC1155BatchReceived.selector;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Receiver.sol\";\n\n/**\n * @dev Implementation of the {IERC721Receiver} interface.\n *\n * Accepts all token transfers.\n * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.\n */\ncontract ERC721Holder is IERC721Receiver {\n    /**\n     * @dev See {IERC721Receiver-onERC721Received}.\n     *\n     * Always returns `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {\n        return this.onERC721Received.selector;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/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"
      },
      "lib/openzeppelin-contracts/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"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 20
      },
      "evmVersion": "london",
      "remappings": [
        ":@chainlink/=lib/chainlink/",
        ":@ds-test/=lib/ds-test/src/",
        ":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
        ":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
        ":@prb/test/=lib/prb-proxy/node_modules/@prb/test/",
        ":@std/=lib/forge-std/src/",
        ":@thirdweb-dev/dynamic-contracts/=lib/dynamic-contracts/",
        ":ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/",
        ":ERC721A/=lib/ERC721A/contracts/",
        ":chainlink/=lib/chainlink/contracts/",
        ":contracts/=contracts/",
        ":ds-test/=lib/ds-test/src/",
        ":dynamic-contracts/=lib/dynamic-contracts/src/",
        ":erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
        ":erc721a-upgradeable/=lib/ERC721A-Upgradeable/",
        ":erc721a/=lib/ERC721A/",
        ":forge-std/=lib/forge-std/src/",
        ":lib/sstore2/=lib/dynamic-contracts/lib/sstore2/",
        ":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
        ":openzeppelin-contracts/=lib/openzeppelin-contracts/",
        ":openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
        ":prb-proxy/=lib/prb-proxy/src/",
        ":sstore2/=lib/dynamic-contracts/lib/sstore2/contracts/"
      ],
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    }
  }}