creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    function __Ownable_init() internal onlyInitializing {\n        __Ownable_init_unchained();\n    }\n\n    function __Ownable_init_unchained() internal onlyInitializing {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby removing any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n    /**\n     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n     * address.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy.\n     */\n    function proxiableUUID() external view returns (bytes32);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n    /**\n     * @dev Must return an address that can be used as a delegate call target.\n     *\n     * {BeaconProxy} will check that this address is a contract.\n     */\n    function implementation() external view returns (address);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n    function __ERC1967Upgrade_init() internal onlyInitializing {\n    }\n\n    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n    }\n    // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n    /**\n     * @dev Storage slot with the address of the current implementation.\n     * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n    /**\n     * @dev Emitted when the implementation is upgraded.\n     */\n    event Upgraded(address indexed implementation);\n\n    /**\n     * @dev Returns the current implementation address.\n     */\n    function _getImplementation() internal view returns (address) {\n        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 implementation slot.\n     */\n    function _setImplementation(address newImplementation) private {\n        require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n    }\n\n    /**\n     * @dev Perform implementation upgrade\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeTo(address newImplementation) internal {\n        _setImplementation(newImplementation);\n        emit Upgraded(newImplementation);\n    }\n\n    /**\n     * @dev Perform implementation upgrade with additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCall(\n        address newImplementation,\n        bytes memory data,\n        bool forceCall\n    ) internal {\n        _upgradeTo(newImplementation);\n        if (data.length > 0 || forceCall) {\n            _functionDelegateCall(newImplementation, data);\n        }\n    }\n\n    /**\n     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCallUUPS(\n        address newImplementation,\n        bytes memory data,\n        bool forceCall\n    ) internal {\n        // Upgrades from old implementations will perform a rollback test. This test requires the new\n        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n        // this special case will break upgrade paths from old UUPS implementation to new ones.\n        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n            _setImplementation(newImplementation);\n        } else {\n            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n                require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n            } catch {\n                revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n            }\n            _upgradeToAndCall(newImplementation, data, forceCall);\n        }\n    }\n\n    /**\n     * @dev Storage slot with the admin of the contract.\n     * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n    /**\n     * @dev Emitted when the admin account has changed.\n     */\n    event AdminChanged(address previousAdmin, address newAdmin);\n\n    /**\n     * @dev Returns the current admin.\n     */\n    function _getAdmin() internal view returns (address) {\n        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 admin slot.\n     */\n    function _setAdmin(address newAdmin) private {\n        require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n    }\n\n    /**\n     * @dev Changes the admin of the proxy.\n     *\n     * Emits an {AdminChanged} event.\n     */\n    function _changeAdmin(address newAdmin) internal {\n        emit AdminChanged(_getAdmin(), newAdmin);\n        _setAdmin(newAdmin);\n    }\n\n    /**\n     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n     */\n    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n    /**\n     * @dev Emitted when the beacon is upgraded.\n     */\n    event BeaconUpgraded(address indexed beacon);\n\n    /**\n     * @dev Returns the current beacon.\n     */\n    function _getBeacon() internal view returns (address) {\n        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new beacon in the EIP1967 beacon slot.\n     */\n    function _setBeacon(address newBeacon) private {\n        require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n        require(\n            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n            \"ERC1967: beacon implementation is not a contract\"\n        );\n        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n    }\n\n    /**\n     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n     *\n     * Emits a {BeaconUpgraded} event.\n     */\n    function _upgradeBeaconToAndCall(\n        address newBeacon,\n        bytes memory data,\n        bool forceCall\n    ) internal {\n        _setBeacon(newBeacon);\n        emit BeaconUpgraded(newBeacon);\n        if (data.length > 0 || forceCall) {\n            _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n        }\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(address target, bytes memory data) private returns (bytes memory) {\n        require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return AddressUpgradeable.verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n *     function initializeV2() reinitializer(2) public {\n *         __ERC20Permit_init(\"MyToken\");\n *     }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n *     _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     * @custom:oz-retyped-from bool\n     */\n    uint8 private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\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.\n     *\n     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n     * constructor.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        bool isTopLevelCall = !_initializing;\n        require(\n            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n            \"Initializable: contract is already initialized\"\n        );\n        _initialized = 1;\n        if (isTopLevelCall) {\n            _initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            _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     * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n     * are added through upgrades and that require initialization.\n     *\n     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n     * cannot be nested. If one is invoked in the context of another, execution will revert.\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     * WARNING: setting the version to 255 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint8 version) {\n        require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n        _initialized = version;\n        _initializing = true;\n        _;\n        _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(_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     * Emits an {Initialized} event the first time it is successfully executed.\n     */\n    function _disableInitializers() internal virtual {\n        require(!_initializing, \"Initializable: contract is initializing\");\n        if (_initialized < type(uint8).max) {\n            _initialized = type(uint8).max;\n            emit Initialized(type(uint8).max);\n        }\n    }\n\n    /**\n     * @dev Internal function that returns the initialized version. Returns `_initialized`\n     */\n    function _getInitializedVersion() internal view returns (uint8) {\n        return _initialized;\n    }\n\n    /**\n     * @dev Internal function that returns the initialized version. Returns `_initializing`\n     */\n    function _isInitializing() internal view returns (bool) {\n        return _initializing;\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n    function __UUPSUpgradeable_init() internal onlyInitializing {\n    }\n\n    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n    }\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n    address private immutable __self = address(this);\n\n    /**\n     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n     * fail.\n     */\n    modifier onlyProxy() {\n        require(address(this) != __self, \"Function must be called through delegatecall\");\n        require(_getImplementation() == __self, \"Function must be called through active proxy\");\n        _;\n    }\n\n    /**\n     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n     * callable on the implementing contract but not through proxies.\n     */\n    modifier notDelegated() {\n        require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n        _;\n    }\n\n    /**\n     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n     */\n    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n        return _IMPLEMENTATION_SLOT;\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function upgradeTo(address newImplementation) external virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n     * encoded in `data`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, data, true);\n    }\n\n    /**\n     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n     * {upgradeTo} and {upgradeToAndCall}.\n     *\n     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n     *\n     * ```solidity\n     * function _authorizeUpgrade(address) internal override onlyOwner {}\n     * ```\n     */\n    function _authorizeUpgrade(address newImplementation) internal virtual;\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n    /**\n     * @dev Emitted when the pause is triggered by `account`.\n     */\n    event Paused(address account);\n\n    /**\n     * @dev Emitted when the pause is lifted by `account`.\n     */\n    event Unpaused(address account);\n\n    bool private _paused;\n\n    /**\n     * @dev Initializes the contract in unpaused state.\n     */\n    function __Pausable_init() internal onlyInitializing {\n        __Pausable_init_unchained();\n    }\n\n    function __Pausable_init_unchained() internal onlyInitializing {\n        _paused = false;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is not paused.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    modifier whenNotPaused() {\n        _requireNotPaused();\n        _;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is paused.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    modifier whenPaused() {\n        _requirePaused();\n        _;\n    }\n\n    /**\n     * @dev Returns true if the contract is paused, and false otherwise.\n     */\n    function paused() public view virtual returns (bool) {\n        return _paused;\n    }\n\n    /**\n     * @dev Throws if the contract is paused.\n     */\n    function _requireNotPaused() internal view virtual {\n        require(!paused(), \"Pausable: paused\");\n    }\n\n    /**\n     * @dev Throws if the contract is not paused.\n     */\n    function _requirePaused() internal view virtual {\n        require(paused(), \"Pausable: not paused\");\n    }\n\n    /**\n     * @dev Triggers stopped state.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    function _pause() internal virtual whenNotPaused {\n        _paused = true;\n        emit Paused(_msgSender());\n    }\n\n    /**\n     * @dev Returns to normal state.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    function _unpause() internal virtual whenPaused {\n        _paused = false;\n        emit Unpaused(_msgSender());\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    function __ReentrancyGuard_init() internal onlyInitializing {\n        __ReentrancyGuard_init_unchained();\n    }\n\n    function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return 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(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (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 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"
      },
      "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/interfaces/IERC2981.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/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 paid in that same unit of exchange.\n     */\n    function royaltyInfo(uint256 tokenId, uint256 salePrice)\n        external\n        view\n        returns (address receiver, uint256 royaltyAmount);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n    /**\n     * @dev Returns the token collection name.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the token collection symbol.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n     */\n    function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/IERC721.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId,\n        bytes calldata data\n    ) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the caller.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool _approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"
      },
      "@openzeppelin/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"
      },
      "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Down, // Toward negative infinity\n        Up, // Toward infinity\n        Zero // Toward zero\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds up instead\n     * of rounding down.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n     * with further edits by Uniswap Labs also under MIT license.\n     */\n    function mulDiv(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod0 := mul(x, y)\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1);\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n            // See https://cs.stackexchange.com/q/138556/92363.\n\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\n            uint256 twos = denominator & (~denominator + 1);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n            // in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(\n        uint256 x,\n        uint256 y,\n        uint256 denominator,\n        Rounding rounding\n    ) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10**64) {\n                value /= 10**64;\n                result += 64;\n            }\n            if (value >= 10**32) {\n                value /= 10**32;\n                result += 32;\n            }\n            if (value >= 10**16) {\n                value /= 10**16;\n                result += 16;\n            }\n            if (value >= 10**8) {\n                value /= 10**8;\n                result += 8;\n            }\n            if (value >= 10**4) {\n                value /= 10**4;\n                result += 4;\n            }\n            if (value >= 10**2) {\n                value /= 10**2;\n                result += 2;\n            }\n            if (value >= 10**1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n    uint8 private constant _ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\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        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\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] = _SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n    }\n}\n"
      },
      "contracts/ERC721/ERC721KODACreator.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\nimport {KODASettings} from \"../KODASettings.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\n\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {IERC721Metadata, IERC2981} from \"./interfaces/IERC721KODAEditions.sol\";\nimport {IERC721KODACreator} from \"./interfaces/IERC721KODACreator.sol\";\n\nimport {ERC721KODAEditions} from \"./ERC721KODAEditions.sol\";\n\n/**\n * @author KnownOrigin Labs - https://knownorigin.io/\n *\n * @dev Contract which extends the KO Edition base enabling creator specific functionality\n */\ncontract ERC721KODACreator is ERC721KODAEditions, IERC721KODACreator {\n    /**\n     * @notice KODA Settings\n     * @dev Defines the global settings for the linked KODA platform\n     */\n    KODASettings public kodaSettings;\n\n    /**\n     * @notice Default Funds Handler\n     * @dev Address of the fund handler that receives funds for all editions if an alternative has not been set in {_editionFundsHandler}\n     */\n    address public defaultFundsHandler;\n\n    /**\n     * @notice Additional address enabled as a minter\n     * @dev returns true if the address has been enabled as an additional minter\n     *\n     * - requires addition logic in place in inherited minting contracts\n     */\n    mapping(address => bool) public additionalMinterEnabled;\n\n    /**\n     * @notice Additional address enabled as creators of editions\n     * @dev returns true if the address has been enabled as an additional creator\n     *\n     */\n    mapping(address => bool) public additionalCreatorEnabled;\n\n    /// @dev mapping of edition ID => address of the fund handler for a specific edition\n    mapping(uint256 => address) internal _editionFundsHandler;\n\n    modifier onlyApprovedMinter() {\n        _onlyApprovedMinter();\n        _;\n    }\n\n    modifier onlyApprovedCreator() {\n        _onlyApprovedCreator();\n        _;\n    }\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    /**\n     * @dev initialize method that replaces constructor in upgradeable contract\n     *\n     * Requirements:\n     *\n     * - `_artistAndOwner` must not be the zero address\n     * - `_name` and `_symbol` must not be empty strings\n     * - `_defaultFundsHandler` must not be the zero address\n     * - `_settings` must not be the zero address\n     * - should call all upgradeable `__[ContractName]_init()` methods from inherited contracts\n     *\n     * @param _artistAndOwner Who will be assigned attribution as lead artist and initial owner of the contract.\n     * @param _name the NFT name\n     * @param _symbol the NFT symbol\n     * @param _defaultFundsHandler the address of the default address for receiving funds for all editions\n     * @param _settings address of the platform KODASettings contract\n     * @param _secondaryRoyaltyPercentage the default percentage value used for calculating royalties for secondary sales\n     */\n    function initialize(\n        address _artistAndOwner,\n        string calldata _name,\n        string calldata _symbol,\n        address _defaultFundsHandler,\n        KODASettings _settings,\n        uint256 _secondaryRoyaltyPercentage,\n        address _operatorRegistry,\n        address _subscriptionOrRegistrantToCopy\n    ) external initializer {\n        if (_artistAndOwner == address(0)) revert ZeroAddress();\n        if (address(_settings) == address(0)) revert ZeroAddress();\n        if (_defaultFundsHandler == address(0)) revert ZeroAddress();\n\n        if (_artistAndOwner == address(this)) revert InvalidOwner();\n        if (bytes(_name).length == 0 || bytes(_symbol).length == 0)\n            revert EmptyString();\n\n        name = _name;\n        symbol = _symbol;\n\n        defaultFundsHandler = _defaultFundsHandler;\n        kodaSettings = _settings;\n        nextEditionId = MAX_EDITION_SIZE;\n        originalDeployer = _artistAndOwner;\n\n        __KODABase_init(_secondaryRoyaltyPercentage);\n        __Module_init(_operatorRegistry, _subscriptionOrRegistrantToCopy);\n\n        _transferOwnership(_artistAndOwner);\n    }\n\n    /// @dev Allow a module to define custom init logic\n    function __Module_init(\n        address _operatorRegistry,\n        address _subscriptionOrRegistrantToCopy\n    ) internal virtual {}\n\n    // ********** //\n    // * PUBLIC * //\n    // ********** //\n\n    function contractURI() public view returns (string memory) {\n        uint256 id;\n        assembly {\n            id := chainid()\n        }\n        return\n            string.concat(\n                kodaSettings.baseKOApi(),\n                \"/network/\",\n                Strings.toString(id),\n                \"/contracts/\",\n                Strings.toHexString(address(this))\n            );\n    }\n\n    // * Contract Metadata * //\n\n    /**\n     * @notice Royalty Info for a Token Sale\n     * @dev returns the royalty details for the edition a token belongs to - falls back to defaults\n     * @param _tokenId the id of the token being sold\n     * @param _salePrice currency/token agnostic sale price\n     * @return receiver address to send royalty consideration to\n     * @return royaltyAmount value to be sent to the receiver\n     */\n    function royaltyInfo(\n        uint256 _tokenId,\n        uint256 _salePrice\n    ) public view override returns (address receiver, uint256 royaltyAmount) {\n        uint256 editionId = _tokenEditionId(_tokenId);\n\n        receiver = editionFundsHandler(editionId);\n        royaltyAmount =\n            (_salePrice * editionRoyaltyPercentage(editionId)) /\n            MODULO;\n    }\n\n    /**\n     * @notice Check for Interface Support\n     * @dev Returns true if this contract implements the interface defined by `interfaceId`.\n     * @param interfaceId the ID of the interface to check\n     * @return bool the interface is supported\n     */\n    function supportsInterface(\n        bytes4 interfaceId\n    ) public pure virtual override returns (bool) {\n        return\n            interfaceId == type(IERC165).interfaceId || // ERC165\n            interfaceId == type(IERC721).interfaceId || // ERC721\n            interfaceId == type(IERC721Metadata).interfaceId || // ERC721 Metadata\n            interfaceId == type(IERC2981).interfaceId || // ERC2981\n            interfaceId == type(IERC721KODACreator).interfaceId;\n    }\n\n    /**\n     * @notice Version of the Contract used in combination with {description}\n     * @dev Function value can be more easily updated in event of an upgrade\n     * @return string semver version\n     */\n    function version() external pure override returns (string memory) {\n        return \"1.0.0\";\n    }\n\n    // * Editions * //\n\n    /**\n     * @notice Edition Funds Handler\n     * @dev Returns the address that will receive sale proceeds for a given edition\n     * @param _editionId the ID of an edition\n     * @return address the funds handler address\n     */\n    function editionFundsHandler(\n        uint256 _editionId\n    ) public view override returns (address) {\n        address fundsHandler = _editionFundsHandler[_editionId];\n\n        if (fundsHandler != address(0)) {\n            return fundsHandler;\n        }\n\n        return defaultFundsHandler;\n    }\n\n    /**\n     * @notice Next Edition Token for Sale\n     * @dev returns the ID of the next token that will be sold from a pre-minted edition\n     * @param _editionId the ID of the edition\n     * @return uint256 the next tokenId from the edition to be sold\n     */\n    function getNextAvailablePrimarySaleToken(\n        uint256 _editionId\n    ) public view override returns (uint256) {\n        if (isOpenEdition(_editionId)) revert IsOpenEdition();\n        return\n            _getNextAvailablePrimarySaleToken(\n                _editionId,\n                _editionMaxTokenId(_editionId)\n            );\n    }\n\n    /**\n     * @notice Next Edition Token for Sale\n     * @dev returns the ID of the next token that will be sold from a pre-minted edition\n     * @param _editionId the ID of the edition\n     * @param _startId the ID of the starting point to look for the next token to sell\n     * @return uint256 the next tokenId from the edition to be sold\n     */\n    function getNextAvailablePrimarySaleToken(\n        uint256 _editionId,\n        uint256 _startId\n    ) public view override returns (uint256) {\n        if (isOpenEdition(_editionId)) revert IsOpenEdition();\n        return _getNextAvailablePrimarySaleToken(_editionId, _startId);\n    }\n\n    /**\n     * @notice Mint An Open Edition Token\n     * @dev allows the contract owner or additional minter to mint an open edition token\n     * @param _editionId the ID of the edition to mint a token from\n     * @param _recipient the address to transfer the token to\n     */\n    function mintOpenEditionToken(\n        uint256 _editionId,\n        address _recipient\n    ) public override onlyApprovedMinter returns (uint256) {\n        return _mintSingleOpenEditionTo(_editionId, _recipient);\n    }\n\n    /**\n     * @notice Mint Multiple Open Edition Tokens to the Edition Owner\n     * @dev allows the contract owner or additional minter to mint\n     * @param _editionId the ID of the edition to mint a token from\n     * @param _quantity the number of tokens to mint\n     */\n    function mintMultipleOpenEditionTokens(\n        uint256 _editionId,\n        uint256 _quantity,\n        address _recipient\n    ) public virtual override onlyApprovedMinter {\n        if (_recipient != editionOwner(_editionId)) revert InvalidRecipient();\n        _mintMultipleOpenEditionToOwner(_editionId, _quantity);\n    }\n\n    // ********* //\n    // * OWNER * //\n    // ********* //\n\n    /**\n     * @notice Create a new Edition - optionally mint tokens and set a custom creator address and edition metadata URI\n     * @dev Allows creation of an edition including minting a portion (or all) tokens upfront to any address and setting metadata\n     * @param _editionSize the initial maximum supply of tokens in the edition\n     * @param _mintQuantity the number of tokens to mint upfront - minting less than the edition size is considered an open edition\n     * @param _recipient the address to transfer any minted tokens to\n     * @param _creator an optional creator address to reflected in edition details\n     * @param _uri the URI for fixed edition metadata\n     * @return uint256 the new edition ID\n     */\n    function createEdition(\n        uint32 _editionSize,\n        uint256 _mintQuantity,\n        address _recipient,\n        address _creator,\n        string calldata _uri\n    ) public override onlyApprovedCreator returns (uint256) {\n        // mint to the minter or owner if address not specified\n        address to = _recipient == address(0)\n            ? additionalCreatorEnabled[msg.sender] ? msg.sender : owner()\n            : _recipient;\n\n        return _createEdition(_editionSize, _mintQuantity, to, _creator, _uri);\n    }\n\n    /**\n     * @notice Create a new Edition as a collaboration with another entity, passing in a seperate funds handler for the edition - optionally mint tokens and set a custom creator address and edition metadata URI\n     * @dev Allows creation of an edition including minting a portion (or all) tokens upfront to any address, setting metadata and a funds handler for this edition\n     * @param _editionSize the initial maximum supply of tokens in the edition\n     * @param _mintQuantity the number of tokens to mint upfront - minting less than the edition size is considered an open edition\n     * @param _recipient the address to transfer any minted tokens to\n     * @param _creator an optional creator address to reflected in edition details\n     * @param _collabFundsHandler the address for receiving funds for this edition\n     * @param _uri the URI for fixed edition metadata\n     * @return editionId the new edition ID\n     */\n    function createEditionAsCollaboration(\n        uint32 _editionSize,\n        uint256 _mintQuantity,\n        address _recipient,\n        address _creator,\n        address _collabFundsHandler,\n        string calldata _uri\n    ) public override onlyApprovedCreator returns (uint256 editionId) {\n        // mint to the minter or owner if address not specified\n        address to = _recipient == address(0)\n            ? additionalCreatorEnabled[msg.sender] ? msg.sender : owner()\n            : _recipient;\n\n        editionId = _createEdition(\n            _editionSize,\n            _mintQuantity,\n            to,\n            _creator,\n            _uri\n        );\n\n        _updateEditionFundsHandler(editionId, _collabFundsHandler);\n    }\n\n    /**\n     * @notice Create Edition and Mint All Tokens to Owner\n     * @dev allows the contract owner to creates an edition of specified size and mints all tokens to their address\n     * @param _editionSize the number of tokens in the edition\n     * @param _uri the metadata URI for the edition\n     * @return uint256 the new edition ID\n     */\n    function createEditionAndMintToOwner(\n        uint32 _editionSize,\n        string calldata _uri\n    ) public override onlyOwner returns (uint256) {\n        return\n            _createEdition(\n                _editionSize,\n                _editionSize,\n                owner(),\n                address(0),\n                _uri\n            );\n    }\n\n    /**\n     * @notice Create Edition for Lazy Minting\n     * @dev Allows the contract owner to create an edition of specified size for lazy minting\n     * @param _editionSize the number of tokens in the edition\n     * @param _uri the metadata URI for the edition\n     * @return uint256 the new edition ID\n     */\n    function createOpenEdition(\n        uint32 _editionSize,\n        string calldata _uri\n    ) public override onlyApprovedCreator returns (uint256) {\n        return\n            _createEdition(\n                _editionSize == 0 ? MAX_EDITION_SIZE : _editionSize,\n                0,\n                additionalCreatorEnabled[msg.sender] ? msg.sender : owner(),\n                address(0),\n                _uri\n            );\n    }\n\n    /**\n     * @notice Create Edition for Lazy Minting as a collaboration\n     * @dev Allows the contract owner to create an edition of specified size for lazy minting as a collaboration with another entity, passing in a seperate funds handler for the edition\n     * @param _editionSize the number of tokens in the edition\n     * @param _collabFundsHandler the address for receiving funds for this edition\n     * @param _uri the metadata URI for the edition\n     * @return editionId the new edition ID\n     */\n    function createOpenEditionAsCollaboration(\n        uint32 _editionSize,\n        address _collabFundsHandler,\n        string calldata _uri\n    ) public override onlyApprovedCreator returns (uint256 editionId) {\n        editionId = _createEdition(\n            _editionSize == 0 ? MAX_EDITION_SIZE : _editionSize,\n            0,\n            additionalCreatorEnabled[msg.sender] ? msg.sender : owner(),\n            address(0),\n            _uri\n        );\n\n        _updateEditionFundsHandler(editionId, _collabFundsHandler);\n    }\n\n    /**\n     * @notice Enable/disable minting using an additional address\n     * @dev allows the contract owner to enable/disable additional minting addresses\n     * @param _minter address of the additional minter\n     * @param _enabled whether the address is able to mint\n     */\n    function updateAdditionalMinterEnabled(\n        address _minter,\n        bool _enabled\n    ) external onlyOwner {\n        additionalMinterEnabled[_minter] = _enabled;\n        emit AdditionalMinterEnabled(_minter, _enabled);\n    }\n\n    /**\n     * @notice Enable/disable edition creation using an additional address\n     * @dev allows the contract owner to enable/disable additional creator addresses\n     * @param _creator address of the additional creator\n     * @param _enabled whether the address is able to be a creator\n     */\n    function updateAdditionalCreatorEnabled(\n        address _creator,\n        bool _enabled\n    ) external onlyOwner {\n        additionalCreatorEnabled[_creator] = _enabled;\n        emit AdditionalCreatorEnabled(_creator, _enabled);\n    }\n\n    /**\n     * @notice Update Edition Funds Handler\n     * @dev Allows the contract owner to set a specific fund handler for an edition, otherwise the default for all editions is used\n     * @param _editionId the ID of the edition\n     * @param _fundsHandler the address of the new funds handler for the edition\n     */\n    function updateEditionFundsHandler(\n        uint256 _editionId,\n        address _fundsHandler\n    ) public override onlyOwner {\n        _updateEditionFundsHandler(_editionId, _fundsHandler);\n    }\n\n    /// @dev Internal logic for updating edition level funds handler overriding default\n    function _updateEditionFundsHandler(\n        uint256 _editionId,\n        address _fundsHandler\n    ) internal {\n        if (_fundsHandler == address(0)) revert ZeroAddress();\n        if (!_editionExists(_editionId)) revert EditionDoesNotExist();\n        if (_editionFundsHandler[_editionId] != address(0)) revert AlreadySet();\n        _editionFundsHandler[_editionId] = _fundsHandler;\n        emit EditionFundsHandlerUpdated(_editionId, _fundsHandler);\n    }\n\n    /**\n     * @notice Update Edition Size\n     * @dev allows the contract owner to update the number of tokens that can be minted in an edition\n     *\n     * Requirements:\n     *\n     * - should not allow edition size to exceed {Konstants-MAX_EDITION_SIZE}\n     * - should not allow edition size to be reduced to less than has already been minted\n     *\n     * @param _editionId the ID of the edition to change the size of\n     * @param _editionSize the new size to set for the edition\n     *\n     * Emits an {EditionSizeUpdated} event.\n     */\n    function updateEditionSize(\n        uint256 _editionId,\n        uint32 _editionSize\n    ) public override onlyOwner onlyOpenEdition(_editionId) {\n        // can't set edition size beyond maximum\n        if (_editionSize > MAX_EDITION_SIZE) revert EditionSizeTooLarge();\n\n        unchecked {\n            // can't reduce edition size to less than what has been minted already\n            if (_editionSize < editionMintedCount(_editionId))\n                revert EditionSizeTooSmall();\n        }\n\n        _editions[_editionId].editionSize = _editionSize;\n        emit EditionSizeUpdated(_editionId, _editionSize);\n    }\n\n    /// @dev Provided no primary sale has been made, an artist can correct any mistakes in their token URI\n    function updateURIIfNoSaleMade(\n        uint256 _editionId,\n        string calldata _newURI\n    ) external override onlyOwner {\n        if (isOpenEdition(_editionId)) {\n            if (_owners[_editionId] != address(0)) revert PrimarySaleMade();\n        }\n\n        if (\n            _owners[_editionId + editionMintedCount(_editionId) - 1] !=\n            address(0)\n        ) revert PrimarySaleMade();\n\n        _editions[_editionId].uri = _newURI;\n\n        emit EditionURIUpdated(_editionId);\n    }\n\n    // ************ //\n    // * INTERNAL * //\n    // ************ //\n\n    // * Contract Ownership * //\n\n    // @dev Handle transferring and renouncing ownership in one go where owner always has a minimum balance\n    // @dev See balanceOf for how the return value is adjusted. We just do this to reduce minting GAS\n    function _transferOwnership(address _newOwner) internal override {\n        // This is for keeping the balance slot of owner 'dirty'\n        address _currentOwner = owner();\n        if (_currentOwner != address(0)) {\n            _balances[_currentOwner] -= 1;\n        }\n        if (_newOwner != address(0)) {\n            _balances[_newOwner] += 1;\n        }\n\n        super._transferOwnership(_newOwner);\n    }\n\n    // * Sale Helpers * //\n\n    function _facilitateNextPrimarySale(\n        uint256 _editionId,\n        address _recipient\n    ) internal virtual validateEdition(_editionId) returns (uint256 tokenId) {\n        if (_editionSalesDisabled[_editionId]) revert EditionDisabled();\n\n        // Process open edition sale\n        if (isOpenEdition(_editionId)) {\n            return _facilitateOpenEditionSale(_editionId, _recipient);\n        }\n\n        // process batch minted edition\n        tokenId = getNextAvailablePrimarySaleToken(_editionId);\n\n        // Re-enter this contract to make address(this) the sender for transferring which should be approved to transfer tokens\n        ERC721KODACreator(address(this)).transferFrom(\n            ownerOf(tokenId),\n            _recipient,\n            tokenId\n        );\n    }\n\n    function _facilitateOpenEditionSale(\n        uint256 _editionId,\n        address _recipient\n    ) internal virtual returns (uint256) {\n        // Mint the token on demand\n        uint256 tokenId = _mintSingleOpenEditionTo(_editionId, _recipient);\n\n        // Return the token ID\n        return tokenId;\n    }\n\n    function _getNextAvailablePrimarySaleToken(\n        uint256 _editionId,\n        uint256 _startId\n    ) internal view virtual returns (uint256) {\n        unchecked {\n            // high to low\n            for (_startId; _startId >= _editionId; --_startId) {\n                // if no owner set - assume primary if not moved\n                if (_owners[_startId] == address(0)) {\n                    return _startId;\n                }\n            }\n        }\n\n        revert(\"Primary market exhausted\");\n    }\n\n    // * Validators * //\n\n    /// @dev validates that msg.sender is the contract owner or additional minter\n    function _onlyApprovedMinter() internal virtual {\n        if (msg.sender == owner()) return;\n        if (additionalMinterEnabled[msg.sender]) return;\n        revert NotAuthorised();\n    }\n\n    /// @dev validates that msg.sender is the contract owner or additional creator\n    function _onlyApprovedCreator() internal virtual {\n        if (msg.sender == owner()) return;\n        if (additionalCreatorEnabled[msg.sender]) return;\n        revert NotAuthorised();\n    }\n}\n"
      },
      "contracts/ERC721/ERC721KODAEditions.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\n\nimport {IERC721KODAEditions} from \"./interfaces/IERC721KODAEditions.sol\";\nimport {ITokenUriResolver} from \"../interfaces/ITokenUriResolver.sol\";\n\nimport {KODABaseUpgradeable} from \"../KODABaseUpgradeable.sol\";\n\n/**\n * @author KnownOrigin Labs - https://knownorigin.io/\n * @dev Base contract which extends the ERC721 NFT standards with edition-based minting logic\n */\nabstract contract ERC721KODAEditions is\n    KODABaseUpgradeable,\n    IERC721KODAEditions\n{\n    // * ERC721 State * //\n\n    bytes4 internal constant ERC721_RECEIVED =\n        bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"));\n\n    /// @notice Token name\n    string public name;\n\n    /// @notice Token symbol\n    string public symbol;\n\n    /// @dev Mapping of tokenId => owner - only set on first transfer (after mint) such as a primary sale and/or gift\n    mapping(uint256 => address) internal _owners;\n\n    /// @dev Mapping of owner => number of tokens owned\n    mapping(address => uint256) internal _balances;\n\n    /// @dev Mapping of owner => operator => approved\n    mapping(address => mapping(address => bool)) internal _operatorApprovals;\n\n    /// @dev Mapping of tokenId => approved address\n    mapping(uint256 => address) internal _tokenApprovals;\n\n    // * Custom State * //\n\n    /// @dev ownership of latest editions recorded when contract ownership is transferred\n    EditionOwnership[] internal _editionOwnerships;\n\n    /// @notice Token URI resolver\n    ITokenUriResolver public tokenUriResolver;\n\n    /// @notice Original deployer of the 721 NFT\n    address public originalDeployer;\n\n    /// @dev tokens are minted in batches - the first token ID used is representative of the edition ID\n    mapping(uint256 => Edition) internal _editions;\n\n    /// @dev Given an edition ID, if the result is not address(0) then a specific creator has been set for an edition\n    mapping(uint256 => address) internal _editionCreator;\n\n    /// @dev The number of tokens minted from an open edition\n    mapping(uint256 => uint256) internal _editionMintedCount;\n\n    /// @dev For any given edition ID will be non zero if set by the contract owner for an edition\n    mapping(uint256 => uint256) internal _editionRoyaltyPercentage;\n\n    /// @dev Allows a creator to disable sales of their edition\n    mapping(uint256 => bool) internal _editionSalesDisabled;\n\n    /// @dev determines the maximum size and the next starting ID for each edition i.e. each edition starts at a multiple of 100,000\n    uint32 public constant MAX_EDITION_SIZE = 100_000;\n\n    /**\n     * @notice Next Edition ID\n     * @dev the ID of the edition that will be created next\n     */\n    uint256 public nextEditionId;\n\n    // ************* //\n    // * MODIFIERS * //\n    // ************* //\n\n    modifier onlyEditionOwner(uint256 _editionId) {\n        _onlyEditionOwner(_editionId);\n        _;\n    }\n\n    modifier onlyExistingEdition(uint256 _editionId) {\n        _onlyExistingEdition(_editionId);\n        _;\n    }\n\n    modifier onlyExistingToken(uint256 _tokenId) {\n        _onlyExistingToken(_tokenId);\n        _;\n    }\n\n    modifier onlyOpenEdition(uint256 _editionId) {\n        _onlyOpenEdition(_editionId);\n        _;\n    }\n\n    modifier onlyOpenEditionFromTokenId(uint256 _tokenId) {\n        uint256 editionId = _tokenEditionId(_tokenId);\n        _onlyOpenEdition(editionId);\n        _;\n    }\n\n    modifier validateEdition(uint256 _editionId) {\n        _validateEdition(_editionId);\n        _;\n    }\n\n    // ********** //\n    // * PUBLIC * //\n    // ********** //\n\n    /**\n     * @notice Count all NFTs assigned to an owner\n     * @dev NFTs assigned to the zero address are considered invalid, and this\n     *      function throws for queries about the zero address.\n     * @param _owner An address for whom to query the balance\n     * @return uint256 The number of NFTs owned by `_owner`, possibly zero\n     */\n    function balanceOf(address _owner) public view override returns (uint256) {\n        require(_owner != address(0), \"Invalid owner\");\n        return _owner == owner() ? _balances[_owner] - 1 : _balances[_owner];\n    }\n\n    // * Approvals * //\n\n    /**\n     * @notice Change or reaffirm the approved address for an NFT\n     * @dev The zero address indicates there is no approved address.\n     *      Throws unless `msg.sender` is the current NFT owner, or an authorized\n     *      operator of the current owner.\n     * @param _approved The new approved NFT controller\n     * @param _tokenId The NFT to approve\n     */\n    function approve(address _approved, uint256 _tokenId) external override {\n        address owner = ownerOf(_tokenId);\n        require(_approved != owner, \"Approved is owner\");\n        require(\n            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n            \"Invalid sender\"\n        );\n\n        _approve(owner, _approved, _tokenId);\n    }\n\n    /**\n     * @notice Get the approved address for a single NFT\n     * @dev Throws if `_tokenId` is not a valid NFT.\n     * @param _tokenId The NFT to find the approved address for\n     * @return address The approved address for this NFT, or the zero address if there is none\n     */\n    function getApproved(\n        uint256 _tokenId\n    ) public view override returns (address) {\n        require(\n            _exists(_tokenId),\n            \"ERC721: approved query for nonexistent token\"\n        );\n        return _tokenApprovals[_tokenId];\n    }\n\n    /**\n     * @notice Query if an address is an authorized operator for another address\n     * @param _owner The address that owns the NFTs\n     * @param _operator The address that acts on behalf of the owner\n     * @return True if `_operator` is an approved operator for `_owner`, false otherwise\n     */\n    function isApprovedForAll(\n        address _owner,\n        address _operator\n    ) public view override returns (bool) {\n        return _operatorApprovals[_owner][_operator];\n    }\n\n    /**\n     * @notice Enable or disable approval for a third party (\"operator\") to manage\n     *         all of `msg.sender`\"s assets\n     * @dev Emits the ApprovalForAll event. The contract MUST allow\n     *      multiple operators per owner.\n     * @param _operator Address to add to the set of authorized operators\n     * @param _approved True if the operator is approved, false to revoke approval\n     */\n    function setApprovalForAll(\n        address _operator,\n        bool _approved\n    ) public override {\n        require(_msgSender() != _operator, \"ERC721: approve to caller\");\n        _operatorApprovals[_msgSender()][_operator] = _approved;\n        emit ApprovalForAll(_msgSender(), _operator, _approved);\n    }\n\n    // * Transfers * //\n\n    /**\n     * @notice An extension to the default ERC721 behaviour, derived from ERC-875.\n     * @dev Allowing for batch transfers from the provided address, will fail if from does not own all the tokens\n     * @param _from the address to transfer tokens from\n     * @param _to the address to transfer tokens to\n     * @param _tokenIds list of token IDs to transfer\n     */\n    function batchTransferFrom(\n        address _from,\n        address _to,\n        uint256[] calldata _tokenIds\n    ) public override {\n        for (uint256 i = 0; i < _tokenIds.length; i++) {\n            _safeTransferFrom(_from, _to, _tokenIds[i], bytes(\"\"));\n        }\n    }\n\n    /**\n     * @notice Transfers the ownership of an NFT from one address to another address\n     * @dev This works identically to the other function with an extra data parameter, except this function just sets data to \"\".\n     * @param _from The current owner of the NFT\n     * @param _to The new owner\n     * @param _tokenId The NFT to transfer\n     */\n    function safeTransferFrom(\n        address _from,\n        address _to,\n        uint256 _tokenId\n    ) public override {\n        _safeTransferFrom(_from, _to, _tokenId, bytes(\"\"));\n    }\n\n    /**\n     * @notice Transfers the ownership of an NFT from one address to another address\n     * @dev Throws unless `msg.sender` is the current owner, an authorized\n     *      operator, or the approved address for this NFT. Throws if `_from` is\n     *      not the current owner. Throws if `_to` is the zero address. Throws if\n     *      `_tokenId` is not a valid NFT. When transfer is complete, this function\n     *      checks if `_to` is a smart contract (code size > 0). If so, it calls\n     *      {onERC721Received} on `_to` and throws if the return value is not\n     *      `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n     * @param _from The current owner of the NFT\n     * @param _to The new owner\n     * @param _tokenId The NFT to transfer\n     * @param _data Additional data with no specified format, sent in call to `_to`\n     */\n    function safeTransferFrom(\n        address _from,\n        address _to,\n        uint256 _tokenId,\n        bytes calldata _data\n    ) public override {\n        _safeTransferFrom(_from, _to, _tokenId, _data);\n    }\n\n    /**\n     * @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n     *          TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n     *          THEY MAY BE PERMANENTLY LOST\n     *  @dev Throws unless `_msgSender()` is the current owner, an authorized\n     *       operator, or the approved address for this NFT. Throws if `_from` is\n     *       not the current owner. Throws if `_to` is the zero address. Throws if\n     *       `_tokenId` is not a valid NFT.\n     *  @param _from The current owner of the NFT\n     *  @param _to The new owner\n     *  @param _tokenId The NFT to transfer\n     */\n    function transferFrom(\n        address _from,\n        address _to,\n        uint256 _tokenId\n    ) public override {\n        _transferFrom(_from, _to, _tokenId);\n    }\n\n    // * Editions * //\n\n    /**\n     * @notice Edition Creator Address\n     * @dev returns the address of the creator of works associated with an edition\n     * @param _editionId the ID of the edition\n     * @return address the address of the creator of the works associated with the edition\n     */\n    function editionCreator(\n        uint256 _editionId\n    ) public view override onlyExistingEdition(_editionId) returns (address) {\n        return\n            _editionCreator[_editionId] == address(0)\n                ? editionOwner(_editionId)\n                : _editionCreator[_editionId];\n    }\n\n    /**\n     * @notice Get Edition Details\n     * @dev returns the full edition details\n     * @param _editionId the ID of the edition\n     * @return EditionDetails the full set of properties of the edition\n     */\n    function editionDetails(\n        uint256 _editionId\n    )\n        public\n        view\n        override\n        onlyExistingEdition(_editionId)\n        returns (EditionDetails memory)\n    {\n        return\n            EditionDetails(\n                editionOwner(_editionId), // edition owner\n                editionCreator(_editionId), // edition creator\n                _editionId,\n                editionMintedCount(_editionId),\n                editionSize(_editionId),\n                isOpenEdition(_editionId),\n                editionURI(_editionId)\n            );\n    }\n\n    /**\n     * @notice Check if an Edition Exists\n     * @dev returns whether edition with id `_editionId` exists or not\n     * @param _editionId the ID of the edition\n     * @return bool does the edition exist\n     */\n    function editionExists(\n        uint256 _editionId\n    ) public view override returns (bool) {\n        return _editionExists(_editionId);\n    }\n\n    /**\n     * @notice Maximum Token ID of an Edition\n     * @dev returns the last token ID of edition `_editionId` based on the edition's size\n     * @param _editionId the ID of the edition\n     * @return uint256 the maximum possible token ID\n     */\n    function editionMaxTokenId(\n        uint256 _editionId\n    ) public view override onlyExistingEdition(_editionId) returns (uint256) {\n        return _editionMaxTokenId(_editionId);\n    }\n\n    /**\n     * @notice Edition Minted Count\n     * @dev returns the number of tokens minted for an edition - returns edition size if count is 0 but a token has been minted due to assumed batch mint\n     * @param _editionId the id of the edition to get a count for\n     * @return uint256 the number of tokens minted in the edition\n     */\n    function editionMintedCount(\n        uint256 _editionId\n    ) public view override onlyExistingEdition(_editionId) returns (uint256) {\n        uint256 count = _editionMintedCount[_editionId];\n        if (count > 0) return count;\n\n        if (!_editions[_editionId].isOpenEdition)\n            return editionSize(_editionId);\n\n        return 0;\n    }\n\n    /**\n     * @notice Edition Owner\n     * @dev calculates the owner of an edition from recorded ownerships - falls back to current contract owner\n     * @param _editionId the id of the edition to get the owner of\n     * @return address the address of the edition owner\n     */\n    function editionOwner(\n        uint256 _editionId\n    ) public view override returns (address) {\n        if (!_editionExists(_editionId)) return address(0);\n\n        uint256 count = _editionOwnerships.length;\n        if (count == 0) return owner();\n\n        unchecked {\n            // the maximum number of ownerships that need checking = the number of editions from the current one to the end\n            uint256 toCheck = (nextEditionId - _editionId) / MAX_EDITION_SIZE;\n\n            uint256 i;\n            // if less (or equal) need checking than the number of ownerships recorded, only check the latest ownerships\n            if (toCheck < count) {\n                i = count - toCheck;\n            }\n\n            for (i; i < count; i++) {\n                if (_editionId <= _editionOwnerships[i].editionId) {\n                    return _editionOwnerships[i].editionOwner;\n                }\n            }\n        }\n\n        return owner();\n    }\n\n    /**\n     * @notice Edition Royalty Percentage\n     * @dev returns the default secondary sale royalty percentage or a stored override value if set\n     * @param _editionId the id of the edition to get the royalty percentage for\n     * @return uint256 the royalty percentage value for the edition\n     */\n    function editionRoyaltyPercentage(\n        uint256 _editionId\n    ) public view override onlyExistingEdition(_editionId) returns (uint256) {\n        uint256 royaltyOverride = _editionRoyaltyPercentage[_editionId];\n        return\n            royaltyOverride == 0 ? defaultRoyaltyPercentage : royaltyOverride;\n    }\n\n    /**\n     * @notice Check if Edition Primary Sales are Disabled\n     * @dev returns whether or not primary sales of an edition are disabled\n     * @param _editionId the ID of the edition\n     * @return bool primary sales are disabled\n     */\n    function editionSalesDisabled(\n        uint256 _editionId\n    ) public view override onlyExistingEdition(_editionId) returns (bool) {\n        return _editionSalesDisabled[_editionId];\n    }\n\n    /**\n     * @notice Edition Primary Sale Possible\n     * @dev combines the logic of {editionSalesDisabled} and {editionSoldOut}\n     * @param _editionId the ID of the edition\n     * @return bool is a primary sale of the edition possible\n     */\n    function editionSalesDisabledOrSoldOut(\n        uint256 _editionId\n    ) public view override onlyExistingEdition(_editionId) returns (bool) {\n        return _editionSalesDisabled[_editionId] || _editionSoldOut(_editionId);\n    }\n\n    /**\n     * @notice Edition Primary Sale Possible\n     * @dev combines the logic of {editionSalesDisabled} and {editionSoldOut}\n     * @param _editionId the ID of the edition\n     * @param _startId the ID of the token to start checking from\n     * @return bool is a primary sale of the edition possible\n     */\n    function editionSalesDisabledOrSoldOutFrom(\n        uint256 _editionId,\n        uint256 _startId\n    ) public view override onlyExistingEdition(_editionId) returns (bool) {\n        return\n            _editionSalesDisabled[_editionId] ||\n            _editionSoldOutFrom(_editionId, _startId, 0);\n    }\n\n    /**\n     * @notice Edition Size\n     * @dev returns the maximum number of tokens that CAN BE minted in an edition\n     *\n     * - see {editionMintedCount} for the number of tokens minted in an edition so far\n     *\n     * @param _editionId the id of the edition\n     * @return uint256 the size of the edition\n     */\n    function editionSize(\n        uint256 _editionId\n    ) public view override returns (uint256) {\n        return _editions[_editionId].editionSize;\n    }\n\n    /**\n     * @notice Is the Edition Sold Out\n     * @dev returns whether on not primary sales are still possible for an edition\n     * @param _editionId the ID of the edition\n     * @return bool the edition is sold out\n     */\n    function editionSoldOut(\n        uint256 _editionId\n    ) public view override onlyExistingEdition(_editionId) returns (bool) {\n        return _editionSoldOut(_editionId);\n    }\n\n    /**\n     * @notice Is the Edition Sold Out after a specific tokenId\n     * @dev returns whether on not all tokens have been sold or transferred after `_startId`\n     * @param _editionId the ID of the edition\n     * @param _startId the ID of the token to start checking from\n     * @return bool the edition is sold out from the startId pointer\n     */\n    function editionSoldOutFrom(\n        uint256 _editionId,\n        uint256 _startId\n    ) public view override onlyExistingEdition(_editionId) returns (bool) {\n        return _editionSoldOutFrom(_editionId, _startId, 0);\n    }\n\n    /**\n     * @notice Edition URI\n     * @dev returns the URI for edition metadata - possibly the metadata for the first token if an external resolver is set\n     * @param _editionId the ID of the edition\n     * @return string the URI for the edition metadata\n     */\n    function editionURI(\n        uint256 _editionId\n    )\n        public\n        view\n        override\n        onlyExistingEdition(_editionId)\n        returns (string memory)\n    {\n        // Here we are checking only that the edition has a edition level resolver - there may be a overridden token level resolver\n        if (\n            tokenUriResolverActive() &&\n            tokenUriResolver.isDefined(_editionId, 0)\n        ) {\n            return tokenUriResolver.tokenURI(_editionId, 0);\n        }\n\n        return _editions[_editionId].uri;\n    }\n\n    /**\n     * @notice Is Edition Open?\n     * @dev returns whether or not an edition has tokens available to be minted\n     * @param _editionId the ID of the edition check\n     * @return bool is the edition open\n     */\n    function isOpenEdition(uint256 _editionId) public view returns (bool) {\n        return editionMintedCount(_editionId) < editionSize(_editionId);\n    }\n\n    // * Tokens * //\n\n    /**\n     * @notice Check the Existence of a Token\n     * @dev returns whether or not a token exists with ID `_tokenID`\n     * @param _tokenId the ID of the token\n     * @return bool the token exists\n     */\n    function exists(uint256 _tokenId) public view returns (bool) {\n        return _exists(_tokenId);\n    }\n\n    /**\n     * @notice Find the owner of an NFT\n     * @dev NFTs assigned to zero address are considered invalid, and queries about them do throw.\n     * @param _tokenId The identifier for an NFT\n     * @return address The address of the owner of the NFT\n     */\n    function ownerOf(uint256 _tokenId) public view override returns (address) {\n        uint256 editionId = _tokenEditionId(_tokenId);\n        address owner = _ownerOf(_tokenId, editionId);\n        if (owner == address(0)) revert TokenDoesNotExist();\n        return owner;\n    }\n\n    /**\n     * @notice Creator of the Works of an Edition Token\n     * @dev returns the creator associated with the works of an edition\n     * @param _tokenId the ID of the token in an edition\n     * @return address the address of the creator\n     */\n    function tokenEditionCreator(\n        uint256 _tokenId\n    ) public view override onlyExistingToken(_tokenId) returns (address) {\n        return editionCreator(_tokenEditionId(_tokenId));\n    }\n\n    /**\n     * @notice Get Edition Details for a Token\n     * @dev returns the full edition details for a token\n     * @param _tokenId the ID of a token in an edition\n     * @return EditionDetails the full set of properties for the edition\n     */\n    function tokenEditionDetails(\n        uint256 _tokenId\n    )\n        public\n        view\n        override\n        onlyExistingToken(_tokenId)\n        returns (EditionDetails memory)\n    {\n        return editionDetails(_tokenEditionId(_tokenId));\n    }\n\n    /**\n     * @notice Get the Edition ID of a Token\n     * @dev returns the ID of the edition the token belongs to\n     * @param _tokenId the ID of a token in an edition\n     * @return uint256 the ID of the edition the token belongs to\n     */\n    function tokenEditionId(\n        uint256 _tokenId\n    ) public view override onlyExistingToken(_tokenId) returns (uint256) {\n        return _tokenEditionId(_tokenId);\n    }\n\n    /**\n     * @notice Get the Size of an Edition for a Token\n     * @dev returns the size of the edition the token belongs to, see {editionSize}\n     * @param _tokenId the ID of a token in an edition\n     * @return uint256 the size of the edition the token belongs to\n     */\n    function tokenEditionSize(\n        uint256 _tokenId\n    ) public view override onlyExistingToken(_tokenId) returns (uint256) {\n        return editionSize(_tokenEditionId(_tokenId));\n    }\n\n    /**\n     * @notice Get the URI of the Metadata for a Token\n     * @dev returns the URI of the token metadata or the metadata for the edition the token belongs to if an external resolver is not set\n     * @param _tokenId the ID of a token in an edition\n     * @return string the URI of the token or edition metadata\n     */\n    function tokenURI(\n        uint256 _tokenId\n    ) public view onlyExistingToken(_tokenId) returns (string memory) {\n        uint256 editionId = _tokenEditionId(_tokenId);\n\n        if (\n            tokenUriResolverActive() &&\n            tokenUriResolver.isDefined(editionId, _tokenId)\n        ) {\n            return tokenUriResolver.tokenURI(editionId, _tokenId);\n        }\n\n        return _editions[editionId].uri;\n    }\n\n    /**\n     * @notice Token URI Resolver Active\n     * @dev return whether or not an external URI resolver has been set\n     * @return bool is a token URI resolver set\n     */\n    function tokenUriResolverActive() public view override returns (bool) {\n        return address(tokenUriResolver) != address(0);\n    }\n\n    // ********* //\n    // * OWNER * //\n    // ********* //\n\n    /**\n     * @notice Enable/Disable Edition Sales\n     * @dev allows the owner of the contract to enable/disable primary sales of an edition\n     * @param _editionId the ID of the edition to enable/disable primary sales of\n     *\n     * Emits {EditionSalesDisabledUpdated}\n     */\n    function toggleEditionSalesDisabled(\n        uint256 _editionId\n    ) public override onlyEditionOwner(_editionId) {\n        bool disabled = !_editionSalesDisabled[_editionId];\n        _editionSalesDisabled[_editionId] = disabled;\n        emit EditionSalesDisabledUpdated(_editionId, disabled);\n    }\n\n    /**\n     * @notice Update Edition Creator\n     * @dev allows the contact owner to provide edition attribution to another address\n     * @param _editionId the ID of the edition to set a creator for\n     * @param _creator the address of the creator associated with the works of an edition\n     *\n     * Emits {EditionCreatorUpdated}\n     */\n    function updateEditionCreator(\n        uint256 _editionId,\n        address _creator\n    ) public override onlyOwner {\n        _updateEditionCreator(_editionId, _creator);\n    }\n\n    /**\n     * @notice Update Secondary Royalty Percentage for an Edition\n     * @dev allows the contract owner to set an edition level override for secondary royalties of a specific edition\n     * @param _editionId the ID of the edition\n     * @param _percentage the secondary royalty percentage using the same precision as {MODULO}\n     *\n     * Emits {EditionRoyaltyPercentageUpdated}\n     */\n    function updateEditionRoyaltyPercentage(\n        uint256 _editionId,\n        uint256 _percentage\n    ) public override onlyEditionOwner(_editionId) {\n        if (_percentage > MAX_ROYALTY_PERCENTAGE)\n            revert MaxRoyaltyPercentageExceeded();\n        _editionRoyaltyPercentage[_editionId] = _percentage;\n        emit EditionRoyaltyPercentageUpdated(_editionId, _percentage);\n    }\n\n    /**\n     * @notice Update Token URI Resolver\n     * @dev allows the contract owner to update the token URI resolver for editions and tokens\n     * @param _tokenUriResolver address of the token URI resolver contract\n     *\n     * Emits {TokenURIResolverUpdated}\n     */\n    function updateTokenURIResolver(\n        ITokenUriResolver _tokenUriResolver\n    ) public override onlyOwner {\n        tokenUriResolver = _tokenUriResolver;\n        emit TokenURIResolverUpdated(address(_tokenUriResolver));\n    }\n\n    // ************ //\n    // * INTERNAL * //\n    // ************ //\n\n    // * Editions * //\n\n    /**\n     * @dev internal function for creating editions\n     *\n     * Requirements:\n     *\n     * - the parent contract should implement logic to decide who can use this\n     * - `_editionSize` must not be 0 or greater than {Konstants-MAX_EDITION_SIZE}\n     * - `_mintQuantity` must not be greater than `_editionSize`\n     * - `_recipient` must not be `address(0)` if `mintQuantity` is greater than 0\n     *\n     * @param _editionSize the maximum number of tokens that can be minted in the edition\n     * @param _mintQuantity the number of tokens to mint immediately\n     * @param _recipient the address to transfer any minted tokens to\n     * @param _creator an optional address to attribute the works of the edition to\n     * @param _uri the URI for the edition metadata\n     * @return uint256 the ID of the new edition that is created\n     *\n     * Emits {EditionCreated}\n     * Emits {EditionCreatorUpdated} if a `_creator` is not `address(0)`\n     * Emits {Transfer} for any tokens that are minted\n     */\n    function _createEdition(\n        uint32 _editionSize,\n        uint256 _mintQuantity,\n        address _recipient,\n        address _creator,\n        string calldata _uri\n    ) internal virtual returns (uint256) {\n        if (_editionSize == 0 || _editionSize > MAX_EDITION_SIZE)\n            revert InvalidEditionSize();\n        if (_mintQuantity > _editionSize) revert InvalidMintQuantity();\n        if (_recipient == address(0)) revert InvalidRecipient();\n\n        // configure start token ID\n        uint256 editionId = nextEditionId;\n        bool isOpen = _mintQuantity < _editionSize;\n\n        unchecked {\n            nextEditionId += MAX_EDITION_SIZE;\n        }\n\n        _editions[editionId] = Edition(_editionSize, isOpen, _uri);\n\n        emit EditionCreated(editionId);\n\n        if (_creator != address(0)) {\n            _updateEditionCreator(editionId, _creator);\n        }\n\n        if (_mintQuantity > 0) {\n            if (isOpen) _editionMintedCount[editionId] = _mintQuantity;\n            _mintConsecutive(_recipient, _mintQuantity, editionId);\n        }\n\n        return editionId;\n    }\n\n    /**\n     * @dev calculates if an edition exists\n     * - edition size is used to calculate the existence of an edition\n     * - an existing edition can't have its size set to 0\n     *\n     * @param _editionId the ID of the edition\n     * @return bool the edition exists\n     */\n    function _editionExists(uint256 _editionId) internal view returns (bool) {\n        return editionSize(_editionId) > 0;\n    }\n\n    /**\n     * @dev calculates the maximum token ID for an edition based on the edition's ID and size\n     * @param _editionId the ID of the edition\n     * @return uint256 the maximum token ID that can be minted for the edition\n     */\n    function _editionMaxTokenId(\n        uint256 _editionId\n    ) internal view returns (uint256) {\n        return _editionId + editionSize(_editionId) - 1;\n    }\n\n    /**\n     * @dev calculates whether the primary market of an an edition is exhausted\n     * @param _editionId the ID of the edition\n     * @return bool primary sales of the edition no longer possible\n     */\n    function _editionSoldOut(\n        uint256 _editionId\n    ) internal view virtual returns (bool) {\n        // isOpenEdition returns true if NOT ALL tokens in an edition have been minted, so sold out should always be false\n        if (isOpenEdition(_editionId)) {\n            return false;\n        }\n\n        // even for editions initially created as open,\n        // we should check each token for an owner once all tokens have been minted\n        // since they may have been minted by the owner to sell\n        unchecked {\n            for (\n                uint256 tokenId = _editionId;\n                tokenId <= _editionMaxTokenId(_editionId);\n                tokenId++\n            ) {\n                if (_owners[tokenId] == address(0)) return false;\n            }\n        }\n\n        return true;\n    }\n\n    /**\n     * @dev calculates whether the primary market of an an edition is exhausted in a range\n     * @param _editionId the ID of the edition\n     * @param _startId the tokenId to start checking from\n     * @param _quantity the number of tokens to check - to check a smaller range\n     * @return bool primary sales of the edition no longer possible\n     */\n    function _editionSoldOutFrom(\n        uint256 _editionId,\n        uint256 _startId,\n        uint256 _quantity\n    ) internal view virtual returns (bool) {\n        if (_startId < _editionId) revert InvalidRange();\n\n        uint256 maxTokenId = _editionMaxTokenId(_editionId);\n        if (_startId > maxTokenId) revert InvalidRange();\n\n        // if quantity 0, check all the way to the end of the edition\n        uint256 finishId = _quantity == 0\n            ? maxTokenId\n            : _startId + _quantity - 1;\n\n        // don't check beyond maxTokenId\n        if (finishId > maxTokenId) finishId = maxTokenId;\n\n        unchecked {\n            for (uint256 tokenId = _startId; tokenId <= finishId; tokenId++) {\n                if (_owners[tokenId] == address(0)) return false;\n            }\n        }\n\n        return true;\n    }\n\n    /**\n     * @dev minting of multiple tokens of open edition `_editionId` to the edition owner\n     * @dev optimised by not storing token ownership address which is accounted for in _ownerOf()\n     *\n     * Requirements:\n     *\n     * - only valid for open editions\n     * - mints must not exceed the edition size\n     *\n     * @param _editionId the edition that the token is a member of\n     * @param _quantity the number of tokens to mint\n     */\n    function _mintMultipleOpenEditionToOwner(\n        uint256 _editionId,\n        uint256 _quantity\n    ) internal virtual {\n        if (!_editions[_editionId].isOpenEdition)\n            revert BatchOrUnknownEdition();\n        address _owner = editionOwner(_editionId);\n\n        unchecked {\n            uint256 mintedCount = _editionMintedCount[_editionId];\n            if (mintedCount + _quantity > editionSize(_editionId))\n                revert EditionSizeExceeded();\n\n            _editionMintedCount[_editionId] += _quantity;\n            _balances[_owner] += _quantity; // unlikely to exceed 2 ^ 256 - 1\n\n            uint256 firstTokenId = _editionId + mintedCount;\n            for (uint256 i = 0; i < _quantity; i++) {\n                _mintTransferToOwner(_owner, firstTokenId + i);\n            }\n        }\n    }\n\n    /**\n     * @dev mints a single token of open edition `_editionId` to `_recipient`\n     *\n     * Requirements:\n     *\n     * - recipient is not the zero address\n     * - only valid for open editions\n     * - mints must not exceed the edition size\n     *\n     * @param _recipient the address to transfer the minted token to\n     * @param _editionId the edition that the token is a member of\n     * @return uint256 the minted token ID\n     */\n    function _mintSingleOpenEditionTo(\n        uint256 _editionId,\n        address _recipient\n    ) internal virtual returns (uint256) {\n        if (_recipient == address(0)) revert InvalidRecipient();\n        _onlyOpenEdition(_editionId);\n\n        unchecked {\n            uint256 mintedCount = _editionMintedCount[_editionId];\n\n            // Get next token ID for sale\n            uint256 tokenId = _editionId + mintedCount;\n\n            _editionMintedCount[_editionId] += 1;\n\n            _mintSingle(_recipient, tokenId);\n            return tokenId;\n        }\n    }\n\n    /**\n     * @dev sets the address of the creator of works associated with an edition\n     * @param _editionId the ID of the edition\n     * @param _creator the address of the creator\n     *\n     * Emits {EditionCreatorUpdated}\n     */\n    function _updateEditionCreator(\n        uint256 _editionId,\n        address _creator\n    ) internal virtual {\n        _editionCreator[_editionId] = _creator;\n        emit EditionCreatorUpdated(_editionId, _creator);\n    }\n\n    // * Tokens * //\n\n    /**\n     * @dev Approve `_approved` to operate on `_tokenId`\n     *\n     * Emits an {Approval} event.\n     */\n    function _approve(\n        address _owner,\n        address _approved,\n        uint256 _tokenId\n    ) internal virtual {\n        _tokenApprovals[_tokenId] = _approved;\n        emit Approval(_owner, _approved, _tokenId);\n    }\n\n    /// @dev Hook that is called before any token transfer. This includes minting and burning\n    function _beforeTokenTransfer(\n        address _from,\n        address _to,\n        uint256 _tokenId\n    ) internal virtual {}\n\n    /// @dev Hook that is called after any token transfer. This includes minting and burning\n    function _afterTokenTransfer(\n        address _from,\n        address _to,\n        uint256 _tokenId\n    ) internal virtual {}\n\n    /**\n     * @dev returns the existence of a token by checking for an owner\n     * @param _tokenId the token ID to check\n     * @return bool the token exists\n     */\n    function _exists(uint256 _tokenId) internal view returns (bool) {\n        return _ownerOf(_tokenId, _tokenEditionId(_tokenId)) != address(0);\n    }\n\n    /**\n     * @dev returns the address of the owner of a token\n     * - Newly created editions and its tokens minted to a creator don't have the owner set until the token is sold on the primary market\n     * - Therefore, if internally an edition exists and owner of token is zero address, then creator still owns the token\n     * - Otherwise, the token owner is returned or the zero address if the token does not exist\n     *\n     * @param _tokenId the ID of the token to check\n     * @param _editionId the ID of the edition the token belongs to\n     * @return address the address of the token owner\n     */\n    function _ownerOf(\n        uint256 _tokenId,\n        uint256 _editionId\n    ) internal view virtual returns (address) {\n        // If an owner assigned\n        address _owner = _owners[_tokenId];\n        if (_owner != address(0)) {\n            return _owner;\n        }\n\n        address _editionOwner = editionOwner(_editionId);\n\n        if (_editionOwner != address(0)) {\n            // if not open edition, return owner\n            if (!_editions[_editionId].isOpenEdition) {\n                return _editionOwner;\n            }\n\n            // if open edition, return owner below minted count, return 0 above minted count\n            if (_tokenId < _editionId + _editionMintedCount[_editionId]) {\n                return _editionOwner;\n            }\n        }\n\n        return address(0);\n    }\n\n    /**\n     * @dev calculates the edition ID using the token ID given and MAX_EDITION_SIZE\n     * @param _tokenId the ID of the token to get edition ID for\n     * @return uint256 the ID of the edition the token is from\n     */\n    function _tokenEditionId(uint256 _tokenId) internal pure returns (uint256) {\n        return (_tokenId / MAX_EDITION_SIZE) * MAX_EDITION_SIZE;\n    }\n\n    // * Contract Ownership * //\n\n    /// @dev override {Ownable-_transferOwnership} to record the old owner as the current edition owner if not already recorded\n    function _transferOwnership(address _newOwner) internal virtual override {\n        // record the edition owner of the most recent edition\n        if (nextEditionId > MAX_EDITION_SIZE) {\n            _recordLatestEditionOwnership(owner());\n        }\n\n        super._transferOwnership(_newOwner);\n    }\n\n    // * Validators * //\n\n    function _onlyEditionOwner(uint256 _editionId) internal view {\n        if (msg.sender == editionOwner(_editionId)) return;\n        revert NotAuthorised();\n    }\n\n    /// @dev reverts if the edition does not exist\n    function _onlyExistingEdition(uint256 _editionId) internal view {\n        if (!_editionExists(_editionId)) revert EditionDoesNotExist();\n    }\n\n    /// @dev reverts if the token does not exist\n    function _onlyExistingToken(uint256 _tokenId) internal view {\n        if (!_exists(_tokenId)) revert TokenDoesNotExist();\n    }\n\n    /// @dev reverts if the edition is not open\n    function _onlyOpenEdition(uint256 _editionId) internal view {\n        if (!isOpenEdition(_editionId)) revert BatchOrUnknownEdition();\n    }\n\n    /// @dev reverts if the edition is not valid\n    function _validateEdition(uint256 _editionId) internal view virtual {\n        _onlyExistingEdition(_editionId);\n    }\n\n    // *********** //\n    // * PRIVATE * //\n    // *********** //\n\n    // * Edition Ownership * //\n\n    /**\n     * @dev records the editionOwnership of the most recent edition if not already recorded\n     *\n     * - must only be used when at least one edition has been minted\n     */\n    function _recordLatestEditionOwnership(address _editionOwner) private {\n        uint256 count = _editionOwnerships.length;\n        uint256 _editionId = nextEditionId - MAX_EDITION_SIZE;\n\n        if (count == 0) {\n            _editionOwnerships.push(\n                EditionOwnership(_editionId, _editionOwner)\n            );\n            return;\n        }\n\n        uint256 lastOwnershipId = _editionOwnerships[count - 1].editionId;\n        bool ownershipNotRecorded = lastOwnershipId != _editionId;\n        if (ownershipNotRecorded) {\n            _editionOwnerships.push(\n                EditionOwnership(_editionId, _editionOwner)\n            );\n        }\n    }\n\n    // * Minting * //\n\n    /**\n     * @dev Mints multiple consecutive tokens starting at and including the first specified ID - must be pre-validated\n     * @param _recipient address to mint to\n     * @param _quantity the number of tokens to mint\n     * @param _firstTokenId the token to start minting from\n     */\n    function _mintConsecutive(\n        address _recipient,\n        uint256 _quantity,\n        uint256 _firstTokenId\n    ) private {\n        unchecked {\n            _balances[_recipient] += _quantity; // unlikely to exceed 2 ^ 256 - 1\n\n            if (_recipient == owner()) {\n                for (uint256 i = 0; i < _quantity; i++) {\n                    _mintTransferToOwner(_recipient, _firstTokenId + i);\n                }\n            } else {\n                for (uint256 i = 0; i < _quantity; i++) {\n                    _mintTransfer(_recipient, _firstTokenId + i);\n                }\n            }\n        }\n    }\n\n    /**\n     * @notice Mint a Single Token ID\n     * @dev Mint a token with the specified tokenId and update the recipient balance - must be pre-validated\n     * @param _recipient address to mint to\n     * @param _tokenId id of the token to mint\n     */\n    function _mintSingle(address _recipient, uint256 _tokenId) private {\n        unchecked {\n            _balances[_recipient] += 1; // unlikely to exceed 2 ^ 256 - 1\n            _mintTransfer(_recipient, _tokenId);\n        }\n    }\n\n    /**\n     * @notice Mint Transfer\n     * @dev Transfer logic of minting a token - should be pre-validated and update balance in parent function\n     * @param _recipient address to mint to\n     * @param _tokenId id of the token to mint\n     */\n    function _mintTransfer(address _recipient, uint256 _tokenId) private {\n        _beforeTokenTransfer(address(0), _recipient, _tokenId);\n        _owners[_tokenId] = _recipient;\n        emit Transfer(address(0), _recipient, _tokenId);\n        _afterTokenTransfer(address(0), _recipient, _tokenId);\n    }\n\n    /**\n     * @notice Mint Transfer To Owner\n     * @dev Transfer logic of minting a token to the edition owner - should be pre-validated and update balance in parent function\n     *\n     * Requirements:\n     *\n     * - `_owner` must only ever be the owner of the edition the token belongs to\n     *\n     * @param _owner address of the edition owner\n     * @param _tokenId id of the token to mint\n     */\n    function _mintTransferToOwner(address _owner, uint256 _tokenId) private {\n        _beforeTokenTransfer(address(0), _owner, _tokenId);\n        emit Transfer(address(0), _owner, _tokenId);\n        _afterTokenTransfer(address(0), _owner, _tokenId);\n    }\n\n    // * Token Transfers * //\n\n    /// @dev performs a transfer of a token and checks for a correct response if the `_to` is a contract\n    function _safeTransferFrom(\n        address _from,\n        address _to,\n        uint256 _tokenId,\n        bytes memory _data\n    ) private {\n        _transferFrom(_from, _to, _tokenId);\n\n        uint256 receiverCodeSize;\n        assembly {\n            receiverCodeSize := extcodesize(_to)\n        }\n        if (receiverCodeSize > 0) {\n            bytes4 selector = IERC721Receiver(_to).onERC721Received(\n                _msgSender(),\n                _from,\n                _tokenId,\n                _data\n            );\n            require(selector == ERC721_RECEIVED, \"Invalid selector\");\n        }\n    }\n\n    /**\n     * @dev custom implementation of logic to transfer a token from one address to another\n     *\n     * Requirements:\n     *\n     * - `_to` must not be the zero address - we have custom logic which is optimised for minting to the contract owner\n     * - the token must have an owner i.e. CAN NOT BE USED FOR MINTING\n     * - the msg.sender must be the the current token owner, approved for all, or approved for the specific token\n     * - should call before and after transfer hooks\n     * - should clear any existing token approval\n     * - should adjust the balances of the existing and new token owner\n     *\n     * Emits {Approval}\n     * Emits {Transfer}\n     */\n    function _transferFrom(\n        address _from,\n        address _to,\n        uint256 _tokenId\n    ) private {\n        // enforce not being able to send to zero as we have explicit rules what a minted but unbound owner is\n        if (_to == address(0)) revert InvalidRecipient();\n\n        // Ensure the owner is the sender\n        address owner = _ownerOf(_tokenId, _tokenEditionId(_tokenId));\n        if (owner == address(0)) revert TokenDoesNotExist();\n        require(_from == owner, \"Owner mismatch\");\n\n        address spender = _msgSender();\n        address approvedAddress = getApproved(_tokenId);\n        require(\n            spender == owner || // sending to myself\n                isApprovedForAll(owner, spender) || // is approved to send any behalf of owner\n                approvedAddress == spender, // is approved to move this token ID\n            \"Invalid spender\"\n        );\n\n        // do before transfer check\n        _beforeTokenTransfer(_from, _to, _tokenId);\n\n        // Ensure approval for token ID is cleared\n        _approve(owner, address(0), _tokenId);\n\n        unchecked {\n            // Modify balances\n            _balances[_from] -= 1;\n            _balances[_to] += 1;\n        }\n        _owners[_tokenId] = _to;\n        emit Transfer(_from, _to, _tokenId);\n\n        // do after transfer check\n        _afterTokenTransfer(_from, _to, _tokenId);\n    }\n}\n"
      },
      "contracts/ERC721/extensions/ERC721KODACreatorWithBuyItNow.sol": {
        "content": "pragma solidity 0.8.17;\n\n// SPDX-License-Identifier: MIT\n\nimport {ERC721KODACreator} from \"../ERC721KODACreator.sol\";\nimport {IERC721KODACreatorWithBuyItNow} from \"../interfaces/IERC721KODACreatorWithBuyItNow.sol\";\n\n/// @author KnownOrigin Labs - https://knownorigin.io/\n/// @notice ERC721 KODA Creator with Embedded Primary and Secondary Buy It Now Marketplace\ncontract ERC721KODACreatorWithBuyItNow is\n    ERC721KODACreator,\n    IERC721KODACreatorWithBuyItNow\n{\n    /// @notice Edition ID -> Listing Metadata\n    mapping(uint256 => EditionListing) public editionListing;\n\n    /// @notice Token ID -> Owner Address -> Listing Metadata\n    mapping(uint256 => mapping(address => TokenListing)) public tokenListing;\n\n    // ********** //\n    // * PUBLIC * //\n    // ********** //\n\n    /// @inheritdoc ERC721KODACreator\n    function supportsInterface(\n        bytes4 interfaceId\n    ) public pure override returns (bool) {\n        return\n            interfaceId == type(IERC721KODACreatorWithBuyItNow).interfaceId ||\n            super.supportsInterface(interfaceId);\n    }\n\n    // * Marketplace * //\n\n    /**\n     * @notice Buy Edition Token\n     * @dev allows the purchase of the next available token for sale from an edition listing\n     *\n     * Requirements:\n     *\n     * - the listing must exist\n     * - the value sent must be equal to the listing price\n     * - the listing must be active i.e. the current time must be after the listing start time\n     *\n     * @param _editionId the ID of the edition to purchase a token from\n     * @param _recipient the address that should receive the token purchased\n     */\n    function buyEditionToken(\n        uint256 _editionId,\n        address _recipient\n    ) external payable override whenNotPaused nonReentrant {\n        EditionListing storage listing = editionListing[_editionId];\n        if (listing.price == 0) revert InvalidListing();\n        if (msg.value != listing.price) revert InvalidPrice();\n        if (block.timestamp < listing.startDate) revert TooEarly();\n        if (listing.endDate > 0 && block.timestamp > listing.endDate)\n            revert TooLate();\n\n        // when owner has renounced ownership, then the transfer will fail but nicer to fail early\n        address _owner = owner();\n        if (_owner == address(0)) revert EditionSalesDisabled();\n\n        // get the next token ID\n        uint256 tokenId = _facilitateNextPrimarySale(_editionId, _recipient);\n\n        address platform = kodaSettings.platform();\n        uint256 primaryPercentageForPlatform = kodaSettings\n            .platformPrimaryCommission();\n        uint256 platformProceeds = (msg.value * primaryPercentageForPlatform) /\n            MODULO;\n\n        // Where platform primary commission is zero from the settings, we don't need to execute the transaction\n        bool success;\n        if (platformProceeds > 0) {\n            (success, ) = platform.call{value: platformProceeds}(\"\");\n            if (!success) revert TransferFailed();\n        }\n\n        // send all the funds to the handler - KO is part of this\n        (success, ) = editionFundsHandler(_editionId).call{\n            value: msg.value - platformProceeds\n        }(\"\");\n        if (!success) revert TransferFailed();\n\n        emit BuyNowPurchased(tokenId, msg.sender, _owner, listing.price);\n    }\n\n    /**\n     * @notice List a Token for sale\n     * @dev allows the owner of a token to create a secondary buy it now listing\n     * @param _tokenId the ID of the token to list for sale\n     * @param _listingPrice the price to list the token for\n     * @param _startDate the time the listing is enabled\n     * @param _endDate the time the listing is disabled\n     */\n    function createTokenBuyItNowListing(\n        uint256 _tokenId,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate\n    ) external override {\n        if (_owners[_tokenId] != msg.sender) revert InvalidToken();\n        if (_listingPrice == 0) revert InvalidPrice();\n        if (tokenListing[_tokenId][msg.sender].price != 0)\n            revert AlreadyListed();\n\n        // Store listing data\n        tokenListing[_tokenId][msg.sender] = TokenListing(\n            msg.sender,\n            _listingPrice\n        );\n\n        emit ListedTokenForBuyNow(\n            msg.sender,\n            _tokenId,\n            _listingPrice,\n            _startDate,\n            _endDate\n        );\n    }\n\n    /**\n     * @notice Delist a Token for Sale\n     * @dev allows the owner of a token to remove a listing for the token\n     * @param _tokenId the ID of the token to delist\n     */\n    function deleteTokenBuyItNowListing(uint256 _tokenId) external override {\n        if (tokenListing[_tokenId][msg.sender].price == 0)\n            revert InvalidListing();\n\n        delete tokenListing[_tokenId][msg.sender];\n\n        emit BuyNowTokenDeListed(_tokenId);\n    }\n\n    /**\n     * @notice Update Token Listing Price\n     * @dev allows the owner of a token to update the price\n     * @param _tokenId the ID of the token already listed\n     * @param _listingPrice the new listing price to set\n     */\n    function updateTokenBuyItNowListingPrice(\n        uint256 _tokenId,\n        uint96 _listingPrice\n    ) external override {\n        if (tokenListing[_tokenId][msg.sender].price == 0)\n            revert InvalidListing();\n        if (ownerOf(_tokenId) != msg.sender) revert InvalidListing();\n        if (_listingPrice == 0) revert InvalidPrice();\n\n        tokenListing[_tokenId][msg.sender].price = _listingPrice;\n\n        emit BuyNowTokenPriceChanged(_tokenId, _listingPrice);\n    }\n\n    /**\n     * @notice Buy Token\n     * @dev allows the purchase of a token listed for sale\n     *\n     * Requirements:\n     *\n     * - the listing must exist\n     * - the value sent must be equal to the listing price\n     *\n     * @param _tokenId the ID of the token to purchase\n     * @param _recipient the address that should receive the token purchased\n     */\n    function buyToken(\n        uint256 _tokenId,\n        address _recipient\n    ) external payable override nonReentrant {\n        TokenListing storage listing = tokenListing[_tokenId][\n            ownerOf(_tokenId)\n        ];\n        if (listing.price == 0) revert InvalidListing();\n        if (listing.price != msg.value) revert InvalidPrice();\n\n        // calculate proceeds owed to platform, creator and seller\n        address platform = kodaSettings.platform();\n        uint256 secondaryPercentageForPlatform = kodaSettings\n            .platformSecondaryCommission();\n\n        uint256 platformProceeds = (msg.value *\n            secondaryPercentageForPlatform) / MODULO;\n        (address receiver, uint256 royaltyAmount) = royaltyInfo(\n            _tokenId,\n            msg.value\n        );\n\n        // Where platform proceeds is zero due to the settings, no need to call the transfer\n        bool success;\n        if (platformProceeds > 0) {\n            (success, ) = platform.call{value: platformProceeds}(\"\");\n            if (!success) revert TransferFailed();\n        }\n\n        if (royaltyAmount > 0) {\n            (success, ) = receiver.call{value: royaltyAmount}(\"\");\n            if (!success) revert TransferFailed();\n        }\n\n        // maximum platform commission and royalty percentage are both limited to 50% (max 100% of sale value total)\n        // it is also extremely unlikely that they will ever both use the max so no need for additional validation/conditions\n        (success, ) = listing.seller.call{\n            value: msg.value - royaltyAmount - platformProceeds\n        }(\"\");\n        if (!success) revert TransferFailed();\n\n        emit BuyNowTokenPurchased(\n            _tokenId,\n            msg.sender,\n            _recipient,\n            listing.seller,\n            listing.price\n        );\n\n        ERC721KODACreatorWithBuyItNow(address(this)).transferFrom(\n            listing.seller,\n            _recipient,\n            _tokenId\n        );\n\n        delete tokenListing[_tokenId][ownerOf(_tokenId)];\n    }\n\n    /**\n     * @notice Get the token listing details for the current token owner\n     * @dev Get a token listing just from token ID and not worrying about current owner\n     * @param _tokenId the ID of the token\n     * @return TokenListing details of the token listing\n     */\n    function getTokenListing(\n        uint256 _tokenId\n    ) external view returns (TokenListing memory) {\n        return tokenListing[_tokenId][ownerOf(_tokenId)];\n    }\n\n    // ********* //\n    // * OWNER * //\n    // ********* //\n\n    // * Editions * //\n\n    /**\n     * @notice List and Edition for Buy It Now\n     * @dev allows the edition owner to create a listing to enable sales of tokens from an edition\n     *\n     * @param _editionId the ID of the edition to create a listing for\n     * @param _listingPrice the price to list for\n     * @param _startDate the time that the listing becomes active\n     * @param _endDate the time the listing is disabled\n     */\n    function createEditionBuyItNowListing(\n        uint256 _editionId,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate\n    ) public override onlyEditionOwner(_editionId) {\n        _createEditionBuyItNowListing(\n            _editionId,\n            _listingPrice,\n            _startDate,\n            _endDate\n        );\n    }\n\n    /**\n     * @notice Delist an Edition for Sale\n     * @param _editionId the ID of the edition to delist\n     */\n    function deleteEditionBuyItNowListing(\n        uint256 _editionId\n    ) external override onlyEditionOwner(_editionId) {\n        if (editionListing[_editionId].price == 0) revert EditionNotListed();\n        delete editionListing[_editionId];\n        emit BuyNowDeListed(_editionId);\n    }\n\n    /**\n     * @notice Create and Mint an Edition and List it for Sale\n     * @dev allows the contract owner to create a pre-minted edition and immediately list it for buy it now sales\n     * @param _editionSize the size of the edition\n     * @param _listingPrice the price that tokens can be bought for\n     * @param _startDate the time that the listing should become active\n     * @param _endDate the time the listing is disabled\n     * @param _uri the metadata URI of the edition\n     * @return uint256 the ID of the new edition created\n     */\n    function mintAndListEditionForBuyNow(\n        uint32 _editionSize,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate,\n        string calldata _uri\n    ) external onlyOwner returns (uint256) {\n        // Creator override only required if there are sub-minters in addition to contract owner\n        uint256 editionId = _createEdition(\n            _editionSize,\n            _editionSize,\n            owner(),\n            address(0),\n            _uri\n        );\n        _createEditionBuyItNowListing(\n            editionId,\n            _listingPrice,\n            _startDate,\n            _endDate\n        );\n        return editionId;\n    }\n\n    /**\n     * @notice Create and Mint an Edition and List it for Sale\n     * @dev allows the contract owner to create a pre-minted edition and immediately list it for buy it now sales\n     * @param _editionSize the size of the edition\n     * @param _listingPrice the price that tokens can be bought for\n     * @param _startDate the time that the listing should become active\n     * @param _endDate the time the listing is disabled\n     * @param _collabFundsHandler the fund splitting contract\n     * @param _uri the metadata URI of the edition\n     * @return uint256 the ID of the new edition created\n     */\n    function mintAndListEditionAsCollaborationForBuyNow(\n        uint32 _editionSize,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate,\n        address _collabFundsHandler,\n        string calldata _uri\n    ) external onlyOwner returns (uint256) {\n        // Creator override only required if there are sub-minters in addition to contract owner\n        uint256 editionId = createEditionAsCollaboration(\n            _editionSize,\n            _editionSize,\n            owner(),\n            address(0),\n            _collabFundsHandler,\n            _uri\n        );\n        _createEditionBuyItNowListing(\n            editionId,\n            _listingPrice,\n            _startDate,\n            _endDate\n        );\n        return editionId;\n    }\n\n    /// @notice Setup the open edition template and list for buy it now\n    /**\n     * @notice Create an Open Edition and List it for Sale\n     * @dev allows the contract owner to create an open edition and immediately list it for buy it now sales\n     * @param _editionSize the size of the edition\n     * @param _uri the metadata URI of the edition\n     * @param _listingPrice the price that tokens can be bought for\n     * @param _startDate the time that the listing should become active\n     * @param _endDate the time the listing is disabled\n     * @return uint256 the ID of the new edition created\n     */\n    function setupAndListOpenEdition(\n        string calldata _uri,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate,\n        uint32 _editionSize\n    ) external override onlyOwner returns (uint256) {\n        uint256 editionId = _createEdition(\n            _editionSize == 0 ? MAX_EDITION_SIZE : _editionSize,\n            0,\n            owner(),\n            address(0),\n            _uri\n        );\n        _createEditionBuyItNowListing(\n            editionId,\n            _listingPrice,\n            _startDate,\n            _endDate\n        );\n        return editionId;\n    }\n\n    /// @notice Setup the open edition template and list for buy it now\n    /**\n     * @notice Create an Open Edition and List it for Sale\n     * @dev allows the contract owner to create an open edition and immediately list it for buy it now sales\n     * @param _editionSize the size of the edition\n     * @param _uri the metadata URI of the edition\n     * @param _listingPrice the price that tokens can be bought for\n     * @param _startDate the time that the listing should become active\n     * @param _endDate the time the listing is disabled\n     * @return uint256 the ID of the new edition created\n     * @param _collabFundsHandler the fund splitting contract\n     */\n    function setupAndListOpenEditionAsCollaboration(\n        string calldata _uri,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate,\n        uint32 _editionSize,\n        address _collabFundsHandler\n    ) external onlyOwner returns (uint256) {\n        uint256 editionId = createOpenEditionAsCollaboration(\n            _editionSize == 0 ? MAX_EDITION_SIZE : _editionSize,\n            _collabFundsHandler,\n            _uri\n        );\n        _createEditionBuyItNowListing(\n            editionId,\n            _listingPrice,\n            _startDate,\n            _endDate\n        );\n        return editionId;\n    }\n\n    /**\n     * @notice Update Edition Listing Price\n     * @dev allows the contract owner to update the price of edition tokens listed for sale\n     * @param _editionId the ID of the edition already listed\n     * @param _listingPrice the new listing price to set\n     */\n    function updateEditionBuyItNowListingPrice(\n        uint256 _editionId,\n        uint96 _listingPrice\n    ) external override onlyEditionOwner(_editionId) {\n        if (editionListing[_editionId].price == 0) revert EditionNotListed();\n        if (_listingPrice == 0) revert InvalidPrice();\n\n        // Set price\n        editionListing[_editionId].price = _listingPrice;\n\n        // Emit event\n        emit BuyNowPriceChanged(_editionId, _listingPrice);\n    }\n\n    // ************ //\n    // * INTERNAL * //\n    // ************ //\n\n    /**\n     * @dev create a listing to enable sales of tokens from an edition\n     *\n     * Requirements:\n     *\n     * - Should have owner validation in parent function\n     * - The edition exists\n     * - A listing does not already exist for the edition\n     * - The listing price is not less than the global minimum\n     *\n     * @param _editionId the ID of the edition to create a listing for\n     * @param _listingPrice the price to list for\n     * @param _startDate the time that the listing becomes active\n     * @param _endDate the time the listing is disabled\n     */\n    function _createEditionBuyItNowListing(\n        uint256 _editionId,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate\n    ) internal {\n        if (editionListing[_editionId].price != 0) revert AlreadyListed();\n        if (_listingPrice == 0) revert InvalidPrice();\n\n        // automatically set approval for the contract against the edition owner if not already set\n        // this is so do they do not need to do it manually in order to sell any editions they list\n        if (!_operatorApprovals[msg.sender][address(this)]) {\n            _operatorApprovals[msg.sender][address(this)] = true;\n            emit ApprovalForAll(msg.sender, address(this), true);\n        }\n\n        // Store listing data\n        editionListing[_editionId] = EditionListing(\n            _listingPrice,\n            _startDate,\n            _endDate\n        );\n\n        emit ListedEditionForBuyNow(_editionId, _listingPrice, _startDate);\n    }\n}\n"
      },
      "contracts/ERC721/extensions/ERC721KODACreatorWithBuyItNowAndFilterRegistry.sol": {
        "content": "pragma solidity 0.8.17;\n\n// SPDX-License-Identifier: MIT\n\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {ERC721KODACreatorWithBuyItNow} from \"./ERC721KODACreatorWithBuyItNow.sol\";\nimport {UpdatableOperatorFiltererUpgradeable} from \"../../operator-filter-registry/UpdatableOperatorFiltererUpgradeable.sol\";\n\n/// @author KnownOrigin Labs - https://knownorigin.io/\n/// @notice ERC721 KODA Creator with Embedded Primary and Secondary Buy It Now Marketplace\ncontract ERC721KODACreatorWithBuyItNowAndFilterRegistry is\n    ERC721KODACreatorWithBuyItNow,\n    UpdatableOperatorFiltererUpgradeable\n{\n    /// @dev Configure operator registry with init param\n    function __Module_init(\n        address _operatorRegistry,\n        address _subscriptionOrRegistrantToCopy\n    ) internal override {\n        _UpdatableOperatorFilterer_init(\n            _operatorRegistry,\n            _subscriptionOrRegistrantToCopy,\n            _subscriptionOrRegistrantToCopy != address(0)\n        );\n    }\n\n    /// @dev Required for solidity compiler due to ownable clashes\n    function owner()\n        public\n        view\n        virtual\n        override(OwnableUpgradeable, UpdatableOperatorFiltererUpgradeable)\n        returns (address)\n    {\n        return super.owner();\n    }\n\n    /// @dev Override the before transfer hook so that the operator filter can be checked against the from address\n    function _beforeTokenTransfer(\n        address _from,\n        address _to,\n        uint256 _tokenId\n    ) internal override onlyAllowedOperator(_from) {}\n}\n"
      },
      "contracts/ERC721/interfaces/IERC721KODACreator.sol": {
        "content": "pragma solidity 0.8.17;\n\n// SPDX-License-Identifier: MIT\n\n/// @author KnownOrigin Labs - https://knownorigin.io/\ninterface IERC721KODACreator {\n    error AlreadySet();\n    error EditionDisabled();\n    error EditionSizeTooLarge();\n    error EditionSizeTooSmall();\n    error EmptyString();\n    error InvalidOwner();\n    error IsOpenEdition();\n    error OwnerRevoked();\n    error PrimarySaleMade();\n    error ZeroAddress();\n\n    event EditionSizeUpdated(uint256 indexed _editionId, uint256 _editionSize);\n    event EditionFundsHandlerUpdated(\n        uint256 indexed _editionId,\n        address indexed _handler\n    );\n\n    /// @dev Function value can be more easily updated in event of an upgrade\n    function version() external pure returns (string memory);\n\n    /// @dev Returns the address that will receive sale proceeds for a given edition\n    function editionFundsHandler(\n        uint256 _editionId\n    ) external view returns (address);\n\n    /// @dev returns the ID of the next token that will be sold from a pre-minted edition\n    function getNextAvailablePrimarySaleToken(\n        uint256 _editionId\n    ) external view returns (uint256);\n\n    /// @dev returns the ID of the next token that will be sold from a pre-minted edition\n    function getNextAvailablePrimarySaleToken(\n        uint256 _editionId,\n        uint256 _startId\n    ) external view returns (uint256);\n\n    /// @dev allows the owner or additional minter to mint open edition tokens\n    function mintOpenEditionToken(\n        uint256 _editionId,\n        address _recipient\n    ) external returns (uint256);\n\n    /**\n     * @dev allows the contract owner or additional minter to mint multiple open edition tokens\n     */\n    function mintMultipleOpenEditionTokens(\n        uint256 _editionId,\n        uint256 _quantity,\n        address _recipient\n    ) external;\n\n    /// @dev Allows creation of an edition including minting a portion (or all) tokens upfront to any address and setting metadata\n    function createEdition(\n        uint32 _editionSize,\n        uint256 _mintQuantity,\n        address _recipient,\n        address _creator,\n        string calldata _uri\n    ) external returns (uint256);\n\n    /// @dev Allows creation of an edition including minting a portion (or all) tokens upfront to any address, setting metadata and a funds handler for this edition\n    function createEditionAsCollaboration(\n        uint32 _editionSize,\n        uint256 _mintQuantity,\n        address _recipient,\n        address _creator,\n        address _collabFundsHandler,\n        string calldata _uri\n    ) external returns (uint256 editionId);\n\n    /// @dev allows the contract owner to creates an edition of specified size and mints all tokens to their address\n    function createEditionAndMintToOwner(\n        uint32 _editionSize,\n        string calldata _uri\n    ) external returns (uint256);\n\n    /// @dev Allows the contract owner to create an edition of specified size for lazy minting\n    function createOpenEdition(\n        uint32 _editionSize,\n        string calldata _uri\n    ) external returns (uint256);\n\n    /// @dev Allows the contract owner to create an edition of specified size for lazy minting as a collaboration with another entity, passing in a seperate funds handler for the edition\n    function createOpenEditionAsCollaboration(\n        uint32 _editionSize,\n        address _collabFundsHandler,\n        string calldata _uri\n    ) external returns (uint256 editionId);\n\n    /// @dev Allows the contract owner to add additional minters if the appropriate minting logic is in place\n    function updateAdditionalMinterEnabled(\n        address _minter,\n        bool _enabled\n    ) external;\n\n    /// @dev Allows the contract owner to set a specific fund handler for an edition, otherwise the default for all editions is used\n    function updateEditionFundsHandler(\n        uint256 _editionId,\n        address _fundsHandler\n    ) external;\n\n    /// @dev allows the contract owner to update the number of tokens that can be minted in an edition\n    function updateEditionSize(\n        uint256 _editionId,\n        uint32 _editionSize\n    ) external;\n\n    /// @dev Provided no primary sale has been made, an artist can correct any mistakes in their token URI\n    function updateURIIfNoSaleMade(\n        uint256 _editionId,\n        string calldata _newURI\n    ) external;\n}\n"
      },
      "contracts/ERC721/interfaces/IERC721KODACreatorWithBuyItNow.sol": {
        "content": "pragma solidity 0.8.17;\n\n// SPDX-License-Identifier: MIT\n\n/// @author KnownOrigin Labs - https://knownorigin.io/\ninterface IERC721KODACreatorWithBuyItNow {\n    error AlreadyListed();\n    error EditionNotListed();\n    error EditionSalesDisabled();\n    error InvalidEdition();\n    error InvalidFeesTotal();\n    error InvalidListing();\n    error InvalidPrice();\n    error TooEarly();\n    error TooLate();\n    error TransferFailed();\n    error InvalidToken();\n\n    event BuyNowDeListed(uint256 indexed _editionId);\n\n    event BuyNowPriceChanged(uint256 indexed _editionId, uint256 _price);\n\n    event BuyNowPurchased(\n        uint256 indexed _tokenId,\n        address _buyer,\n        address _currentOwner,\n        uint256 _price\n    );\n\n    event BuyNowTokenDeListed(uint256 indexed _tokenId);\n\n    event BuyNowTokenPriceChanged(uint256 indexed _tokenId, uint256 _price);\n\n    event BuyNowTokenPurchased(\n        uint256 indexed _tokenId,\n        address _caller,\n        address _recipient,\n        address _currentOwner,\n        uint256 _price\n    );\n\n    event ListedEditionForBuyNow(\n        uint256 indexed _editionId,\n        uint96 _price,\n        uint128 _startDate\n    );\n\n    event ListedTokenForBuyNow(\n        address indexed _seller,\n        uint256 indexed _tokenId,\n        uint96 _price,\n        uint128 _startDate,\n        uint128 _endDate\n    );\n\n    struct EditionListing {\n        uint128 price;\n        uint128 startDate;\n        uint128 endDate;\n    }\n\n    struct TokenListing {\n        address seller;\n        uint128 price;\n    }\n\n    /// @dev allows the purchase of the next available token for sale from an edition listing\n    function buyEditionToken(\n        uint256 _editionId,\n        address _recipient\n    ) external payable;\n\n    /// @dev allows the owner of a token to create a secondary buy it now listing\n    function createTokenBuyItNowListing(\n        uint256 _tokenId,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate\n    ) external;\n\n    /// @dev allows the owner of a token to remove a listing for the token\n    function deleteTokenBuyItNowListing(uint256 _tokenId) external;\n\n    /// @dev allows the owner of a token to update the price\n    function updateTokenBuyItNowListingPrice(\n        uint256 _tokenId,\n        uint96 _listingPrice\n    ) external;\n\n    /// @dev allows the purchase of a token listed for sale\n    function buyToken(uint256 _tokenId, address _recipient) external payable;\n\n    /// @dev Get a token listing just from token ID and not worrying about current Owner\n    function getTokenListing(\n        uint256 _tokenId\n    ) external view returns (TokenListing memory);\n\n    /// @dev allows the contract owner to create a listing to enable sales of tokens from an edition\n    function createEditionBuyItNowListing(\n        uint256 _editionId,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate\n    ) external;\n\n    /// @dev allows the contract owner to remove an edition listing\n    function deleteEditionBuyItNowListing(uint256 _editionId) external;\n\n    /// @dev allows the contract owner to create a pre-minted edition and immediately list it for buy it now sales\n    function mintAndListEditionForBuyNow(\n        uint32 _editionSize,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate,\n        string calldata _uri\n    ) external returns (uint256);\n\n    /// @dev allows the contract owner to create an open edition and immediately list it for buy it now sales\n    function setupAndListOpenEdition(\n        string calldata _uri,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate,\n        uint32 _customMintLimit\n    ) external returns (uint256 _editionId);\n\n    /// @dev allows the contract owner to create an open edition and immediately list it for buy it now sales\n    function setupAndListOpenEditionAsCollaboration(\n        string calldata _uri,\n        uint96 _listingPrice,\n        uint128 _startDate,\n        uint128 _endDate,\n        uint32 _customMintLimit,\n        address _collabFundsHandler\n    ) external returns (uint256 _editionId);\n\n    /// @dev allows the contract owner to update the price of edition tokens listed for sale\n    function updateEditionBuyItNowListingPrice(\n        uint256 _editionId,\n        uint96 _listingPrice\n    ) external;\n}\n"
      },
      "contracts/ERC721/interfaces/IERC721KODAEditions.sol": {
        "content": "pragma solidity 0.8.17;\n\n// SPDX-License-Identifier: MIT\n\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport {IERC2981} from \"@openzeppelin/contracts/interfaces/IERC2981.sol\";\n\nimport {ITokenUriResolver} from \"../../interfaces/ITokenUriResolver.sol\";\n\n/// @author KnownOrigin Labs - https://knownorigin.io/\ninterface IERC721KODAEditions is IERC721Metadata, IERC2981 {\n    error BatchOrUnknownEdition();\n    error EditionDoesNotExist();\n    error EditionSizeExceeded();\n    error InvalidRange();\n    error InvalidEditionSize();\n    error InvalidMintQuantity();\n    error InvalidRecipient();\n    error NotAuthorised();\n    error TokenAlreadyMinted();\n    error TokenDoesNotExist();\n\n    /// @dev emitted when a new edition is created\n    event EditionCreated(uint256 indexed _editionId);\n\n    /// @dev emitted when the creator address for an edition is updated\n    event EditionCreatorUpdated(uint256 indexed _editionId, address _creator);\n\n    /// @dev emitted when the owner updates the edition override for secondary royalty\n    event EditionRoyaltyPercentageUpdated(\n        uint256 indexed _editionId,\n        uint256 _percentage\n    );\n\n    /// @dev emitted when edition sales are enabled/disabled\n    event EditionSalesDisabledUpdated(\n        uint256 indexed _editionId,\n        bool _disabled\n    );\n\n    /// @dev emitted when the edition metadata URI is updated\n    event EditionURIUpdated(uint256 indexed _editionId);\n\n    /// @dev emitted when the external token metadata URI resolver is updated\n    event TokenURIResolverUpdated(address indexed _tokenUriResolver);\n\n    /// @dev Struct defining the properties of an edition stored internally\n    struct Edition {\n        uint32 editionSize; // on-chain edition size\n        bool isOpenEdition; // true if not all tokens were minted at creation\n        string uri; // the referenced metadata\n    }\n\n    /// @dev Struct defining the full property set of an edition exposed externally\n    struct EditionDetails {\n        address owner;\n        address creator;\n        uint256 editionId;\n        uint256 mintedCount;\n        uint256 size;\n        bool isOpenEdition;\n        string uri;\n    }\n\n    /// @dev struct defining the ownership record of an edition\n    struct EditionOwnership {\n        uint256 editionId;\n        address editionOwner;\n    }\n\n    /// @dev returns the creator address for an edition used to indicate if the NFT creator is different to the contract creator/owner\n    function editionCreator(uint256 _editionId) external view returns (address);\n\n    /// @dev returns the full set of properties for an edition, see {EditionDetails}\n    function editionDetails(\n        uint256 _editionId\n    ) external view returns (EditionDetails memory);\n\n    /// @dev returns whether the edition exists or not\n    function editionExists(uint256 _editionId) external view returns (bool);\n\n    /// @dev returns the maximum possible token ID that can be minted in an edition\n    function editionMaxTokenId(\n        uint256 _editionId\n    ) external view returns (uint256);\n\n    /// @dev returns the number of tokens currently minted in an edition\n    function editionMintedCount(\n        uint256 _editionId\n    ) external view returns (uint256);\n\n    /// @dev returns the owner of an edition, by default this will be the contract owner at the time the edition was first created\n    function editionOwner(uint256 _editionId) external view returns (address);\n\n    /// @dev returns the royalty percentage used for secondary sales of an edition\n    function editionRoyaltyPercentage(\n        uint256 _editionId\n    ) external view returns (uint256);\n\n    /// @dev returns a boolean indicating whether sales are disabled or not for an edition\n    function editionSalesDisabled(\n        uint256 _editionId\n    ) external view returns (bool);\n\n    /// @dev returns a boolean indicating whether an edition is sold out (primary market) or sales are otherwise disabled\n    function editionSalesDisabledOrSoldOut(\n        uint256 _editionId\n    ) external view returns (bool);\n\n    /// @dev returns a boolean indicating whether an edition is sold out (primary market) or sales are otherwise disabled\n    function editionSalesDisabledOrSoldOutFrom(\n        uint256 _editionId,\n        uint256 _startId\n    ) external view returns (bool);\n\n    /// @dev returns the size (the maximum number of tokens that can be minted) of an edition\n    function editionSize(uint256 _editionId) external view returns (uint256);\n\n    /// @dev returns a boolean indicating whether primary listings of an edition have sold out or not\n    function editionSoldOut(uint256 _editionId) external view returns (bool);\n\n    /// @dev returns a boolean indicating whether primary listings of an edition have sold out or not in a range\n    function editionSoldOutFrom(\n        uint256 _editionId,\n        uint256 _startId\n    ) external view returns (bool);\n\n    /// @dev returns the metadata URI for an edition\n    function editionURI(\n        uint256 _editionId\n    ) external view returns (string memory);\n\n    /// @dev returns the edition creator address for the edition that a token with `_tokenId` belongs to\n    function tokenEditionCreator(\n        uint256 _tokenId\n    ) external view returns (address);\n\n    /// @dev returns the full set of properties of the edition that token `_tokenId` belongs to, see {EditionDetails}\n    function tokenEditionDetails(\n        uint256 _tokenId\n    ) external view returns (EditionDetails memory);\n\n    /// @dev returns the ID of an edition that a token with ID `_tokenId` belongs to\n    function tokenEditionId(uint256 _tokenId) external view returns (uint256);\n\n    /// @dev returns the size of the edition that a token with `_tokenId` belongs to\n    function tokenEditionSize(uint256 _tokenId) external view returns (uint256);\n\n    /// @dev returns a boolean indicating whether an external token metadata URI resolver is active or not\n    function tokenUriResolverActive() external view returns (bool);\n\n    /// @dev used to execute a simultaneous transfer of multiple tokens with IDs `_tokenIds`\n    function batchTransferFrom(\n        address _from,\n        address _to,\n        uint256[] calldata _tokenIds\n    ) external;\n\n    /// @dev used to enabled/disable sales of an edition\n    function toggleEditionSalesDisabled(uint256 _editionId) external;\n\n    /// @dev used to update the address of the creator associated with the works of an edition\n    function updateEditionCreator(\n        uint256 _editionId,\n        address _creator\n    ) external;\n\n    /// @dev used to update the royalty percentage for external secondary sales of tokens belonging to a specific edition\n    function updateEditionRoyaltyPercentage(\n        uint256 _editionId,\n        uint256 _percentage\n    ) external;\n\n    /// @dev used to set an external token URI resolver for the contract\n    function updateTokenURIResolver(\n        ITokenUriResolver _tokenUriResolver\n    ) external;\n}\n"
      },
      "contracts/errors/KODAErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\nerror AlreadyListed();\nerror AlreadySet();\nerror EditionDisabled();\nerror EditionNotListed();\nerror EditionSalesDisabled();\nerror EmptyString();\nerror InvalidListing();\nerror InvalidOwner();\nerror InvalidPrice();\nerror InvalidToken();\nerror IsOpenEdition();\nerror OnlyAdmin();\nerror OnlyVerifiedArtist();\nerror OwnerRevoked();\nerror PrimarySaleMade();\nerror TooEarly();\nerror TransferFailed();\nerror ZeroAddress();\n"
      },
      "contracts/interfaces/IKOAccessControlsLookup.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\ninterface IKOAccessControlsLookup {\n    function hasAdminRole(address _address) external view returns (bool);\n\n    function isVerifiedArtist(\n        uint256 _index,\n        address _account,\n        bytes32[] calldata _merkleProof\n    ) external view returns (bool);\n}\n"
      },
      "contracts/interfaces/IKODABaseUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\n/**\n * @dev required interface for the base contract for KnownOrigin Creator Contracts\n */\ninterface IKODABaseUpgradeable {\n    error MaxRoyaltyPercentageExceeded();\n\n    /// @dev Emitted when additional minter addresses are enabled or disabled\n    event AdditionalMinterEnabled(address indexed _minter, bool _enabled);\n\n    /// @dev Emitted when additional creator addresses are enabled or disabled\n    event AdditionalCreatorEnabled(address indexed _creator, bool _enabled);\n\n    /// @dev Emitted when the owner updates the default secondary royalty percentage\n    event DefaultRoyaltyPercentageUpdated(uint256 _percentage);\n\n    /// @dev Allows the owner to pause some contract actions\n    function pause() external;\n\n    /// @dev Allows the owner to unpause\n    function unpause() external;\n\n    /// @dev Allows the contract owner to update the default secondary sale royalty percentage\n    function updateDefaultRoyaltyPercentage(uint256 _percentage) external;\n}\n"
      },
      "contracts/interfaces/IKODASettings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\nimport {IKOAccessControlsLookup} from \"./IKOAccessControlsLookup.sol\";\n\ninterface IKODASettings {\n    error MaxCommissionExceeded();\n    error OnlyAdmin();\n    event PlatformPrimaryCommissionUpdated(uint256 _percentage);\n    event PlatformSecondaryCommissionUpdated(uint256 _percentage);\n    event PlatformUpdated(address indexed _platform);\n    event BaseKOAPIUpdated(string _baseKOApi);\n\n    function initialize(\n        address _platform,\n        string calldata _baseKOApi,\n        IKOAccessControlsLookup _accessControls\n    ) external;\n\n    /// @notice Admin update for primary sale platform percentage for V4 or newer KODA contracts when sold within platform\n    function updatePlatformPrimaryCommission(uint256 _percentage) external;\n\n    /// @notice Admin update for secondary sale platform percentage for V4 or newer KODA contracts when sold within platform\n    function updatePlatformSecondaryCommission(uint256 _percentage) external;\n\n    /// @notice Admin can update the address that will receive proceeds from primary and secondary sales\n    function setPlatform(address _platform) external;\n\n    /// @notice Admin can update the base KO API\n    function setBaseKOApi(string calldata _baseKOApi) external;\n}\n"
      },
      "contracts/interfaces/ITokenUriResolver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\ninterface ITokenUriResolver {\n    /// @notice Return the edition or token level URI - token level trumps edition level if found\n    function tokenURI(\n        uint256 _editionId,\n        uint256 _tokenId\n    ) external view returns (string memory);\n\n    /// @notice Do we have an edition level or token level token URI resolver set\n    function isDefined(\n        uint256 _editionId,\n        uint256 _tokenId\n    ) external view returns (bool);\n}\n"
      },
      "contracts/KODABaseUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {PausableUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport {Konstants} from \"./Konstants.sol\";\nimport {IKODABaseUpgradeable} from \"./interfaces/IKODABaseUpgradeable.sol\";\n\n/**\n * @dev Base contract for KnownOrigin Creator NFT minting contracts\n *\n * - requires IKODABaseUpgradable interface for errors and events\n * - requires OpenZeppelin upgradable contracts to make inheriting contracts ownable and pausable\n *\n * - includes storage of default secondary marketplace royalties and additionally enabled minting addresses managed by the owner\n */\nabstract contract KODABaseUpgradeable is\n    OwnableUpgradeable,\n    PausableUpgradeable,\n    ReentrancyGuardUpgradeable,\n    Konstants,\n    IKODABaseUpgradeable\n{\n    /**\n     * @notice Default Royalty Percentage for Secondary Sales\n     * @dev default percentage value used to calculate royalty consideration on secondary sales stored with the same precision as `MODULO`\n     */\n    uint256 public defaultRoyaltyPercentage;\n\n    // * Upgradeable Init * //\n\n    /**\n     * @notice Initialise the base contract with the default royalty percentage\n     * @dev the inheriting contract must call otherwise the secondary royalty will be zero\n     * @param _initialRoyaltyPercentage percentage to initially set the contract default royalty\n     */\n    function __KODABase_init(uint256 _initialRoyaltyPercentage) internal {\n        __ReentrancyGuard_init();\n        _updateDefaultRoyaltyPercentage(_initialRoyaltyPercentage);\n    }\n\n    // * OWNER * //\n\n    /// @notice Allows the owner to pause some contract actions\n    function pause() external onlyOwner whenNotPaused {\n        _pause();\n    }\n\n    /// @notice Allows the owner to unpause\n    function unpause() external onlyOwner whenPaused {\n        _unpause();\n    }\n\n    /**\n     * @notice Set the default royalty percentage to `_percentage`\n     * @dev allows the owner to set {defaultRoyaltyPercentage}\n     * @param _percentage the value to set with the same precision as {KODASettings-MODULO}\n     */\n    function updateDefaultRoyaltyPercentage(\n        uint256 _percentage\n    ) external onlyOwner {\n        _updateDefaultRoyaltyPercentage(_percentage);\n    }\n\n    // * INTERNAL * //\n\n    /// @dev Internal method for updating the the secondary royalty percentage used for calculating royalty for external marketplaces\n    function _updateDefaultRoyaltyPercentage(uint256 _percentage) internal {\n        if (_percentage > MAX_ROYALTY_PERCENTAGE)\n            revert MaxRoyaltyPercentageExceeded();\n        defaultRoyaltyPercentage = _percentage;\n        emit DefaultRoyaltyPercentageUpdated(_percentage);\n    }\n}\n"
      },
      "contracts/KODASettings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {IKOAccessControlsLookup} from \"./interfaces/IKOAccessControlsLookup.sol\";\nimport {IKODASettings} from \"./interfaces/IKODASettings.sol\";\nimport {ZeroAddress} from \"./errors/KODAErrors.sol\";\nimport {Konstants} from \"./Konstants.sol\";\n\n/// @title KnownOrigin Generalised Marketplace Settings For KODA Version 4 and beyond\n/// @notice KODASettings grants flexibility in commission collected at primary and secondary point of sale\ncontract KODASettings is UUPSUpgradeable, Konstants, IKODASettings {\n    /// @notice Address of the contract that defines who can update settings\n    IKOAccessControlsLookup public accessControls;\n\n    /// @notice Fee applied to all primary sales\n    uint256 public platformPrimaryCommission;\n\n    /// @notice Fee applied to all secondary sales\n    uint256 public platformSecondaryCommission;\n\n    /// @notice Address of the platform handler\n    address public platform;\n\n    /// @notice Base KO API endpoint\n    string public baseKOApi;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() initializer {}\n\n    function initialize(\n        address _platform,\n        string calldata _baseKOApi,\n        IKOAccessControlsLookup _accessControls\n    ) external initializer {\n        if (_platform == address(0)) revert ZeroAddress();\n        if (address(_accessControls) == address(0)) revert ZeroAddress();\n\n        __UUPSUpgradeable_init();\n\n        platformPrimaryCommission = 15_00000;\n        platformSecondaryCommission = 2_50000;\n\n        platform = _platform;\n        baseKOApi = _baseKOApi;\n        accessControls = _accessControls;\n    }\n\n    /// @dev Only admins can trigger smart contract upgrades\n    function _authorizeUpgrade(address) internal view override {\n        if (!accessControls.hasAdminRole(msg.sender)) revert OnlyAdmin();\n    }\n\n    /// @notice Admin update for primary sale platform percentage for V4 or newer KODA contracts when sold within platform\n    /// @dev It is possible to set this value to zero\n    function updatePlatformPrimaryCommission(uint256 _percentage) external {\n        if (!accessControls.hasAdminRole(msg.sender)) revert OnlyAdmin();\n        if (_percentage > MAX_PLATFORM_COMMISSION)\n            revert MaxCommissionExceeded();\n        platformPrimaryCommission = _percentage;\n        emit PlatformPrimaryCommissionUpdated(_percentage);\n    }\n\n    /// @notice Admin update for secondary sale platform percentage for V4 or newer KODA contracts when sold within platform\n    /// @dev It is possible to set this value to zero\n    function updatePlatformSecondaryCommission(uint256 _percentage) external {\n        if (!accessControls.hasAdminRole(msg.sender)) revert OnlyAdmin();\n        if (_percentage > MAX_PLATFORM_COMMISSION)\n            revert MaxCommissionExceeded();\n        platformSecondaryCommission = _percentage;\n        emit PlatformSecondaryCommissionUpdated(_percentage);\n    }\n\n    /// @notice Admin can update the address that will receive proceeds from primary and secondary sales\n    function setPlatform(address _platform) external {\n        if (!accessControls.hasAdminRole(msg.sender)) revert OnlyAdmin();\n        if (_platform == address(0)) revert ZeroAddress();\n        platform = _platform;\n        emit PlatformUpdated(_platform);\n    }\n\n    /// @notice Admin can update the base KO API\n    function setBaseKOApi(string calldata _baseKOApi) external {\n        if (!accessControls.hasAdminRole(msg.sender)) revert OnlyAdmin();\n        baseKOApi = _baseKOApi;\n        emit BaseKOAPIUpdated(_baseKOApi);\n    }\n}\n"
      },
      "contracts/Konstants.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\ncontract Konstants {\n    /// @notice Maximum Platform Commission for Primary and Secondary Sales\n    /// @dev precision 100.00000%\n    uint24 public constant MAX_PLATFORM_COMMISSION = 50_00000;\n\n    /// @notice Maximum Royalty Percentage for Secondary Sales\n    /// @dev precision 100.00000%\n    uint24 public constant MAX_ROYALTY_PERCENTAGE = 50_00000;\n\n    /// @notice Denominator used for percentage calculations\n    /// @dev precision 100.00000%\n    uint24 public constant MODULO = 100_00000;\n}\n"
      },
      "contracts/operator-filter-registry/IOperatorFilterRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface IOperatorFilterRegistry {\n    function isOperatorAllowed(\n        address registrant,\n        address operator\n    ) external view returns (bool);\n\n    function register(address registrant) external;\n\n    function registerAndSubscribe(\n        address registrant,\n        address subscription\n    ) external;\n\n    function registerAndCopyEntries(\n        address registrant,\n        address registrantToCopy\n    ) external;\n\n    function unregister(address addr) external;\n\n    function updateOperator(\n        address registrant,\n        address operator,\n        bool filtered\n    ) external;\n\n    function updateOperators(\n        address registrant,\n        address[] calldata operators,\n        bool filtered\n    ) external;\n\n    function updateCodeHash(\n        address registrant,\n        bytes32 codehash,\n        bool filtered\n    ) external;\n\n    function updateCodeHashes(\n        address registrant,\n        bytes32[] calldata codeHashes,\n        bool filtered\n    ) external;\n\n    function subscribe(\n        address registrant,\n        address registrantToSubscribe\n    ) external;\n\n    function unsubscribe(address registrant, bool copyExistingEntries) external;\n\n    function subscriptionOf(address addr) external returns (address registrant);\n\n    function subscribers(\n        address registrant\n    ) external returns (address[] memory);\n\n    function subscriberAt(\n        address registrant,\n        uint256 index\n    ) external returns (address);\n\n    function copyEntriesOf(\n        address registrant,\n        address registrantToCopy\n    ) external;\n\n    function isOperatorFiltered(\n        address registrant,\n        address operator\n    ) external returns (bool);\n\n    function isCodeHashOfFiltered(\n        address registrant,\n        address operatorWithCode\n    ) external returns (bool);\n\n    function isCodeHashFiltered(\n        address registrant,\n        bytes32 codeHash\n    ) external returns (bool);\n\n    function filteredOperators(\n        address addr\n    ) external returns (address[] memory);\n\n    function filteredCodeHashes(\n        address addr\n    ) external returns (bytes32[] memory);\n\n    function filteredOperatorAt(\n        address registrant,\n        uint256 index\n    ) external returns (address);\n\n    function filteredCodeHashAt(\n        address registrant,\n        uint256 index\n    ) external returns (bytes32);\n\n    function isRegistered(address addr) external returns (bool);\n\n    function codeHashOf(address addr) external returns (bytes32);\n}\n"
      },
      "contracts/operator-filter-registry/UpdatableOperatorFiltererUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport {IOperatorFilterRegistry} from \"./IOperatorFilterRegistry.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\n/**\n * @title  UpdatableOperatorFiltererUpgradeable\n * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another\n *         registrant's entries in the OperatorFilterRegistry. This contract allows the Owner to update the\n *         OperatorFilterRegistry address via updateOperatorFilterRegistryAddress, including to the zero address,\n *         which will bypass registry checks.\n *         Note that OpenSea will still disable creator fee enforcement if filtered operators begin fulfilling orders\n *         on-chain, eg, if the registry is revoked or bypassed.\n * @dev    This smart contract is meant to be inherited by token contracts so they can use the following:\n *         - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.\n *         - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.\n */\nabstract contract UpdatableOperatorFiltererUpgradeable is Initializable {\n    error OperatorNotAllowed(address operator);\n    error OnlyOwner();\n\n    IOperatorFilterRegistry public operatorFilterRegistry;\n\n    /**\n     * @notice Initialise the operator filterer\n     * @param _registry address of operator filter registry\n     * @param subscriptionOrRegistrantToCopy address of subscription or registrant to copy\n     * @param subscribe boolean if to subscribe\n     */\n    function _UpdatableOperatorFilterer_init(\n        address _registry,\n        address subscriptionOrRegistrantToCopy,\n        bool subscribe\n    ) internal onlyInitializing {\n        operatorFilterRegistry = IOperatorFilterRegistry(_registry);\n\n        // If an inheriting token contract is deployed to a network without the registry deployed, the modifier\n        // will not revert, but the contract will need to be registered with the registry once it is deployed in\n        // order for the modifier to filter addresses.\n        _performFilterRegistryRegistrationOperations(\n            subscriptionOrRegistrantToCopy,\n            subscribe\n        );\n    }\n\n    modifier onlyAllowedOperator(address from) virtual {\n        // Allow spending tokens from addresses with balance\n        // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred\n        // from an EOA.\n        if (from != msg.sender) {\n            _checkFilterOperator(msg.sender);\n        }\n        _;\n    }\n\n    modifier onlyAllowedOperatorApproval(address operator) virtual {\n        _checkFilterOperator(operator);\n        _;\n    }\n\n    /**\n     * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero\n     *         address, checks will be bypassed. OnlyOwner.\n     */\n    function updateOperatorFilterRegistryAddress(\n        address newRegistry,\n        address subscriptionOrRegistrantToCopy,\n        bool subscribe\n    ) public virtual {\n        if (msg.sender != owner()) revert OnlyOwner();\n        operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);\n        _performFilterRegistryRegistrationOperations(\n            subscriptionOrRegistrantToCopy,\n            subscribe\n        );\n    }\n\n    /**\n     * @dev assume the contract has an owner, but leave specific Ownable implementation up to inheriting contract\n     */\n    function owner() public view virtual returns (address);\n\n    function _checkFilterOperator(address operator) internal view virtual {\n        IOperatorFilterRegistry registry = operatorFilterRegistry;\n        // Check registry code length to facilitate testing in environments without a deployed registry.\n        if (\n            address(registry) != address(0) && address(registry).code.length > 0\n        ) {\n            if (!registry.isOperatorAllowed(address(this), operator)) {\n                revert OperatorNotAllowed(operator);\n            }\n        }\n    }\n\n    /// @dev Optionally perform additional registration operations after updating the operator filter registry\n    function _performFilterRegistryRegistrationOperations(\n        address subscriptionOrRegistrantToCopy,\n        bool subscribe\n    ) internal {\n        if (address(operatorFilterRegistry).code.length > 0) {\n            if (subscribe) {\n                operatorFilterRegistry.registerAndSubscribe(\n                    address(this),\n                    subscriptionOrRegistrantToCopy\n                );\n            } else {\n                if (subscriptionOrRegistrantToCopy != address(0)) {\n                    operatorFilterRegistry.registerAndCopyEntries(\n                        address(this),\n                        subscriptionOrRegistrantToCopy\n                    );\n                } else {\n                    operatorFilterRegistry.register(address(this));\n                }\n            }\n        }\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 1000,
        "details": {
          "yul": true
        }
      },
      "viaIR": true,
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}