{ "language": "Solidity", "sources": { "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerableUpgradeable.sol\";\nimport \"./AccessControlUpgradeable.sol\";\nimport \"../utils/structs/EnumerableSetUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {\n function __AccessControlEnumerable_init() internal onlyInitializing {\n }\n\n function __AccessControlEnumerable_init_unchained() internal onlyInitializing {\n }\n using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;\n\n mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\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/access/AccessControlUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role, _msgSender());\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(uint160(account), 20),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\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/access/IAccessControlEnumerableUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" }, "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" }, "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n" }, "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.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 IERC2981Upgradeable is IERC165Upgradeable {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be payed in that same unit of exchange.\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n returns (address receiver, uint256 royaltyAmount);\n}\n" }, "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.0;\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 * 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 initialize the implementation contract, you can either invoke the\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() initializer {}\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool 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 Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\n // contract may have been reentered.\n require(_initializing ? _isConstructor() : !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} modifier, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n function _isConstructor() private view returns (bool) {\n return !AddressUpgradeable.isContract(address(this));\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\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/token/ERC1155/ERC1155Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155Upgradeable.sol\";\nimport \"./IERC1155ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC1155MetadataURIUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\n using AddressUpgradeable for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\n __ERC1155_init_unchained(uri_);\n }\n\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: balance query for the zero address\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not owner nor approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits a {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\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[47] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Upgradeable.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" }, "@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/CountersUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\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/cryptography/ECDSAUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/StringsUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/structs/BitMapsUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/structs/BitMaps.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.\n * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].\n */\nlibrary BitMapsUpgradeable {\n struct BitMap {\n mapping(uint256 => uint256) _data;\n }\n\n /**\n * @dev Returns whether the bit at `index` is set.\n */\n function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {\n uint256 bucket = index >> 8;\n uint256 mask = 1 << (index & 0xff);\n return bitmap._data[bucket] & mask != 0;\n }\n\n /**\n * @dev Sets the bit at `index` to the boolean `value`.\n */\n function setTo(\n BitMap storage bitmap,\n uint256 index,\n bool value\n ) internal {\n if (value) {\n set(bitmap, index);\n } else {\n unset(bitmap, index);\n }\n }\n\n /**\n * @dev Sets the bit at `index`.\n */\n function set(BitMap storage bitmap, uint256 index) internal {\n uint256 bucket = index >> 8;\n uint256 mask = 1 << (index & 0xff);\n bitmap._data[bucket] |= mask;\n }\n\n /**\n * @dev Unsets the bit at `index`.\n */\n function unset(BitMap storage bitmap, uint256 index) internal {\n uint256 bucket = index >> 8;\n uint256 mask = 1 << (index & 0xff);\n bitmap._data[bucket] &= ~mask;\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSetUpgradeable {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.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 Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" }, "contracts/aspen/api/agreement/IAgreement.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8;\n\ninterface ICedarAgreementV0 {\n // Accept legal terms associated with transfer of this NFT\n function acceptTerms() external;\n\n function userAgreement() external view returns (string memory);\n\n function termsActivated() external view returns (bool);\n\n function setTermsStatus(bool _status) external;\n\n function getAgreementStatus(address _address) external view returns (bool sig);\n\n function storeTermsAccepted(address _acceptor, bytes calldata _signature) external;\n}\n\ninterface ICedarAgreementV1 {\n // Accept legal terms associated with transfer of this NFT\n event TermsActivationStatusUpdated(bool isActivated);\n event TermsUpdated(string termsURI, uint8 termsVersion);\n event TermsAccepted(string termsURI, uint8 termsVersion, address indexed acceptor);\n\n function acceptTerms() external;\n\n function acceptTerms(address _acceptor) external;\n\n function setTermsActivation(bool _active) external;\n\n function setTermsURI(string calldata _termsURI) external;\n\n function getTermsDetails()\n external\n view\n returns (\n string memory termsURI,\n uint8 termsVersion,\n bool termsActivated\n );\n\n function hasAcceptedTerms(address _address) external view returns (bool hasAccepted);\n\n // function hasAcceptedTerms(address _address, uint8 _termsVersion) external view returns (bool hasAccepted);\n}\n\ninterface IPublicAgreementV0 {\n function acceptTerms() external;\n\n function getTermsDetails()\n external\n view\n returns (\n string memory termsURI,\n uint8 termsVersion,\n bool termsActivated\n );\n\n function hasAcceptedTerms(address _address) external view returns (bool hasAccepted);\n\n function hasAcceptedTerms(address _address, uint8 _termsVersion) external view returns (bool hasAccepted);\n}\n\ninterface IPublicAgreementV1 is IPublicAgreementV0 {\n /// @dev Emitted when the terms are accepted.\n event TermsAccepted(string termsURI, uint8 termsVersion, address indexed acceptor);\n}\n\ninterface IRestrictedAgreementV0 {\n function acceptTerms(address _acceptor) external;\n\n function setTermsActivation(bool _active) external;\n\n function setTermsURI(string calldata _termsURI) external;\n}\n\ninterface IRestrictedAgreementV1 is IRestrictedAgreementV0 {\n /// @dev Emitted when the terms are accepted by an issuer.\n event TermsAcceptedForAddress(string termsURI, uint8 termsVersion, address indexed acceptor, address caller);\n /// @dev Emitted when the terms are activated/deactivated.\n event TermsActivationStatusUpdated(bool isActivated);\n /// @dev Emitted when the terms URI is updated.\n event TermsUpdated(string termsURI, uint8 termsVersion);\n}\n\ninterface IDelegatedAgreementV0 {\n /// @dev Emitted when the terms are accepted using singature of acceptor.\n event TermsWithSignatureAccepted(string termsURI, uint8 termsVersion, address indexed acceptor, bytes signature);\n\n function acceptTerms(address _acceptor, bytes calldata _signature) external;\n\n function batchAcceptTerms(address[] calldata _acceptors) external;\n}\n" }, "contracts/aspen/api/baseURI/IUpdateBaseURI.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8;\n\ninterface ICedarUpdateBaseURIV0 {\n /// @dev Emitted when base URI is updated.\n event BaseURIUpdated(uint256 baseURIIndex, string baseURI);\n\n /**\n * @notice Lets a minter (account with `MINTER_ROLE`) update base URI\n */\n function updateBaseURI(uint256 baseURIIndex, string calldata _baseURIForTokens) external;\n\n /**\n * @dev Gets the base URI indices\n */\n function getBaseURIIndices() external view returns (uint256[] memory);\n}\n\ninterface IPublicUpdateBaseURIV0 {\n /**\n * @dev Gets the base URI indices\n */\n function getBaseURIIndices() external view returns (uint256[] memory);\n}\n\ninterface IDelegatedUpdateBaseURIV0 {\n /**\n * @dev Gets the base URI indices\n */\n function getBaseURIIndices() external view returns (uint256[] memory);\n}\n\ninterface IRestrictedUpdateBaseURIV0 {\n /**\n * @notice Lets a minter (account with `MINTER_ROLE`) update base URI\n */\n function updateBaseURI(uint256 baseURIIndex, string calldata _baseURIForTokens) external;\n}\n\ninterface IRestrictedUpdateBaseURIV1 is IRestrictedUpdateBaseURIV0 {\n /// @dev Emitted when base URI is updated.\n event BaseURIUpdated(uint256 baseURIIndex, string baseURI);\n}\n" }, "contracts/aspen/api/config/IGlobalConfig.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\nimport \"../config/IPlatformFeeConfig.sol\";\nimport \"../config/IOperatorFilterersConfig.sol\";\n\ninterface IGlobalConfigV0 is IOperatorFiltererConfigV0, IPlatformFeeConfigV0 {\n\n}" }, "contracts/aspen/api/config/IOperatorFilterersConfig.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\nimport \"./types/OperatorFiltererDataTypes.sol\";\n\ninterface IOperatorFiltererConfigV0 {\n event OperatorFiltererAdded(\n bytes32 operatorFiltererId,\n string name,\n address defaultSubscription,\n address operatorFilterRegistry\n );\n\n function getOperatorFiltererOrDie(bytes32 _operatorFiltererId)\n external\n view\n returns (IOperatorFiltererDataTypesV0.OperatorFilterer memory);\n\n function getOperatorFilterer(bytes32 _operatorFiltererId)\n external\n view\n returns (IOperatorFiltererDataTypesV0.OperatorFilterer memory);\n\n function getOperatorFiltererIds() external view returns (bytes32[] memory operatorFiltererIds);\n\n function addOperatorFilterer(IOperatorFiltererDataTypesV0.OperatorFilterer memory _newOperatorFilterer) external;\n}\n" }, "contracts/aspen/api/config/IPlatformFeeConfig.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface IPlatformFeeConfigV0 {\n event PlatformFeesUpdated(address platformFeeReceiver, uint16 platformFeeBPS);\n\n function getPlatformFees() external view returns (address platformFeeReceiver, uint16 platformFeeBPS);\n\n function setPlatformFees(address _newPlatformFeeReceiver, uint16 _newPlatformFeeBPS) external;\n}\n" }, "contracts/aspen/api/config/types/OperatorFiltererDataTypes.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface IOperatorFiltererDataTypesV0 {\n struct OperatorFilterer {\n bytes32 operatorFiltererId;\n string name;\n address defaultSubscription;\n address operatorFilterRegistry;\n }\n}\n" }, "contracts/aspen/api/deploy/types/DropFactoryDataTypes.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\nimport \"../../config/types/OperatorFiltererDataTypes.sol\";\nimport \"../../config/IGlobalConfig.sol\";\n\ninterface IDropFactoryDataTypesV0 {\n struct DropConfig {\n address dropDelegateLogic;\n IGlobalConfigV0 aspenConfig;\n TokenDetails tokenDetails;\n FeeDetails feeDetails;\n IOperatorFiltererDataTypesV0.OperatorFilterer operatorFilterer;\n }\n\n struct TokenDetails {\n address defaultAdmin;\n string name;\n string symbol;\n string contractURI;\n address[] trustedForwarders;\n string userAgreement;\n }\n\n struct FeeDetails {\n address saleRecipient;\n address royaltyRecipient;\n uint128 royaltyBps;\n }\n}\n" }, "contracts/aspen/api/errors/IDropErrors.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface IDropErrorsV0 {\n error InvalidPermission();\n error InvalidIndex();\n error NothingToReveal();\n error NotTrustedForwarder();\n error InvalidTimetamp();\n error CrossedLimitLazyMintedTokens();\n error CrossedLimitMinTokenIdGreaterThanMaxTotalSupply();\n error CrossedLimitQuantityPerTransaction();\n error CrossedLimitMaxClaimableSupply();\n error CrossedLimitMaxTotalSupply();\n error CrossedLimitMaxWalletClaimCount();\n error InvalidPrice();\n error InvalidPaymentAmount();\n error InvalidQuantity();\n error InvalidTime();\n error InvalidGating();\n error InvalidMerkleProof();\n error InvalidMaxQuantityProof();\n error MaxBps();\n error ClaimPaused();\n error NoActiveMintCondition();\n error TermsNotAccepted(address caller, string termsURI, uint8 acceptedVersion);\n error BaseURIEmpty();\n error FrozenTokenMetadata(uint256 tokenId);\n error InvalidTokenId(uint256 tokenId);\n error InvalidNoOfTokenIds();\n error InvalidPhaseId(bytes32 phaseId);\n error SignatureVerificationFailed();\n}\n" }, "contracts/aspen/api/errors/ITermsErrors.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface ITermsErrorsV0 {\n error TermsNotActivated();\n error TermsStatusAlreadySet();\n error TermsURINotSet();\n error TermsUriAlreadySet();\n error TermsAlreadyAccepted(uint8 acceptedVersion);\n error SignatureVerificationFailed();\n error TermsCanOnlyBeSetByOwner(address token);\n error TermsNotActivatedForToken(address token);\n error TermsStatusAlreadySetForToken(address token);\n error TermsURINotSetForToken(address token);\n error TermsUriAlreadySetForToken(address token);\n error TermsAlreadyAcceptedForToken(address token, uint8 acceptedVersion);\n}\n" }, "contracts/aspen/api/IAspenFeatures.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\ninterface ICedarFeaturesV0 is IERC165Upgradeable {\n // Marker interface to make an ERC165 clash less likely\n function isICedarFeaturesV0() external pure returns (bool);\n\n // List of features that contract supports and may be passed to featureVersion\n function supportedFeatures() external pure returns (string[] memory features);\n}\n\ninterface IAspenFeaturesV0 is IERC165Upgradeable {\n // Marker interface to make an ERC165 clash less likely\n function isIAspenFeaturesV0() external pure returns (bool);\n\n // List of features that contract supports and may be passed to featureVersion\n function supportedFeatures() external pure returns (string[] memory features);\n}\n" }, "contracts/aspen/api/IAspenVersioned.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\n\ninterface ICedarMinorVersionedV0 {\n function minorVersion() external view returns (uint256 minor, uint256 patch);\n}\n\ninterface ICedarImplementationVersionedV0 {\n /// @dev Concrete implementation semantic version - provided for completeness but not designed to be the point of dispatch\n function implementationVersion()\n external\n view\n returns (\n uint256 major,\n uint256 minor,\n uint256 patch\n );\n}\n\ninterface ICedarImplementationVersionedV1 is ICedarImplementationVersionedV0 {\n /// @dev returns the name of the implementation interface such as IAspenERC721DropV3\n /// allows us to reliably emit the correct events\n function implementationInterfaceName() external view returns (string memory interfaceName);\n}\n\ninterface ICedarImplementationVersionedV2 is ICedarImplementationVersionedV0 {\n /// @dev returns the name of the implementation interface such as impl/IAspenERC721Drop.sol:IAspenERC721DropV3\n function implementationInterfaceId() external view returns (string memory interfaceId);\n}\n\ninterface ICedarVersionedV0 is ICedarImplementationVersionedV0, ICedarMinorVersionedV0, IERC165Upgradeable {}\n\ninterface ICedarVersionedV1 is ICedarImplementationVersionedV1, ICedarMinorVersionedV0, IERC165Upgradeable {}\n\ninterface ICedarVersionedV2 is ICedarImplementationVersionedV2, ICedarMinorVersionedV0, IERC165Upgradeable {}\n\ninterface IAspenVersionedV2 is IERC165Upgradeable {\n function minorVersion() external view returns (uint256 minor, uint256 patch);\n\n /// @dev Concrete implementation semantic version - provided for completeness but not designed to be the point of dispatch\n function implementationVersion()\n external\n view\n returns (\n uint256 major,\n uint256 minor,\n uint256 patch\n );\n\n /// @dev returns the name of the implementation interface such as impl/IAspenERC721Drop.sol:IAspenERC721DropV3\n function implementationInterfaceId() external view returns (string memory interfaceId);\n}\n" }, "contracts/aspen/api/impl/IAspenERC1155Drop.sol": { "content": "// SPDX-License-Identifier: Apache 2.0\n\npragma solidity ^0.8;\n\nimport \"../IAspenFeatures.sol\";\nimport \"../IMulticallable.sol\";\nimport \"../IAspenVersioned.sol\";\nimport \"../issuance/ICedarSFTIssuance.sol\";\nimport \"../issuance/ISFTLimitSupply.sol\";\nimport \"../issuance/ISFTSupply.sol\";\nimport \"../issuance/ISFTClaimCount.sol\";\nimport \"../baseURI/IUpdateBaseURI.sol\";\nimport \"../standard/IERC1155.sol\";\nimport \"../standard/IERC2981.sol\";\nimport \"../standard/IERC4906.sol\";\nimport \"../royalties/IRoyalty.sol\";\nimport \"../metadata/ISFTMetadata.sol\";\nimport \"../metadata/IContractMetadata.sol\";\nimport \"../agreement/IAgreement.sol\";\nimport \"../primarysale/IPrimarySale.sol\";\nimport \"../lazymint/ILazyMint.sol\";\nimport \"../pausable/IPausable.sol\";\nimport \"../ownable/IOwnable.sol\";\nimport \"../royalties/IPlatformFee.sol\";\n\ninterface IAspenERC1155DropV2 is\n IAspenFeaturesV0,\n IAspenVersionedV2,\n IMulticallableV0,\n // NOTE: keep this standard interfaces around to generate supportsInterface\n IERC1155V3,\n IERC2981V0,\n IRestrictedERC4906V0,\n // NOTE: keep this standard interfaces around to generate supportsInterface ˆˆ\n // Supply\n IPublicSFTSupplyV0,\n IDelegatedSFTSupplyV0,\n IRestrictedSFTLimitSupplyV1,\n // Issuance\n IPublicSFTIssuanceV4,\n IDelegatedSFTIssuanceV0,\n IRestrictedSFTIssuanceV4,\n // Royalties\n IPublicRoyaltyV0,\n IRestrictedRoyaltyV1,\n // BaseUri\n IDelegatedUpdateBaseURIV0,\n IRestrictedUpdateBaseURIV1,\n // Metadata\n IPublicMetadataV0,\n IRestrictedMetadataV2,\n IAspenSFTMetadataV1,\n // Ownable\n IPublicOwnableV0,\n IRestrictedOwnableV0,\n // Pausable\n IDelegatedPausableV0,\n IRestrictedPausableV1,\n // Agreement\n IPublicAgreementV1,\n IDelegatedAgreementV0,\n IRestrictedAgreementV1,\n // Primary Sale\n IPublicPrimarySaleV1,\n IRestrictedPrimarySaleV2,\n IRestrictedSFTPrimarySaleV0,\n // Operator Filterer\n IRestrictedOperatorFiltererV0,\n IPublicOperatorFilterToggleV0,\n IRestrictedOperatorFilterToggleV0,\n // Delegated only\n IDelegatedPlatformFeeV0,\n // Restricted Only\n IRestrictedLazyMintV1,\n IRestrictedSFTClaimCountV0\n{}\n" }, "contracts/aspen/api/IMulticallable.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8;\n\n// See https://docs.openzeppelin.com/contracts/4.x/utilities#multicall\ninterface IMulticallableV0 {\n function multicall(bytes[] calldata data) external returns (bytes[] memory results);\n}\n" }, "contracts/aspen/api/issuance/ICedarSFTIssuance.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\nimport \"./IDropClaimCondition.sol\";\n\n/**\n * Cedar's 'Drop' contracts are distribution mechanisms for tokens. The\n * `DropERC721` contract is a distribution mechanism for ERC721 tokens.\n *\n * A minter wallet (i.e. holder of `MINTER_ROLE`) can (lazy)mint 'n' tokens\n * at once by providing a single base URI for all tokens being lazy minted.\n * The URI for each of the 'n' tokens lazy minted is the provided base URI +\n * `{tokenId}` of the respective token. (e.g. \"ipsf://Qmece.../1\").\n *\n * A contract admin (i.e. holder of `DEFAULT_ADMIN_ROLE`) can create claim conditions\n * with non-overlapping time windows, and accounts can claim the tokens according to\n * restrictions defined in the claim condition that is active at the time of the transaction.\n */\n\ninterface ICedarSFTIssuanceV0 is IDropClaimConditionV0 {\n /// @dev Emitted when tokens are claimed.\n event TokensClaimed(\n uint256 indexed claimConditionIndex,\n uint256 indexed tokenId,\n address indexed claimer,\n address receiver,\n uint256 quantityClaimed\n );\n\n /// @dev Emitted when tokens are issued.\n event TokensIssued(uint256 indexed tokenId, address indexed claimer, address receiver, uint256 quantityClaimed);\n\n /// @dev Emitted when new claim conditions are set for a token.\n event ClaimConditionsUpdated(uint256 indexed tokenId, ClaimCondition[] claimConditions);\n\n /**\n * @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.\n *\n * @param tokenId The token ID for which to set mint conditions.\n * @param phases Claim conditions in ascending order by `startTimestamp`.\n * @param resetClaimEligibility Whether to reset `limitLastClaimTimestamp` and\n * `limitMerkleProofClaim` values when setting new\n * claim conditions.\n */\n function setClaimConditions(\n uint256 tokenId,\n ClaimCondition[] calldata phases,\n bool resetClaimEligibility\n ) external;\n\n /**\n * @notice Lets an account claim a given quantity of NFTs.\n *\n * @param receiver The receiver of the NFTs to claim.\n * @param tokenId The unique ID of the token to claim.\n * @param quantity The quantity of NFTs to claim.\n * @param currency The currency in which to pay for the claim.\n * @param pricePerToken The price per token to pay for the claim.\n * @param proofs The proof of the claimer's inclusion in the merkle root allowlist\n * of the claim conditions that apply.\n * @param proofMaxQuantityPerTransaction (Optional) The maximum number of NFTs an address included in an\n * allowlist can claim.\n */\n function claim(\n address receiver,\n uint256 tokenId,\n uint256 quantity,\n address currency,\n uint256 pricePerToken,\n bytes32[] calldata proofs,\n uint256 proofMaxQuantityPerTransaction\n ) external payable;\n\n /**\n * @notice Lets an account with ISSUER_ROLE issue NFTs.\n *\n * @param receiver The receiver of the NFTs to claim.\n * @param tokenId The unique ID of the token to claim.\n * @param quantity The quantity of NFTs to claim.\n */\n function issue(\n address receiver,\n uint256 tokenId,\n uint256 quantity\n ) external;\n}\n\ninterface ICedarSFTIssuanceV1 is ICedarSFTIssuanceV0 {\n /// @dev Expose the current active claim condition including claim limits\n function getActiveClaimConditions(uint256 _tokenId)\n external\n view\n returns (\n ClaimCondition memory condition,\n uint256 conditionId,\n uint256 walletMaxClaimCount,\n uint256 remainingSupply\n );\n\n /// @dev Expose the user specific limits related to the current active claim condition\n function getUserClaimConditions(uint256 _tokenId, address _claimer)\n external\n view\n returns (\n uint256 conditionId,\n uint256 walletClaimedCount,\n uint256 lastClaimTimestamp,\n uint256 nextValidClaimTimestamp\n );\n\n /// @dev Checks a request to claim NFTs against the active claim condition's criteria.\n function verifyClaim(\n uint256 _conditionId,\n address _claimer,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bool verifyMaxQuantityPerTransaction\n ) external view;\n}\n\ninterface ICedarSFTIssuanceV2 is ICedarSFTIssuanceV0 {\n /// @dev Expose the current active claim condition including claim limits\n function getActiveClaimConditions(uint256 _tokenId)\n external\n view\n returns (\n ClaimCondition memory condition,\n uint256 conditionId,\n uint256 walletMaxClaimCount,\n uint256 remainingSupply,\n bool isClaimPaused\n );\n\n /// @dev Expose the user specific limits related to the current active claim condition\n function getUserClaimConditions(uint256 _tokenId, address _claimer)\n external\n view\n returns (\n uint256 conditionId,\n uint256 walletClaimedCount,\n uint256 walletClaimedCountInPhase,\n uint256 lastClaimTimestamp,\n uint256 nextValidClaimTimestamp\n );\n\n /// @dev Checks a request to claim NFTs against the active claim condition's criteria.\n function verifyClaim(\n uint256 _conditionId,\n address _claimer,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bool verifyMaxQuantityPerTransaction\n ) external view;\n}\n\ninterface ICedarSFTIssuanceV3 is ICedarSFTIssuanceV0 {\n /// @dev Expose the current active claim condition including claim limits\n function getActiveClaimConditions(uint256 _tokenId)\n external\n view\n returns (\n ClaimCondition memory condition,\n uint256 conditionId,\n uint256 walletMaxClaimCount,\n uint256 tokenSupply,\n uint256 maxTotalSupply,\n bool isClaimPaused\n );\n\n /// @dev Expose the user specific limits related to the current active claim condition\n function getUserClaimConditions(uint256 _tokenId, address _claimer)\n external\n view\n returns (\n uint256 conditionId,\n uint256 walletClaimedCount,\n uint256 walletClaimedCountInPhase,\n uint256 lastClaimTimestamp,\n uint256 nextValidClaimTimestamp\n );\n\n /// @dev Checks a request to claim NFTs against the active claim condition's criteria.\n function verifyClaim(\n uint256 _conditionId,\n address _claimer,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bool verifyMaxQuantityPerTransaction\n ) external view;\n}\n\ninterface IPublicSFTIssuanceV0 is IDropClaimConditionV0 {\n /**\n * @notice Lets an account claim a given quantity of NFTs.\n *\n * @param receiver The receiver of the NFTs to claim.\n * @param tokenId The unique ID of the token to claim.\n * @param quantity The quantity of NFTs to claim.\n * @param currency The currency in which to pay for the claim.\n * @param pricePerToken The price per token to pay for the claim.\n * @param proofs The proof of the claimer's inclusion in the merkle root allowlist\n * of the claim conditions that apply.\n * @param proofMaxQuantityPerTransaction (Optional) The maximum number of NFTs an address included in an\n * allowlist can claim.\n */\n function claim(\n address receiver,\n uint256 tokenId,\n uint256 quantity,\n address currency,\n uint256 pricePerToken,\n bytes32[] calldata proofs,\n uint256 proofMaxQuantityPerTransaction\n ) external payable;\n\n /// @dev Expose the current active claim condition including claim limits\n function getActiveClaimConditions(uint256 _tokenId)\n external\n view\n returns (\n ClaimCondition memory condition,\n uint256 conditionId,\n uint256 walletMaxClaimCount,\n uint256 tokenSupply,\n uint256 maxTotalSupply,\n bool isClaimPaused\n );\n\n /// @dev Expose the user specific limits related to the current active claim condition\n function getUserClaimConditions(uint256 _tokenId, address _claimer)\n external\n view\n returns (\n uint256 conditionId,\n uint256 walletClaimedCount,\n uint256 walletClaimedCountInPhase,\n uint256 lastClaimTimestamp,\n uint256 nextValidClaimTimestamp\n );\n\n /// @dev Checks a request to claim NFTs against the active claim condition's criteria.\n function verifyClaim(\n uint256 _conditionId,\n address _claimer,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bool verifyMaxQuantityPerTransaction\n ) external view;\n}\n\ninterface IPublicSFTIssuanceV1 is IPublicSFTIssuanceV0 {\n /// @dev Emitted when tokens are claimed.\n event TokensClaimed(\n uint256 indexed claimConditionIndex,\n uint256 indexed tokenId,\n address indexed claimer,\n address receiver,\n uint256 quantityClaimed\n );\n}\n\ninterface IPublicSFTIssuanceV2 is IDropClaimConditionV1 {\n /// @dev Emitted when tokens are claimed.\n event TokensClaimed(\n uint256 indexed claimConditionIndex,\n uint256 indexed tokenId,\n address indexed claimer,\n address receiver,\n uint256 quantityClaimed,\n bytes32 phaseId\n );\n\n /**\n * @notice Lets an account claim a given quantity of NFTs.\n *\n * @param receiver The receiver of the NFTs to claim.\n * @param tokenId The unique ID of the token to claim.\n * @param quantity The quantity of NFTs to claim.\n * @param currency The currency in which to pay for the claim.\n * @param pricePerToken The price per token to pay for the claim.\n * @param proofs The proof of the claimer's inclusion in the merkle root allowlist\n * of the claim conditions that apply.\n * @param proofMaxQuantityPerTransaction (Optional) The maximum number of NFTs an address included in an\n * allowlist can claim.\n */\n function claim(\n address receiver,\n uint256 tokenId,\n uint256 quantity,\n address currency,\n uint256 pricePerToken,\n bytes32[] calldata proofs,\n uint256 proofMaxQuantityPerTransaction\n ) external payable;\n\n /// @dev Expose the current active claim condition including claim limits\n function getActiveClaimConditions(uint256 _tokenId)\n external\n view\n returns (\n ClaimCondition memory condition,\n uint256 conditionId,\n uint256 walletMaxClaimCount,\n uint256 tokenSupply,\n uint256 maxTotalSupply,\n bool isClaimPaused\n );\n\n /// @dev Expose the user specific limits related to the current active claim condition\n function getUserClaimConditions(uint256 _tokenId, address _claimer)\n external\n view\n returns (\n uint256 conditionId,\n uint256 walletClaimedCount,\n uint256 walletClaimedCountInPhase,\n uint256 lastClaimTimestamp,\n uint256 nextValidClaimTimestamp\n );\n\n /// @dev Returns the claim condition at the given uid.\n function getClaimConditionById(uint256 _tokenId, uint256 _conditionId)\n external\n view\n returns (ClaimCondition memory condition);\n\n /// @dev Checks a request to claim NFTs against the active claim condition's criteria.\n function verifyClaim(\n uint256 _conditionId,\n address _claimer,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bool verifyMaxQuantityPerTransaction\n ) external view;\n}\n\ninterface IPublicSFTIssuanceV3 is IDropClaimConditionV1 {\n /// @dev Emitted when tokens are claimed.\n event TokensClaimed(\n uint256 indexed claimConditionIndex,\n uint256 indexed tokenId,\n address indexed claimer,\n address receiver,\n uint256 quantityClaimed,\n bytes32 phaseId\n );\n\n /**\n * @notice Lets an account claim a given quantity of NFTs.\n *\n * @param receiver The receiver of the NFTs to claim.\n * @param tokenId The unique ID of the token to claim.\n * @param quantity The quantity of NFTs to claim.\n * @param currency The currency in which to pay for the claim.\n * @param pricePerToken The price per token to pay for the claim.\n * @param proofs The proof of the claimer's inclusion in the merkle root allowlist\n * of the claim conditions that apply.\n * @param proofMaxQuantityPerTransaction (Optional) The maximum number of NFTs an address included in an\n * allowlist can claim.\n */\n function claim(\n address receiver,\n uint256 tokenId,\n uint256 quantity,\n address currency,\n uint256 pricePerToken,\n bytes32[] calldata proofs,\n uint256 proofMaxQuantityPerTransaction\n ) external payable;\n\n /// @dev Expose the current active claim condition including claim limits\n function getActiveClaimConditions(uint256 _tokenId)\n external\n view\n returns (\n ClaimCondition memory condition,\n uint256 conditionId,\n uint256 walletMaxClaimCount,\n uint256 tokenSupply,\n uint256 maxTotalSupply,\n bool isClaimPaused\n );\n\n /// @dev Expose the user specific limits related to the current active claim condition\n function getUserClaimConditions(uint256 _tokenId, address _claimer)\n external\n view\n returns (\n uint256 conditionId,\n uint256 walletClaimedCount,\n uint256 walletClaimedCountInPhase,\n uint256 lastClaimTimestamp,\n uint256 nextValidClaimTimestamp\n );\n\n /// @dev Returns the claim condition at the given uid.\n function getClaimConditionById(uint256 _tokenId, uint256 _conditionId)\n external\n view\n returns (ClaimCondition memory condition);\n\n /// @dev Returns an array with all the claim conditions for a specific token.\n function getClaimConditions(uint256 _tokenId) external view returns (ClaimCondition[] memory conditions);\n\n /// @dev Checks a request to claim NFTs against the active claim condition's criteria\n /// including verification proofs.\n function verifyClaim(\n address _receiver,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bytes32[] calldata _proofs,\n uint256 _proofMaxQuantityPerTransaction\n ) external view;\n}\n\ninterface IPublicSFTIssuanceV4 is IDropClaimConditionV1 {\n /// @dev Emitted when tokens are claimed.\n event TokensClaimed(\n uint256 indexed claimConditionIndex,\n address indexed claimer,\n address indexed receiver,\n uint256 tokenId,\n uint256 quantityClaimed,\n bytes32 phaseId\n );\n\n /**\n * @notice Lets an account claim a given quantity of NFTs.\n *\n * @param receiver The receiver of the NFTs to claim.\n * @param tokenId The unique ID of the token to claim.\n * @param quantity The quantity of NFTs to claim.\n * @param currency The currency in which to pay for the claim.\n * @param pricePerToken The price per token to pay for the claim.\n * @param proofs The proof of the claimer's inclusion in the merkle root allowlist\n * of the claim conditions that apply.\n * @param proofMaxQuantityPerTransaction (Optional) The maximum number of NFTs an address included in an\n * allowlist can claim.\n */\n function claim(\n address receiver,\n uint256 tokenId,\n uint256 quantity,\n address currency,\n uint256 pricePerToken,\n bytes32[] calldata proofs,\n uint256 proofMaxQuantityPerTransaction\n ) external payable;\n}\n\ninterface IDelegatedSFTIssuanceV0 is IDropClaimConditionV1 {\n /// @dev Expose the user specific limits related to the current active claim condition\n function getUserClaimConditions(uint256 _tokenId, address _claimer)\n external\n view\n returns (\n ClaimCondition memory condition,\n uint256 conditionId,\n uint256 walletMaxClaimCount,\n uint256 tokenSupply,\n uint256 maxTotalSupply,\n uint256 walletClaimedCount,\n uint256 walletClaimedCountInPhase,\n uint256 lastClaimTimestamp,\n uint256 nextValidClaimTimestamp,\n bool isClaimPaused\n );\n\n /// @dev Returns an array with all the claim conditions for a specific token.\n function getClaimConditions(uint256 _tokenId) external view returns (ClaimCondition[] memory conditions);\n\n /// @dev Returns basic info for claim data\n function getClaimData(uint256 _tokenId)\n external\n view\n returns (\n uint256 nextTokenIdToMint,\n uint256 maxTotalSupply,\n uint256 maxWalletClaimCount\n );\n\n /// @dev Returns the claim condition at the given uid.\n function getClaimConditionById(uint256 _tokenId, uint256 _conditionId)\n external\n view\n returns (ClaimCondition memory conditions);\n\n /// @dev Checks a request to claim NFTs against the active claim condition's criteria\n /// including verification proofs.\n function verifyClaim(\n address _receiver,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bytes32[] calldata _proofs,\n uint256 _proofMaxQuantityPerTransaction\n ) external view;\n}\n\ninterface IRestrictedSFTIssuanceV0 is IDropClaimConditionV0 {\n /**\n * @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.\n *\n * @param tokenId The token ID for which to set mint conditions.\n * @param phases Claim conditions in ascending order by `startTimestamp`.\n * @param resetClaimEligibility Whether to reset `limitLastClaimTimestamp` and\n * `limitMerkleProofClaim` values when setting new\n * claim conditions.\n */\n function setClaimConditions(\n uint256 tokenId,\n ClaimCondition[] calldata phases,\n bool resetClaimEligibility\n ) external;\n\n /**\n * @notice Lets an account with ISSUER_ROLE issue NFTs.\n *\n * @param receiver The receiver of the NFTs to claim.\n * @param tokenId The unique ID of the token to claim.\n * @param quantity The quantity of NFTs to claim.\n */\n function issue(\n address receiver,\n uint256 tokenId,\n uint256 quantity\n ) external;\n}\n\ninterface IRestrictedSFTIssuanceV1 is IRestrictedSFTIssuanceV0 {\n /// @dev Emitted when tokens are issued.\n event TokensIssued(uint256 indexed tokenId, address indexed claimer, address receiver, uint256 quantityClaimed);\n\n /// @dev Emitted when new claim conditions are set for a token.\n event ClaimConditionsUpdated(uint256 indexed tokenId, ClaimCondition[] claimConditions);\n}\n\ninterface IRestrictedSFTIssuanceV2 is IDropClaimConditionV1 {\n /// @dev Emitted when tokens are issued.\n event TokensIssued(uint256 indexed tokenId, address indexed claimer, address receiver, uint256 quantityClaimed);\n\n /// @dev Emitted when new claim conditions are set for a token.\n event ClaimConditionsUpdated(uint256 indexed tokenId, ClaimCondition[] claimConditions);\n\n /**\n * @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.\n *\n * @param tokenId The token ID for which to set mint conditions.\n * @param phases Claim conditions in ascending order by `startTimestamp`.\n * @param resetClaimEligibility Whether to reset `limitLastClaimTimestamp` and\n * `limitMerkleProofClaim` values when setting new\n * claim conditions.\n */\n function setClaimConditions(\n uint256 tokenId,\n ClaimCondition[] calldata phases,\n bool resetClaimEligibility\n ) external;\n\n /**\n * @notice Lets an account with ISSUER_ROLE issue NFTs.\n *\n * @param receiver The receiver of the NFTs to claim.\n * @param tokenId The unique ID of the token to claim.\n * @param quantity The quantity of NFTs to claim.\n */\n function issue(\n address receiver,\n uint256 tokenId,\n uint256 quantity\n ) external;\n}\n\ninterface IRestrictedSFTIssuanceV3 is IRestrictedSFTIssuanceV2 {\n /// @dev Sets and Freezes the tokenURI of a specific token which overrides the one that would otherwise\n /// be generated from the baseURI. This function keeps tracks of whether the tokenURI or baseURI is fresher for a\n /// particular token. Emits a \"TokenURIUpdated\" and a \"PermanentURI\" event.\n function setPermantentTokenURI(uint256 tokenId, string memory _tokenURI) external;\n\n /// @dev Event emitted when permanent token uri is set\n event PermanentURI(string _value, uint256 indexed _id);\n\n /// @dev Sets the tokenURI of a specific token which overrides the one that would otherwise\n /// be generated from the baseURI. This function keeps tracks of whether the tokenURI or baseURI is fresher for a\n /// particular token. Emits TokenURIUpdated event.\n function setTokenURI(uint256 tokenId, string memory _tokenURI) external;\n\n /// @dev Event emitted when a token uri is update\n event TokenURIUpdated(uint256 indexed tokenId, address indexed updater, string tokenURI);\n}\n\ninterface IRestrictedSFTIssuanceV4 is IDropClaimConditionV1 {\n /// @dev Emitted when tokens are issued.\n event TokensIssued(\n uint256 indexed tokenId,\n address indexed issuer,\n address indexed receiver,\n uint256 quantityClaimed\n );\n\n /// @dev Emitted when new claim conditions are set for a token.\n event ClaimConditionsUpdated(uint256 indexed tokenId, ClaimCondition[] claimConditions);\n\n /**\n * @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.\n *\n * @param tokenId The token ID for which to set mint conditions.\n * @param phases Claim conditions in ascending order by `startTimestamp`.\n * @param resetClaimEligibility Whether to reset `limitLastClaimTimestamp` and\n * `limitMerkleProofClaim` values when setting new\n * claim conditions.\n */\n function setClaimConditions(\n uint256 tokenId,\n ClaimCondition[] calldata phases,\n bool resetClaimEligibility\n ) external;\n\n /**\n * @notice Lets an account with ISSUER_ROLE issue NFTs.\n *\n * @param receiver The receiver of the NFTs to claim.\n * @param tokenId The unique ID of the token to claim.\n * @param quantity The quantity of NFTs to claim.\n */\n function issue(\n address receiver,\n uint256 tokenId,\n uint256 quantity\n ) external;\n\n /// @dev Issue quantity tokens directly to receiver, only callable by ISSUER_ROLE. Emits TokensIssued event.\n /// It verifies the issue in a similar way as claim() and record the claimed tokens\n /// @param receiver The receiver of the NFTs to claim.\n /// @param tokenId The unique ID of the token to claim.\n /// @param quantity The quantity of NFTs to claim.\n /// Emits TokenIssued event.\n function issueWithinPhase(\n address receiver,\n uint256 tokenId,\n uint256 quantity\n ) external;\n\n /// @dev Sets and Freezes the tokenURI of a specific token which overrides the one that would otherwise\n /// be generated from the baseURI. This function keeps tracks of whether the tokenURI or baseURI is fresher for a\n /// particular token. Emits a \"TokenURIUpdated\" and a \"PermanentURI\" event.\n function setPermantentTokenURI(uint256 tokenId, string memory _tokenURI) external;\n\n /// @dev Event emitted when permanent token uri is set\n event PermanentURI(string _value, uint256 indexed _id);\n\n /// @dev Sets the tokenURI of a specific token which overrides the one that would otherwise\n /// be generated from the baseURI. This function keeps tracks of whether the tokenURI or baseURI is fresher for a\n /// particular token. Emits TokenURIUpdated event.\n function setTokenURI(uint256 tokenId, string memory _tokenURI) external;\n\n /// @dev Event emitted when a token uri is update\n event TokenURIUpdated(uint256 indexed tokenId, address indexed updater, string tokenURI);\n}\n" }, "contracts/aspen/api/issuance/IDropClaimCondition.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/structs/BitMapsUpgradeable.sol\";\n\n/**\n * Cedar's 'Drop' contracts are distribution mechanisms for tokens.\n *\n * A contract admin (i.e. a holder of `DEFAULT_ADMIN_ROLE`) can set a series of claim conditions,\n * ordered by their respective `startTimestamp`. A claim condition defines criteria under which\n * accounts can mint tokens. Claim conditions can be overwritten or added to by the contract admin.\n * At any moment, there is only one active claim condition.\n */\n\ninterface IDropClaimConditionV0 {\n /**\n * @notice The criteria that make up a claim condition.\n *\n * @param startTimestamp The unix timestamp after which the claim condition applies.\n * The same claim condition applies until the `startTimestamp`\n * of the next claim condition.\n *\n * @param maxClaimableSupply The maximum total number of tokens that can be claimed under\n * the claim condition.\n *\n * @param supplyClaimed At any given point, the number of tokens that have been claimed\n * under the claim condition.\n *\n * @param quantityLimitPerTransaction The maximum number of tokens that can be claimed in a single\n * transaction.\n *\n * @param waitTimeInSecondsBetweenClaims The least number of seconds an account must wait after claiming\n * tokens, to be able to claim tokens again.\n *\n * @param merkleRoot The allowlist of addresses that can claim tokens under the claim\n * condition.\n *\n * @param pricePerToken The price required to pay per token claimed.\n *\n * @param currency The currency in which the `pricePerToken` must be paid.\n */\n struct ClaimCondition {\n uint256 startTimestamp;\n uint256 maxClaimableSupply;\n uint256 supplyClaimed;\n uint256 quantityLimitPerTransaction;\n uint256 waitTimeInSecondsBetweenClaims;\n bytes32 merkleRoot;\n uint256 pricePerToken;\n address currency;\n }\n\n /**\n * @notice The set of all claim conditions, at any given moment.\n * Claim Phase ID = [currentStartId, currentStartId + length - 1];\n *\n * @param currentStartId The uid for the first claim condition amongst the current set of\n * claim conditions. The uid for each next claim condition is one\n * more than the previous claim condition's uid.\n *\n * @param count The total number of phases / claim conditions in the list\n * of claim conditions.\n *\n * @param phases The claim conditions at a given uid. Claim conditions\n * are ordered in an ascending order by their `startTimestamp`.\n *\n * @param claimDetails Map from an account and uid for a claim condition, to the claim\n * records an account has done.\n *\n */\n struct ClaimConditionList {\n uint256 currentStartId;\n uint256 count;\n mapping(uint256 => ClaimCondition) phases;\n mapping(uint256 => mapping(address => ClaimDetails)) userClaims;\n }\n\n /**\n * @notice Claim detail for a user claim.\n *\n * @param lastClaimTimestamp The timestamp at which the last token was claimed.\n *\n * @param claimedBalance The number of tokens claimed.\n *\n */\n struct ClaimDetails {\n uint256 lastClaimTimestamp;\n uint256 claimedBalance;\n }\n}\n\ninterface IDropClaimConditionV1 {\n /**\n * @notice The criteria that make up a claim condition.\n *\n * @param startTimestamp The unix timestamp after which the claim condition applies.\n * The same claim condition applies until the `startTimestamp`\n * of the next claim condition.\n *\n * @param maxClaimableSupply The maximum total number of tokens that can be claimed under\n * the claim condition.\n *\n * @param supplyClaimed At any given point, the number of tokens that have been claimed\n * under the claim condition.\n *\n * @param quantityLimitPerTransaction The maximum number of tokens that can be claimed in a single\n * transaction.\n *\n * @param waitTimeInSecondsBetweenClaims The least number of seconds an account must wait after claiming\n * tokens, to be able to claim tokens again.\n *\n * @param merkleRoot The allowlist of addresses that can claim tokens under the claim\n * condition.\n *\n * @param pricePerToken The price required to pay per token claimed.\n *\n * @param currency The currency in which the `pricePerToken` must be paid.\n */\n struct ClaimCondition {\n uint256 startTimestamp;\n uint256 maxClaimableSupply;\n uint256 supplyClaimed;\n uint256 quantityLimitPerTransaction;\n uint256 waitTimeInSecondsBetweenClaims;\n bytes32 merkleRoot;\n uint256 pricePerToken;\n address currency;\n bytes32 phaseId;\n }\n\n /**\n * @notice The set of all claim conditions, at any given moment.\n * Claim Phase ID = [currentStartId, currentStartId + length - 1];\n *\n * @param currentStartId The uid for the first claim condition amongst the current set of\n * claim conditions. The uid for each next claim condition is one\n * more than the previous claim condition's uid.\n *\n * @param count The total number of phases / claim conditions in the list\n * of claim conditions.\n *\n * @param phases The claim conditions at a given uid. Claim conditions\n * are ordered in an ascending order by their `startTimestamp`.\n *\n * @param claimDetails Map from an account and uid for a claim condition, to the claim\n * records an account has done.\n *\n */\n struct ClaimConditionList {\n uint256 currentStartId;\n uint256 count;\n mapping(uint256 => ClaimCondition) phases;\n mapping(uint256 => mapping(address => ClaimDetails)) userClaims;\n }\n\n /**\n * @notice Claim detail for a user claim.\n *\n * @param lastClaimTimestamp The timestamp at which the last token was claimed.\n *\n * @param claimedBalance The number of tokens claimed.\n *\n */\n struct ClaimDetails {\n uint256 lastClaimTimestamp;\n uint256 claimedBalance;\n }\n}\n" }, "contracts/aspen/api/issuance/ISFTClaimCount.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface IRestrictedSFTClaimCountV0 {\n /// @dev Emitted when the wallet claim count for a given tokenId and address is updated.\n event WalletClaimCountUpdated(uint256 tokenId, address indexed wallet, uint256 count);\n /// @dev Emitted when the max wallet claim count for a given tokenId is updated.\n event MaxWalletClaimCountUpdated(uint256 tokenId, uint256 count);\n\n /// @dev Lets a contract admin set a claim count for a wallet.\n function setWalletClaimCount(\n uint256 _tokenId,\n address _claimer,\n uint256 _count\n ) external;\n\n /// @dev Lets a contract admin set a maximum number of NFTs of a tokenId that can be claimed by any wallet.\n function setMaxWalletClaimCount(uint256 _tokenId, uint256 _count) external;\n}\n" }, "contracts/aspen/api/issuance/ISFTLimitSupply.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface IRestrictedSFTLimitSupplyV0 {\n function setMaxTotalSupply(uint256 _tokenId, uint256 _maxTotalSupply) external;\n}\n\ninterface IRestrictedSFTLimitSupplyV1 is IRestrictedSFTLimitSupplyV0 {\n /// @dev Emitted when the global max supply of tokens is updated.\n event MaxTotalSupplyUpdated(uint256 tokenId, uint256 maxTotalSupply);\n}\n" }, "contracts/aspen/api/issuance/ISFTSupply.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8;\n\ninterface ISFTSupplyV0 {\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) external view returns (uint256);\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) external view returns (bool);\n\n /**\n * @dev Amount of unique tokens minted.\n */\n function getLargestTokenId() external view returns (uint256);\n}\n\ninterface ISFTSupplyV1 is ISFTSupplyV0 {\n /// @dev Offset for token IDs.\n function getSmallestTokenId() external view returns (uint8);\n}\n\ninterface IPublicSFTSupplyV0 {\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) external view returns (uint256);\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) external view returns (bool);\n}\n\ninterface IDelegatedSFTSupplyV0 {\n /**\n * @dev Amount of unique tokens minted.\n */\n function getLargestTokenId() external view returns (uint256);\n\n /// @dev Offset for token IDs.\n function getSmallestTokenId() external view returns (uint8);\n}\n" }, "contracts/aspen/api/lazymint/ILazyMint.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8.4;\n\ninterface ICedarLazyMintV0 {\n /// @dev Emitted when tokens are lazy minted.\n event TokensLazyMinted(uint256 startTokenId, uint256 endTokenId, string baseURI);\n\n /**\n * @notice Lets an account with `MINTER_ROLE` lazy mint 'n' NFTs.\n * The URIs for each token is the provided `_baseURIForTokens` + `{tokenId}`.\n *\n * @param amount The amount of NFTs to lazy mint.\n * @param baseURIForTokens The URI for the NFTs to lazy mint. If lazy minting\n * 'delayed-reveal' NFTs, the is a URI for NFTs in the\n * un-revealed state.\n */\n function lazyMint(uint256 amount, string calldata baseURIForTokens) external;\n}\n\ninterface IRestrictedLazyMintV0 {\n /**\n * @notice Lets an account with `MINTER_ROLE` lazy mint 'n' NFTs.\n * The URIs for each token is the provided `_baseURIForTokens` + `{tokenId}`.\n *\n * @param amount The amount of NFTs to lazy mint.\n * @param baseURIForTokens The URI for the NFTs to lazy mint. If lazy minting\n * 'delayed-reveal' NFTs, the is a URI for NFTs in the\n * un-revealed state.\n */\n function lazyMint(uint256 amount, string calldata baseURIForTokens) external;\n}\n\ninterface IRestrictedLazyMintV1 is IRestrictedLazyMintV0 {\n /// @dev Emitted when tokens are lazy minted.\n event TokensLazyMinted(uint256 startTokenId, uint256 endTokenId, string baseURI);\n}\n" }, "contracts/aspen/api/metadata/IContractMetadata.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface ICedarMetadataV1 {\n /// @dev Contract level metadata.\n function contractURI() external view returns (string memory);\n\n /// @dev Lets a contract admin set the URI for contract-level metadata.\n function setContractURI(string calldata _uri) external;\n\n /// @dev Emitted when contractURI is updated\n event ContractURIUpdated(address indexed updater, string uri);\n}\n\ninterface IPublicMetadataV0 {\n /// @dev Contract level metadata.\n function contractURI() external view returns (string memory);\n}\n\ninterface IRestrictedMetadataV0 {\n /// @dev Lets a contract admin set the URI for contract-level metadata.\n function setContractURI(string calldata _uri) external;\n}\n\ninterface IRestrictedMetadataV1 is IRestrictedMetadataV0 {\n /// @dev Emitted when contractURI is updated\n event ContractURIUpdated(address indexed updater, string uri);\n}\n\ninterface IRestrictedMetadataV2 is IRestrictedMetadataV1 {\n /// @dev Lets a contract admin set the token name and symbol\n function setTokenNameAndSymbol(string calldata _name, string calldata _symbol) external;\n\n /// @dev Emitted when token name and symbol are updated\n event TokenNameAndSymbolUpdated(address indexed updater, string name, string symbol);\n}\n" }, "contracts/aspen/api/metadata/ISFTMetadata.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface ICedarSFTMetadataV1 {\n /// @dev Returns the URI for a given tokenId.\n function uri(uint256 _tokenId) external view returns (string memory);\n}\n\ninterface IAspenSFTMetadataV1 {\n /// @dev Returns the URI for a given tokenId.\n function uri(uint256 _tokenId) external view returns (string memory);\n}\n" }, "contracts/aspen/api/ownable/IOwnable.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface IOwnableV0 {\n /// @dev Returns the owner of the contract.\n function owner() external view returns (address);\n\n /// @dev Lets a module admin set a new owner for the contract. The new owner must be a module admin.\n function setOwner(address _newOwner) external;\n\n /// @dev Emitted when a new Owner is set.\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n}\n\ninterface IOwnableEventV0 {\n /// @dev Emitted when a new Owner is set.\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n}\n\ninterface IPublicOwnableV0 is IOwnableEventV0 {\n /// @dev Returns the owner of the contract.\n function owner() external view returns (address);\n}\n\ninterface IRestrictedOwnableV0 is IOwnableEventV0 {\n /// @dev Lets a module admin set a new owner for the contract. The new owner must be a module admin.\n function setOwner(address _newOwner) external;\n}\n" }, "contracts/aspen/api/pausable/IPausable.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface ICedarPausableV0 {\n /// @dev Pause claim functionality.\n function pauseClaims() external;\n\n /// @dev Un-pause claim functionality.\n function unpauseClaims() external;\n\n /// @dev Event emitted when claim functionality is paused/un-paused.\n event ClaimPauseStatusUpdated(bool pauseStatus);\n}\n\ninterface ICedarPausableV1 {\n /// @dev Pause / Un-pause claim functionality.\n function setClaimPauseStatus(bool _pause) external;\n\n /// @dev Event emitted when claim functionality is paused/un-paused.\n event ClaimPauseStatusUpdated(bool pauseStatus);\n}\n\ninterface IRestrictedPausableV0 {\n /// @dev Pause / Un-pause claim functionality.\n function setClaimPauseStatus(bool _pause) external;\n}\n\ninterface IRestrictedPausableV1 is IRestrictedPausableV0 {\n /// @dev Event emitted when claim functionality is paused/un-paused.\n event ClaimPauseStatusUpdated(bool pauseStatus);\n}\n\ninterface IPublicPausableV0 {\n /// @dev returns the pause status of the drop contract.\n function getClaimPauseStatus() external view returns (bool pauseStatus);\n}\n\ninterface IDelegatedPausableV0 {\n /// @dev returns the pause status of the drop contract.\n function getClaimPauseStatus() external view returns (bool pauseStatus);\n}\n" }, "contracts/aspen/api/primarysale/IPrimarySale.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\ninterface IPrimarySaleV0 {\n /// @dev The address that receives all primary sales value.\n function primarySaleRecipient() external view returns (address);\n\n /// @dev Lets a module admin set the default recipient of all primary sales.\n function setPrimarySaleRecipient(address _saleRecipient) external;\n\n /// @dev Emitted when a new sale recipient is set.\n event PrimarySaleRecipientUpdated(address indexed recipient);\n}\n\ninterface IPrimarySaleV1 {\n /// @dev The address that receives all primary sales value.\n function primarySaleRecipient() external view returns (address);\n\n /// @dev Lets a module admin set the default recipient of all primary sales.\n function setPrimarySaleRecipient(address _saleRecipient) external;\n\n /// @dev Emitted when a new sale recipient is set.\n event PrimarySaleRecipientUpdated(address indexed recipient, bool frogs);\n}\n\ninterface IPublicPrimarySaleV1 {\n /// @dev The address that receives all primary sales value.\n function primarySaleRecipient() external view returns (address);\n}\n\ninterface IRestrictedPrimarySaleV1 {\n /// @dev Lets a module admin set the default recipient of all primary sales.\n function setPrimarySaleRecipient(address _saleRecipient) external;\n}\n\ninterface IRestrictedPrimarySaleV2 is IRestrictedPrimarySaleV1 {\n /// @dev Emitted when a new sale recipient is set.\n event PrimarySaleRecipientUpdated(address indexed recipient);\n}\n\n// NOTE: The below feature only exists on ERC1155 atm, therefore new interface that handles only that\ninterface IRestrictedSFTPrimarySaleV0 {\n /// @dev Lets a contract admin set the recipient for all primary sales.\n function setSaleRecipientForToken(uint256 _tokenId, address _saleRecipient) external;\n\n /// @dev Emitted when the sale recipient for a particular tokenId is updated.\n event SaleRecipientForTokenUpdated(uint256 indexed tokenId, address saleRecipient);\n}\n" }, "contracts/aspen/api/royalties/IPlatformFee.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\n// NOTE: Deprecated from v2 onwards\ninterface IPublicPlatformFeeV0 {\n /// @dev Returns the platform fee bps and recipient.\n function getPlatformFeeInfo() external view returns (address, uint16);\n}\n\ninterface IDelegatedPlatformFeeV0 {\n /// @dev Returns the platform fee bps and recipient.\n function getPlatformFeeInfo() external view returns (address platformFeeRecipient, uint16 platformFeeBps);\n}\n\ninterface IRestrictedPlatformFeeV0 {\n /// @dev Emitted when fee on primary sales is updated.\n event PlatformFeeInfoUpdated(address platformFeeRecipient, uint256 platformFeeBps);\n\n /// @dev Lets a module admin update the fees on primary sales.\n function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external;\n}\n" }, "contracts/aspen/api/royalties/IRoyalty.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\nimport \"../standard/IERC2981.sol\";\n\ninterface IRoyaltyV0 is IERC2981V0 {\n struct RoyaltyInfo {\n address recipient;\n uint256 bps;\n }\n\n /// @dev Returns the royalty recipient and fee bps.\n function getDefaultRoyaltyInfo() external view returns (address, uint16);\n\n /// @dev Lets a module admin update the royalty bps and recipient.\n function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external;\n\n /// @dev Lets a module admin set the royalty recipient for a particular token Id.\n function setRoyaltyInfoForToken(\n uint256 tokenId,\n address recipient,\n uint256 bps\n ) external;\n\n /// @dev Returns the royalty recipient for a particular token Id.\n function getRoyaltyInfoForToken(uint256 tokenId) external view returns (address, uint16);\n\n /// @dev Emitted when royalty info is updated.\n event DefaultRoyalty(address newRoyaltyRecipient, uint256 newRoyaltyBps);\n\n /// @dev Emitted when royalty recipient for tokenId is set\n event RoyaltyForToken(uint256 indexed tokenId, address royaltyRecipient, uint256 royaltyBps);\n}\n\ninterface IPublicRoyaltyV0 is IERC2981V0 {\n struct RoyaltyInfo {\n address recipient;\n uint256 bps;\n }\n\n /// @dev Returns the royalty recipient and fee bps.\n function getDefaultRoyaltyInfo() external view returns (address, uint16);\n\n /// @dev Returns the royalty recipient for a particular token Id.\n function getRoyaltyInfoForToken(uint256 tokenId) external view returns (address, uint16);\n}\n\ninterface IRestrictedRoyaltyV0 {\n /// @dev Lets a module admin update the royalty bps and recipient.\n function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external;\n\n /// @dev Lets a module admin set the royalty recipient for a particular token Id.\n function setRoyaltyInfoForToken(\n uint256 tokenId,\n address recipient,\n uint256 bps\n ) external;\n}\n\ninterface IRestrictedRoyaltyV1 is IRestrictedRoyaltyV0 {\n /// @dev Emitted when royalty info is updated.\n event DefaultRoyalty(address newRoyaltyRecipient, uint256 newRoyaltyBps);\n /// @dev Emitted when royalty recipient for tokenId is set\n event RoyaltyForToken(uint256 indexed tokenId, address royaltyRecipient, uint256 royaltyBps);\n}\n\ninterface IRestrictedRoyaltyV2 is IRestrictedRoyaltyV1 {\n /// @dev Emitted when the operator filter is updated.\n event OperatorFilterStatusUpdated(bool enabled);\n\n /// @dev allows an admin to enable / disable the operator filterer.\n function setOperatorFiltererStatus(bool _enabled) external;\n}\n\ninterface IPublicOperatorFilterToggleV0 {\n function operatorRestriction() external view returns (bool);\n}\n\ninterface IRestrictedOperatorFilterToggleV0 {\n event OperatorRestriction(bool _restriction);\n\n function setOperatorRestriction(bool _restriction) external;\n}\n\ninterface IRestrictedOperatorFiltererV0 {\n event OperatorFiltererUpdated(bytes32 _operatorFiltererId);\n\n function setOperatorFilterer(bytes32 _operatorFiltererId) external;\n}\n" }, "contracts/aspen/api/standard/IERC1155.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\";\n\ninterface IERC1155V0 is IERC1155Upgradeable {}\n\ninterface IERC1155V1 is IERC1155Upgradeable {\n function burn(\n address account,\n uint256 id,\n uint256 value\n ) external;\n\n function burnBatch(\n address account,\n uint256[] memory ids,\n uint256[] memory values\n ) external;\n}\n\ninterface IERC1155V2 is IERC1155V1 {\n function name() external returns (string memory);\n\n function symbol() external returns (string memory);\n}\n\ninterface IERC1155V3 is IERC1155V1 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n}\n\ninterface IERC1155SupplyV0 is IERC1155V0 {\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) external view returns (uint256);\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) external view returns (bool);\n}\n\ninterface IERC1155SupplyV1 is IERC1155SupplyV0 {\n /**\n * @dev Amount of unique tokens minted.\n */\n function getLargestTokenId() external view returns (uint256);\n}\n\ninterface IERC1155SupplyV2 is IERC1155V1 {\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) external view returns (uint256);\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) external view returns (bool);\n\n /**\n * @dev Amount of unique tokens minted.\n */\n function getLargestTokenId() external view returns (uint256);\n}\n" }, "contracts/aspen/api/standard/IERC2981.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8;\n\ninterface IERC2981V0 {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be payed in that same unit of exchange.\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n returns (address receiver, uint256 royaltyAmount);\n}\n" }, "contracts/aspen/api/standard/IERC4906.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8;\n\n// Note: So that it can be included in Delegated logic contract\ninterface IRestrictedERC4906V0 {\n /// @dev This event emits when the metadata of a token is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFT.\n event MetadataUpdate(uint256 _tokenId);\n\n /// @dev This event emits when the metadata of a range of tokens is changed.\n /// So that the third-party platforms such as NFT market could\n /// timely update the images and related attributes of the NFTs.\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n}\n" }, "contracts/aspen/drop/AspenERC1155Drop.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\n///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// //\n// _' AAA //\n// !jz_ A:::A //\n// ;Lzzzz- A:::::A //\n// '1zzzzxzz' A:::::::A //\n// !xzzzzzzi~ A:::::::::A ssssssssss ppppp ppppppppp eeeeeeeeeeee nnnn nnnnnnnn //\n// ;izzzzzzj^` A:::::A:::::A ss::::::::::s p::::ppp:::::::::p ee::::::::::::ee n:::nn::::::::nn //\n// `;^.````` A:::::A A:::::A ss:::::::::::::s p:::::::::::::::::p e::::::eeeee:::::een::::::::::::::nn //\n// -;;;;;;;- A:::::A A:::::A s::::::ssss:::::spp::::::ppppp::::::pe::::::e e:::::enn:::::::::::::::n //\n// .;;;;;;;_ A:::::A A:::::A s:::::s ssssss p:::::p p:::::pe:::::::eeeee::::::e n:::::nnnn:::::n //\n// ;;;;;;;;` A:::::AAAAAAAAA:::::A s::::::s p:::::p p:::::pe:::::::::::::::::e n::::n n::::n //\n// _;;;;;;;' A:::::::::::::::::::::A s::::::s p:::::p p:::::pe::::::eeeeeeeeeee n::::n n::::n //\n// ;{jjjjjjjjj A:::::AAAAAAAAAAAAA:::::A ssssss s:::::s p:::::p p::::::pe:::::::e n::::n n::::n //\n// `+IIIVVVVVVVVI` A:::::A A:::::A s:::::ssss::::::s p:::::ppppp:::::::pe::::::::e n::::n n::::n //\n// ^sIVVVVVVVVVVVVI` A:::::A A:::::As::::::::::::::s p::::::::::::::::p e::::::::eeeeeeee n::::n n::::n //\n// ~xIIIVVVVVVVVVVVVVI` A:::::A A:::::As:::::::::::ss p::::::::::::::pp ee:::::::::::::e n::::n n::::n //\n// -~~~;;;;;;;;;;;;;;;;; AAAAAAA AAAAAAAsssssssssss p::::::pppppppp eeeeeeeeeeeeee nnnnnn nnnnnn //\n// p:::::p //\n// p:::::p //\n// p:::::::p //\n// p:::::::p //\n// p:::::::p //\n// ppppppppp //\n// //\n// Website: https://aspenft.io/ //\n// Twitter: https://twitter.com/aspenft //\n// //\n///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\npragma solidity ^0.8;\n\n// ========== External imports ==========\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/// ========== Features ==========\nimport \"./openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol\";\nimport \"../generated/impl/BaseAspenERC1155DropV2.sol\";\n\nimport \"./lib/FeeType.sol\";\nimport \"./lib/MerkleProof.sol\";\n\nimport \"./types/DropERC1155DataTypes.sol\";\nimport \"./AspenERC1155DropLogic.sol\";\n\nimport \"../terms/types/TermsDataTypes.sol\";\nimport \"../terms/lib/TermsLogic.sol\";\n\nimport \"./AspenERC1155DropStorage.sol\";\nimport \"../api/deploy/types/DropFactoryDataTypes.sol\";\nimport \"../api/issuance/IDropClaimCondition.sol\";\nimport \"../api/errors/IDropErrors.sol\";\n\n/// @title The AspenERC1155Drop contract\ncontract AspenERC1155Drop is AspenERC1155DropStorage, BaseAspenERC1155DropV2 {\n /// ================================\n /// =========== Libraries ==========\n /// ================================\n using StringsUpgradeable for uint256;\n using TermsLogic for TermsDataTypes.Terms;\n using AspenERC1155DropLogic for DropERC1155DataTypes.ClaimData;\n\n /// ====================================================\n /// ========== Constructor + initializer logic =========\n /// ====================================================\n constructor() {}\n\n /// @dev Initializes the contract, like a constructor.\n function initialize(IDropFactoryDataTypesV0.DropConfig memory _config) external initializer {\n // Initialize inherited contracts, most base-like -> most derived.\n __ReentrancyGuard_init();\n __ERC2771Context_init_unchained(_config.tokenDetails.trustedForwarders);\n __ERC1155_init_unchained(\"\");\n __EIP712_init(_config.tokenDetails.name, \"1.0.0\");\n\n __UpdateableDefaultOperatorFiltererUpgradeable_init(_config.operatorFilterer);\n\n aspenConfig = IGlobalConfigV0(_config.aspenConfig);\n\n // Initialize this contract's state.\n __name = _config.tokenDetails.name;\n __symbol = _config.tokenDetails.symbol;\n _owner = _config.tokenDetails.defaultAdmin;\n _contractUri = _config.tokenDetails.contractURI;\n\n claimData.royaltyRecipient = _config.feeDetails.royaltyRecipient;\n claimData.royaltyBps = uint16(_config.feeDetails.royaltyBps);\n claimData.primarySaleRecipient = _config.feeDetails.saleRecipient;\n\n claimData.nextTokenIdToMint = TOKEN_INDEX_OFFSET;\n\n // Agreement initialize\n termsData.termsURI = _config.tokenDetails.userAgreement;\n // We set the terms version to 1 if there is an actual termsURL\n if (bytes(_config.tokenDetails.userAgreement).length > 0) {\n termsData.termsVersion = 1;\n termsData.termsActivated = true;\n }\n delegateLogicContract = _config.dropDelegateLogic;\n operatorRestriction = true;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _config.tokenDetails.defaultAdmin);\n _setupRole(MINTER_ROLE, _config.tokenDetails.defaultAdmin);\n _setupRole(TRANSFER_ROLE, _config.tokenDetails.defaultAdmin);\n _setupRole(TRANSFER_ROLE, address(0));\n _setupRole(ISSUER_ROLE, _config.tokenDetails.defaultAdmin);\n\n emit OwnershipTransferred(address(0), _config.tokenDetails.defaultAdmin);\n }\n\n fallback() external {\n // get facet from function selector\n address logic = delegateLogicContract;\n require(logic != address(0));\n // Execute external function from delegate logic contract using delegatecall and return any value.\n assembly {\n // copy function selector and any arguments\n calldatacopy(0, 0, calldatasize())\n // execute function call using the facet\n let result := delegatecall(gas(), logic, 0, calldatasize(), 0, 0)\n // get any return value\n returndatacopy(0, 0, returndatasize())\n // return any return value or error back to the caller\n switch result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /// ============================================\n /// ========== Generic contract logic ==========\n /// ============================================\n /// @dev Returns the address of the current owner.\n function owner() public view override returns (address) {\n return _owner;\n }\n\n /// @dev Returns the name of the token.\n function name() public view override returns (string memory) {\n return __name;\n }\n\n /// @dev Returns the symbol of the token.\n function symbol() public view override returns (string memory) {\n return __symbol;\n }\n\n /// @dev See ERC 1155 - Returns the URI for a given tokenId.\n function uri(uint256 _tokenId)\n public\n view\n virtual\n override(ERC1155Upgradeable, IAspenSFTMetadataV1)\n isValidTokenId(_tokenId)\n returns (string memory _tokenURI)\n {\n return AspenERC1155DropLogic.tokenURI(claimData, _tokenId);\n }\n\n /// @dev See ERC-2891 - Returns the royalty recipient and amount, given a tokenId and sale price.\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n virtual\n override\n isValidTokenId(tokenId)\n returns (address receiver, uint256 royaltyAmount)\n {\n return AspenERC1155DropLogic.royaltyInfo(claimData, tokenId, salePrice);\n }\n\n /// @dev See ERC 165\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(BaseAspenERC1155DropV2, AspenERC1155DropStorage)\n returns (bool)\n {\n return (AspenERC1155DropStorage.supportsInterface(interfaceId) ||\n BaseAspenERC1155DropV2.supportsInterface(interfaceId) ||\n // Support ERC4906\n interfaceId == bytes4(0x49064906));\n }\n\n // More pointless yet required overrides\n function totalSupply(uint256 _tokenId) public view override isValidTokenId(_tokenId) returns (uint256) {\n return claimData.totalSupply[_tokenId];\n }\n\n function exists(uint256 _tokenId) public view override isValidTokenId(_tokenId) returns (bool) {\n return claimData.totalSupply[_tokenId] > 0;\n }\n\n /// ======================================\n /// ============= Claim logic ============\n /// ======================================\n /// @dev Lets an account claim a given quantity of NFTs, of a single tokenId.\n function claim(\n address _receiver,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bytes32[] calldata _proofs,\n uint256 _proofMaxQuantityPerTransaction\n ) external payable override nonReentrant isValidTokenId(_tokenId) {\n address msgSender = _msgSender();\n if (!(isTrustedForwarder(msg.sender) || msgSender == tx.origin)) revert IDropErrorsV0.NotTrustedForwarder();\n if (claimIsPaused) revert IDropErrorsV0.ClaimPaused();\n\n (address platformFeeReceiver, uint16 platformFeeBPS) = aspenConfig.getPlatformFees();\n claimData.platformFeeRecipient = platformFeeReceiver;\n claimData.platformFeeBps = platformFeeBPS;\n\n AspenERC1155DropLogic.InternalClaim memory internalClaim = AspenERC1155DropLogic.executeClaim(\n claimData,\n _tokenId,\n _quantity,\n _currency,\n _pricePerToken,\n _proofs,\n _proofMaxQuantityPerTransaction,\n msgSender\n );\n _mint(_receiver, _tokenId, _quantity, \"\");\n emit TokensClaimed(\n internalClaim.activeConditionId,\n msgSender,\n _receiver,\n _tokenId,\n _quantity,\n internalClaim.phaseId\n );\n }\n\n /// ======================================\n /// ============ Agreement ===============\n /// ======================================\n /// @notice by signing this transaction, you are confirming that you have read and agreed to the terms of use at `termsUrl`\n function acceptTerms() external override {\n termsData.acceptTerms(_msgSender());\n emit TermsAccepted(termsData.termsURI, termsData.termsVersion, _msgSender());\n }\n\n /// @notice returns the details of the terms\n /// @return termsURI - the URI of the terms\n /// @return termsVersion - the version of the terms\n /// @return termsActivated - the status of the terms\n function getTermsDetails()\n external\n view\n override\n returns (\n string memory termsURI,\n uint8 termsVersion,\n bool termsActivated\n )\n {\n return termsData.getTermsDetails();\n }\n\n /// @notice returns true if an address has accepted the terms\n function hasAcceptedTerms(address _address) external view override returns (bool hasAccepted) {\n hasAccepted = termsData.hasAcceptedTerms(_address);\n }\n\n /// @notice returns true if an address has accepted the terms\n function hasAcceptedTerms(address _address, uint8 _termsVersion) external view override returns (bool hasAccepted) {\n hasAccepted = termsData.hasAcceptedTerms(_address, _termsVersion);\n }\n\n /// ======================================\n /// ========== Getter functions ==========\n /// ======================================\n /// @dev Contract level metadata.\n function contractURI() external view override(IPublicMetadataV0) returns (string memory) {\n return _contractUri;\n }\n\n /// @dev Returns the sale recipient address.\n function primarySaleRecipient() external view override returns (address) {\n return claimData.primarySaleRecipient;\n }\n\n /// @dev Returns the default royalty recipient and bps.\n function getDefaultRoyaltyInfo() external view override returns (address, uint16) {\n return (claimData.royaltyRecipient, uint16(claimData.royaltyBps));\n }\n\n /// @dev Returns the royalty recipient and bps for a particular token Id.\n function getRoyaltyInfoForToken(uint256 _tokenId)\n public\n view\n override\n isValidTokenId(_tokenId)\n returns (address, uint16)\n {\n return AspenERC1155DropLogic.getRoyaltyInfoForToken(claimData, _tokenId);\n }\n\n /// ======================================\n /// ==== OS Default Operator Filterer ====\n /// ======================================\n function setApprovalForAll(address operator, bool approved)\n public\n override(ERC1155Upgradeable, IERC1155Upgradeable)\n onlyAllowedOperatorApproval(operator)\n {\n super.setApprovalForAll(operator, approved);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n uint256 amount,\n bytes memory data\n ) public override(ERC1155Upgradeable, IERC1155Upgradeable) onlyAllowedOperator(from) {\n super.safeTransferFrom(from, to, tokenId, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override(ERC1155Upgradeable, IERC1155Upgradeable) onlyAllowedOperator(from) {\n super.safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /// ======================================\n /// =========== Miscellaneous ============\n /// ======================================\n /// @dev Concrete implementation semantic version -\n /// provided for completeness but not designed to be the point of dispatch\n function minorVersion() public pure override returns (uint256 minor, uint256 patch) {\n minor = 0;\n patch = 0;\n }\n\n /// @dev Lets a token owner burn the tokens they own (i.e. destroy for good)\n function burn(\n address account,\n uint256 id,\n uint256 value\n ) public virtual {\n if (!(account == _msgSender() || isApprovedForAll(account, _msgSender())))\n revert IDropErrorsV0.InvalidPermission();\n _burn(account, id, value);\n }\n\n /// @dev Lets a token owner burn multiple tokens they own at once (i.e. destroy for good)\n function burnBatch(\n address account,\n uint256[] memory ids,\n uint256[] memory values\n ) public virtual {\n if (!(account == _msgSender() || isApprovedForAll(account, _msgSender())))\n revert IDropErrorsV0.InvalidPermission();\n _burnBatch(account, ids, values);\n }\n\n /// @dev Provides a function to batch together multiple calls in a single external call.\n function multicall(bytes[] calldata data) external override returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n results[i] = Address.functionDelegateCall(address(this), data[i]);\n }\n return results;\n }\n\n function _msgSender() internal view virtual override returns (address sender) {\n return ERC2771ContextUpgradeable._msgSender();\n }\n\n function _msgData() internal view virtual override returns (bytes calldata) {\n return ERC2771ContextUpgradeable._msgData();\n }\n\n // FIXME: well, fix solc, this is a horrible hack to make these library-emitted events appear in the ABI for this\n // contract\n function __termsNotAccepted() external pure {\n revert IDropErrorsV0.TermsNotAccepted(address(0), \"\", uint8(0));\n }\n}\n" }, "contracts/aspen/drop/AspenERC1155DropLogic.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\n///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// //\n// _' AAA //\n// !jz_ A:::A //\n// ;Lzzzz- A:::::A //\n// '1zzzzxzz' A:::::::A //\n// !xzzzzzzi~ A:::::::::A ssssssssss ppppp ppppppppp eeeeeeeeeeee nnnn nnnnnnnn //\n// ;izzzzzzj^` A:::::A:::::A ss::::::::::s p::::ppp:::::::::p ee::::::::::::ee n:::nn::::::::nn //\n// `;^.````` A:::::A A:::::A ss:::::::::::::s p:::::::::::::::::p e::::::eeeee:::::een::::::::::::::nn //\n// -;;;;;;;- A:::::A A:::::A s::::::ssss:::::spp::::::ppppp::::::pe::::::e e:::::enn:::::::::::::::n //\n// .;;;;;;;_ A:::::A A:::::A s:::::s ssssss p:::::p p:::::pe:::::::eeeee::::::e n:::::nnnn:::::n //\n// ;;;;;;;;` A:::::AAAAAAAAA:::::A s::::::s p:::::p p:::::pe:::::::::::::::::e n::::n n::::n //\n// _;;;;;;;' A:::::::::::::::::::::A s::::::s p:::::p p:::::pe::::::eeeeeeeeeee n::::n n::::n //\n// ;{jjjjjjjjj A:::::AAAAAAAAAAAAA:::::A ssssss s:::::s p:::::p p::::::pe:::::::e n::::n n::::n //\n// `+IIIVVVVVVVVI` A:::::A A:::::A s:::::ssss::::::s p:::::ppppp:::::::pe::::::::e n::::n n::::n //\n// ^sIVVVVVVVVVVVVI` A:::::A A:::::As::::::::::::::s p::::::::::::::::p e::::::::eeeeeeee n::::n n::::n //\n// ~xIIIVVVVVVVVVVVVVI` A:::::A A:::::As:::::::::::ss p::::::::::::::pp ee:::::::::::::e n::::n n::::n //\n// -~~~;;;;;;;;;;;;;;;;; AAAAAAA AAAAAAAsssssssssss p::::::pppppppp eeeeeeeeeeeeee nnnnnn nnnnnn //\n// p:::::p //\n// p:::::p //\n// p:::::::p //\n// p:::::::p //\n// p:::::::p //\n// ppppppppp //\n// //\n// Website: https://aspenft.io/ //\n// Twitter: https://twitter.com/aspenft //\n// //\n///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport \"./lib/CurrencyTransferLib.sol\";\nimport \"./lib/MerkleProof.sol\";\nimport \"./types/DropERC1155DataTypes.sol\";\nimport \"../api/issuance/IDropClaimCondition.sol\";\nimport \"../api/royalties/IRoyalty.sol\";\nimport \"../api/errors/IDropErrors.sol\";\nimport \"../terms/types/TermsDataTypes.sol\";\n\nlibrary AspenERC1155DropLogic {\n using StringsUpgradeable for uint256;\n using AspenERC1155DropLogic for DropERC1155DataTypes.ClaimData;\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n uint256 public constant MAX_UINT256 = 2**256 - 1;\n /// @dev Max basis points (bps) in Aspen system.\n uint256 public constant MAX_BPS = 10_000;\n /// @dev Offset for token IDs.\n uint8 public constant TOKEN_INDEX_OFFSET = 1;\n /// @dev Only transfers to or from TRANSFER_ROLE holders are valid, when transfers are restricted.\n bytes32 public constant TRANSFER_ROLE = keccak256(\"TRANSFER_ROLE\");\n\n struct InternalClaim {\n bool validMerkleProof;\n uint256 merkleProofIndex;\n uint256 activeConditionId;\n uint256 tokenIdToClaim;\n bytes32 phaseId;\n }\n\n function setClaimConditions(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _tokenId,\n IDropClaimConditionV1.ClaimCondition[] calldata _phases,\n bool _resetClaimEligibility\n ) external {\n if ((claimData.nextTokenIdToMint <= _tokenId)) revert IDropErrorsV0.InvalidTokenId(_tokenId);\n IDropClaimConditionV1.ClaimConditionList storage condition = claimData.claimCondition[_tokenId];\n uint256 existingStartIndex = condition.currentStartId;\n uint256 existingPhaseCount = condition.count;\n\n /**\n * `limitLastClaimTimestamp` and `limitMerkleProofClaim` are mappings that use a\n * claim condition's UID as a key.\n *\n * If `_resetClaimEligibility == true`, we assign completely new UIDs to the claim\n * conditions in `_phases`, effectively resetting the restrictions on claims expressed\n * by `limitLastClaimTimestamp` and `limitMerkleProofClaim`.\n */\n uint256 newStartIndex = existingStartIndex;\n if (_resetClaimEligibility) {\n newStartIndex = existingStartIndex + existingPhaseCount;\n }\n\n condition.count = _phases.length;\n condition.currentStartId = newStartIndex;\n\n uint256 lastConditionStartTimestamp;\n bytes32[] memory phaseIds = new bytes32[](_phases.length);\n for (uint256 i = 0; i < _phases.length; i++) {\n if (!(i == 0 || lastConditionStartTimestamp < _phases[i].startTimestamp))\n revert IDropErrorsV0.InvalidTime();\n\n for (uint256 j = 0; j < phaseIds.length; j++) {\n if (phaseIds[j] == _phases[i].phaseId) revert IDropErrorsV0.InvalidPhaseId(_phases[i].phaseId);\n if (i == j) phaseIds[i] = _phases[i].phaseId;\n }\n\n uint256 supplyClaimedAlready = condition.phases[newStartIndex + i].supplyClaimed;\n\n if (_isOutOfLimits(_phases[i].maxClaimableSupply, supplyClaimedAlready))\n revert IDropErrorsV0.CrossedLimitMaxClaimableSupply();\n\n condition.phases[newStartIndex + i] = _phases[i];\n condition.phases[newStartIndex + i].supplyClaimed = supplyClaimedAlready;\n if (_phases[i].maxClaimableSupply == 0)\n condition.phases[newStartIndex + i].maxClaimableSupply = MAX_UINT256;\n\n lastConditionStartTimestamp = _phases[i].startTimestamp;\n }\n\n /**\n * Gas refunds (as much as possible)\n *\n * If `_resetClaimEligibility == true`, we assign completely new UIDs to the claim\n * conditions in `_phases`. So, we delete claim conditions with UID < `newStartIndex`.\n *\n * If `_resetClaimEligibility == false`, and there are more existing claim conditions\n * than in `_phases`, we delete the existing claim conditions that don't get replaced\n * by the conditions in `_phases`.\n */\n if (_resetClaimEligibility) {\n for (uint256 i = existingStartIndex; i < newStartIndex; i++) {\n delete condition.phases[i];\n }\n } else {\n if (existingPhaseCount > _phases.length) {\n for (uint256 i = _phases.length; i < existingPhaseCount; i++) {\n delete condition.phases[newStartIndex + i];\n }\n }\n }\n }\n\n function executeClaim(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bytes32[] calldata _proofs,\n uint256 _proofMaxQuantityPerTransaction,\n address msgSender\n ) public returns (InternalClaim memory internalData) {\n if ((claimData.nextTokenIdToMint <= _tokenId)) revert IDropErrorsV0.InvalidTokenId(_tokenId);\n // Get the active claim condition index.\n internalData.phaseId = claimData.claimCondition[_tokenId].phases[internalData.activeConditionId].phaseId;\n\n (\n internalData.activeConditionId,\n internalData.validMerkleProof,\n internalData.merkleProofIndex\n ) = fullyVerifyClaim(\n claimData,\n msgSender,\n _tokenId,\n _quantity,\n _currency,\n _pricePerToken,\n _proofs,\n _proofMaxQuantityPerTransaction\n );\n\n // If there's a price, collect price.\n collectClaimPrice(claimData, _quantity, _currency, _pricePerToken, _tokenId, msgSender);\n\n // Book-keeping before the calling contract does the actual transfer and mint the relevant NFTs to claimer.\n recordTransferClaimedTokens(claimData, internalData.activeConditionId, _tokenId, _quantity, msgSender);\n }\n\n /// @dev We make allowlist checks (i.e. verifyClaimMerkleProof) before verifying the claim's general\n /// validity (i.e. verifyClaim) because we give precedence to the check of allow list quantity\n /// restriction over the check of the general claim condition's quantityLimitPerTransaction\n /// restriction.\n function fullyVerifyClaim(\n DropERC1155DataTypes.ClaimData storage claimData,\n address _claimer,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bytes32[] calldata _proofs,\n uint256 _proofMaxQuantityPerTransaction\n )\n public\n view\n returns (\n uint256 activeConditionId,\n bool validMerkleProof,\n uint256 merkleProofIndex\n )\n {\n activeConditionId = getActiveClaimConditionId(claimData, _tokenId);\n // Verify inclusion in allowlist.\n (validMerkleProof, merkleProofIndex) = verifyClaimMerkleProof(\n claimData,\n activeConditionId,\n _claimer,\n _tokenId,\n _quantity,\n _proofs,\n _proofMaxQuantityPerTransaction\n );\n\n verifyClaim(claimData, activeConditionId, _claimer, _tokenId, _quantity, _currency, _pricePerToken);\n }\n\n /// @dev Verify inclusion in allow-list.\n function verifyClaimMerkleProof(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _conditionId,\n address _claimer,\n uint256 _tokenId,\n uint256 _quantity,\n bytes32[] calldata _proofs,\n uint256 _proofMaxQuantityPerTransaction\n ) public view returns (bool validMerkleProof, uint256 merkleProofIndex) {\n IDropClaimConditionV1.ClaimCondition memory currentClaimPhase = claimData.claimCondition[_tokenId].phases[\n _conditionId\n ];\n\n if (currentClaimPhase.merkleRoot != bytes32(0)) {\n (validMerkleProof, merkleProofIndex) = MerkleProof.verify(\n _proofs,\n currentClaimPhase.merkleRoot,\n keccak256(abi.encodePacked(_claimer, _proofMaxQuantityPerTransaction))\n );\n\n if (!validMerkleProof) revert IDropErrorsV0.InvalidMerkleProof();\n if (\n !(_proofMaxQuantityPerTransaction == 0 ||\n _quantity <=\n _proofMaxQuantityPerTransaction -\n claimData.claimCondition[_tokenId].userClaims[_conditionId][_claimer].claimedBalance)\n ) revert IDropErrorsV0.InvalidMaxQuantityProof();\n }\n }\n\n /// @dev Checks a request to claim NFTs against the active claim condition's criteria.\n function verifyClaim(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _conditionId,\n address _claimer,\n uint256 _tokenId,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken\n ) public view {\n IDropClaimConditionV1.ClaimCondition memory currentClaimPhase = claimData.claimCondition[_tokenId].phases[\n _conditionId\n ];\n\n if (!(_currency == currentClaimPhase.currency && _pricePerToken == currentClaimPhase.pricePerToken)) {\n revert IDropErrorsV0.InvalidPrice();\n }\n verifyClaimQuantity(claimData, _conditionId, _claimer, _tokenId, _quantity);\n verifyClaimTimestamp(claimData, _conditionId, _claimer, _tokenId);\n }\n\n function verifyClaimQuantity(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _conditionId,\n address _claimer,\n uint256 _tokenId,\n uint256 _quantity\n ) public view {\n if (_quantity == 0) {\n revert IDropErrorsV0.InvalidQuantity();\n }\n\n IDropClaimConditionV1.ClaimCondition memory currentClaimPhase = claimData.claimCondition[_tokenId].phases[\n _conditionId\n ];\n\n if (!(_quantity > 0 && (_quantity <= currentClaimPhase.quantityLimitPerTransaction))) {\n revert IDropErrorsV0.CrossedLimitQuantityPerTransaction();\n }\n if (!(currentClaimPhase.supplyClaimed + _quantity <= currentClaimPhase.maxClaimableSupply)) {\n revert IDropErrorsV0.CrossedLimitMaxClaimableSupply();\n }\n if (_isOutOfLimits(claimData.maxTotalSupply[_tokenId], claimData.totalSupply[_tokenId] + _quantity)) {\n revert IDropErrorsV0.CrossedLimitMaxTotalSupply();\n }\n if (\n _isOutOfLimits(\n claimData.maxWalletClaimCount[_tokenId],\n claimData.walletClaimCount[_tokenId][_claimer] + _quantity\n )\n ) {\n revert IDropErrorsV0.CrossedLimitMaxWalletClaimCount();\n }\n }\n\n function verifyClaimTimestamp(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _conditionId,\n address _claimer,\n uint256 _tokenId\n ) public view {\n (uint256 lastClaimTimestamp, uint256 nextValidClaimTimestamp) = getClaimTimestamp(\n claimData,\n _tokenId,\n _conditionId,\n _claimer\n );\n\n if (!(lastClaimTimestamp == 0 || block.timestamp >= nextValidClaimTimestamp))\n revert IDropErrorsV0.InvalidTime();\n }\n\n function issueWithinPhase(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _tokenId,\n address _receiver,\n uint256 _quantity\n ) external {\n uint256 conditionId = getActiveClaimConditionId(claimData, _tokenId);\n verifyClaimQuantity(claimData, conditionId, _receiver, _tokenId, _quantity);\n recordTransferClaimedTokens(claimData, conditionId, _tokenId, _quantity, _receiver);\n }\n\n /// @dev Collects and distributes the primary sale value of NFTs being claimed.\n function collectClaimPrice(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _quantityToClaim,\n address _currency,\n uint256 _pricePerToken,\n uint256 _tokenId,\n address msgSender\n ) internal {\n if (_pricePerToken == 0) {\n return;\n }\n\n uint256 totalPrice = _quantityToClaim * _pricePerToken;\n uint256 platformFees = (totalPrice * claimData.platformFeeBps) / MAX_BPS;\n\n if (_currency == CurrencyTransferLib.NATIVE_TOKEN && !(msg.value == totalPrice))\n revert IDropErrorsV0.InvalidPaymentAmount();\n\n address recipient = claimData.saleRecipient[_tokenId] == address(0)\n ? claimData.primarySaleRecipient\n : claimData.saleRecipient[_tokenId];\n\n CurrencyTransferLib.transferCurrency(_currency, msgSender, claimData.platformFeeRecipient, platformFees);\n CurrencyTransferLib.transferCurrency(_currency, msgSender, recipient, totalPrice - platformFees);\n }\n\n /// @dev Book-keeping before the calling contract does the actual transfer and mint the relevant NFTs to claimer.\n function recordTransferClaimedTokens(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _conditionId,\n uint256 _tokenId,\n uint256 _quantityBeingClaimed,\n address msgSender\n ) public {\n // Update the supply minted under mint condition.\n claimData.claimCondition[_tokenId].phases[_conditionId].supplyClaimed += _quantityBeingClaimed;\n\n // if transfer claimed tokens is called when to != msg.sender, it'd use msg.sender's limits.\n // behavior would be similar to msg.sender mint for itself, then transfer to `to`.\n claimData.claimCondition[_tokenId].userClaims[_conditionId][msgSender].lastClaimTimestamp = block.timestamp;\n claimData.claimCondition[_tokenId].userClaims[_conditionId][msgSender].claimedBalance += _quantityBeingClaimed;\n claimData.walletClaimCount[_tokenId][msgSender] += _quantityBeingClaimed;\n }\n\n function verifyIssue(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _tokenId,\n uint256 _quantity\n ) external view {\n if (_quantity == 0) {\n revert IDropErrorsV0.InvalidQuantity();\n }\n\n if (_isOutOfLimits(claimData.maxTotalSupply[_tokenId], claimData.totalSupply[_tokenId] + _quantity)) {\n revert IDropErrorsV0.CrossedLimitMaxTotalSupply();\n }\n }\n\n function setTokenURI(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _tokenId,\n string memory _tokenURI,\n bool _isPermanent\n ) public {\n // Interpret empty string as unsetting tokenURI\n if (bytes(_tokenURI).length == 0) {\n claimData.tokenURIs[_tokenId].sequenceNumber = 0;\n return;\n }\n // Bump the sequence first\n claimData.uriSequenceCounter.increment();\n claimData.tokenURIs[_tokenId].uri = _tokenURI;\n claimData.tokenURIs[_tokenId].sequenceNumber = claimData.uriSequenceCounter.current();\n claimData.tokenURIs[_tokenId].isPermanent = _isPermanent;\n }\n\n function tokenURI(DropERC1155DataTypes.ClaimData storage claimData, uint256 _tokenId)\n public\n view\n returns (string memory)\n {\n // Try to fetch possibly overridden tokenURI\n DropERC1155DataTypes.SequencedURI storage _tokenURI = claimData.tokenURIs[_tokenId];\n\n for (uint256 i = 0; i < claimData.baseURIIndices.length; i += 1) {\n if (_tokenId < claimData.baseURIIndices[i] + TOKEN_INDEX_OFFSET) {\n DropERC1155DataTypes.SequencedURI storage _baseURI = claimData.baseURI[\n claimData.baseURIIndices[i] + TOKEN_INDEX_OFFSET\n ];\n if (_tokenURI.sequenceNumber > _baseURI.sequenceNumber || _tokenURI.isPermanent) {\n // If the specifically set tokenURI is fresher than the baseURI OR\n // if the tokenURI is permanet then return that (it is in-force)\n return _tokenURI.uri;\n }\n // Otherwise either there is no override (sequenceNumber == 0) or the baseURI is fresher, so return the\n // baseURI-derived tokenURI\n return string(abi.encodePacked(_baseURI.uri, _tokenId.toString()));\n }\n }\n return \"\";\n }\n\n function lazyMint(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _amount,\n string calldata _baseURIForTokens\n ) public returns (uint256 startId, uint256 baseURIIndex) {\n if (_amount == 0) revert IDropErrorsV0.InvalidNoOfTokenIds();\n claimData.uriSequenceCounter.increment();\n startId = claimData.nextTokenIdToMint;\n baseURIIndex = startId + _amount;\n\n claimData.nextTokenIdToMint = baseURIIndex;\n claimData.baseURI[baseURIIndex].uri = _baseURIForTokens;\n claimData.baseURI[baseURIIndex].sequenceNumber = claimData.uriSequenceCounter.current();\n claimData.baseURI[baseURIIndex].amountOfTokens = _amount;\n claimData.baseURIIndices.push(baseURIIndex - TOKEN_INDEX_OFFSET);\n }\n\n /// @dev Expose the current active claim condition including claim limits\n function getActiveClaimConditions(DropERC1155DataTypes.ClaimData storage claimData, uint256 _tokenId)\n public\n view\n returns (\n IDropClaimConditionV1.ClaimCondition memory condition,\n uint256 conditionId,\n uint256 walletMaxClaimCount,\n uint256 maxTotalSupply\n )\n {\n conditionId = getActiveClaimConditionId(claimData, _tokenId);\n condition = claimData.claimCondition[_tokenId].phases[conditionId];\n walletMaxClaimCount = claimData.maxWalletClaimCount[_tokenId];\n maxTotalSupply = claimData.maxTotalSupply[_tokenId];\n }\n\n /// @dev Returns basic info for claim data\n function getClaimData(DropERC1155DataTypes.ClaimData storage claimData, uint256 _tokenId)\n public\n view\n returns (\n uint256 nextTokenIdToMint,\n uint256 maxTotalSupply,\n uint256 maxWalletClaimCount\n )\n {\n nextTokenIdToMint = claimData.nextTokenIdToMint;\n maxTotalSupply = claimData.maxTotalSupply[_tokenId];\n maxWalletClaimCount = claimData.maxWalletClaimCount[_tokenId];\n }\n\n /// @dev Returns an array with all the claim conditions.\n function getClaimConditions(DropERC1155DataTypes.ClaimData storage claimData, uint256 _tokenId)\n public\n view\n returns (IDropClaimConditionV1.ClaimCondition[] memory conditions)\n {\n uint256 phaseCount = claimData.claimCondition[_tokenId].count;\n IDropClaimConditionV1.ClaimCondition[] memory _conditions = new IDropClaimConditionV1.ClaimCondition[](\n phaseCount\n );\n for (\n uint256 i = claimData.claimCondition[_tokenId].currentStartId;\n i < claimData.claimCondition[_tokenId].currentStartId + phaseCount;\n i++\n ) {\n _conditions[i - claimData.claimCondition[_tokenId].currentStartId] = claimData\n .claimCondition[_tokenId]\n .phases[i];\n }\n conditions = _conditions;\n }\n\n /// @dev Returns the user specific limits related to the current active claim condition\n function getUserClaimConditions(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _tokenId,\n address _claimer\n )\n public\n view\n returns (\n uint256 conditionId,\n uint256 walletClaimedCount,\n uint256 walletClaimedCountInPhase,\n uint256 lastClaimTimestamp,\n uint256 nextValidClaimTimestamp\n )\n {\n conditionId = getActiveClaimConditionId(claimData, _tokenId);\n (lastClaimTimestamp, nextValidClaimTimestamp) = getClaimTimestamp(claimData, _tokenId, conditionId, _claimer);\n walletClaimedCount = claimData.walletClaimCount[_tokenId][_claimer];\n walletClaimedCountInPhase = claimData.claimCondition[_tokenId].userClaims[conditionId][_claimer].claimedBalance;\n }\n\n /// @dev Returns the current active claim condition ID.\n function getActiveClaimConditionId(DropERC1155DataTypes.ClaimData storage claimData, uint256 _tokenId)\n public\n view\n returns (uint256)\n {\n IDropClaimConditionV1.ClaimConditionList storage conditionList = claimData.claimCondition[_tokenId];\n for (uint256 i = conditionList.currentStartId + conditionList.count; i > conditionList.currentStartId; i--) {\n if (block.timestamp >= conditionList.phases[i - 1].startTimestamp) {\n return i - 1;\n }\n }\n\n revert IDropErrorsV0.NoActiveMintCondition();\n }\n\n /// @dev Returns the claim condition at the given uid.\n function getClaimConditionById(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _tokenId,\n uint256 _conditionId\n ) external view returns (IDropClaimConditionV1.ClaimCondition memory condition) {\n condition = claimData.claimCondition[_tokenId].phases[_conditionId];\n }\n\n /// @dev Returns the timestamp for when a claimer is eligible for claiming NFTs again.\n function getClaimTimestamp(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _tokenId,\n uint256 _conditionId,\n address _claimer\n ) public view returns (uint256 lastClaimTimestamp, uint256 nextValidClaimTimestamp) {\n lastClaimTimestamp = claimData.claimCondition[_tokenId].userClaims[_conditionId][_claimer].lastClaimTimestamp;\n\n unchecked {\n nextValidClaimTimestamp =\n lastClaimTimestamp +\n claimData.claimCondition[_tokenId].phases[_conditionId].waitTimeInSecondsBetweenClaims;\n\n if (nextValidClaimTimestamp < lastClaimTimestamp) {\n nextValidClaimTimestamp = type(uint256).max;\n }\n }\n }\n\n /// @dev Returns the royalty recipient and bps for a particular token Id.\n function getRoyaltyInfoForToken(DropERC1155DataTypes.ClaimData storage claimData, uint256 _tokenId)\n public\n view\n returns (address, uint16)\n {\n IRoyaltyV0.RoyaltyInfo memory royaltyForToken = claimData.royaltyInfoForToken[_tokenId];\n\n return\n royaltyForToken.recipient == address(0)\n ? (claimData.royaltyRecipient, uint16(claimData.royaltyBps))\n : (royaltyForToken.recipient, uint16(royaltyForToken.bps));\n }\n\n /// @dev See ERC-2891 - Returns the royalty recipient and amount, given a tokenId and sale price.\n function royaltyInfo(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount) {\n (address recipient, uint256 bps) = getRoyaltyInfoForToken(claimData, tokenId);\n receiver = recipient;\n royaltyAmount = (salePrice * bps) / MAX_BPS;\n }\n\n function setDefaultRoyaltyInfo(\n DropERC1155DataTypes.ClaimData storage claimData,\n address _royaltyRecipient,\n uint256 _royaltyBps\n ) external {\n if (!(_royaltyBps <= MAX_BPS)) revert IDropErrorsV0.MaxBps();\n\n claimData.royaltyRecipient = _royaltyRecipient;\n claimData.royaltyBps = uint16(_royaltyBps);\n }\n\n function setRoyaltyInfoForToken(\n DropERC1155DataTypes.ClaimData storage claimData,\n uint256 _tokenId,\n address _recipient,\n uint256 _bps\n ) external {\n if (!(_bps <= MAX_BPS)) revert IDropErrorsV0.MaxBps();\n\n claimData.royaltyInfoForToken[_tokenId] = IRoyaltyV0.RoyaltyInfo({recipient: _recipient, bps: _bps});\n }\n\n /// @dev See {ERC1155-_beforeTokenTransfer}.\n function beforeTokenTransfer(\n DropERC1155DataTypes.ClaimData storage claimData,\n TermsDataTypes.Terms storage termsData,\n IAccessControlUpgradeable accessControl,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external {\n // if transfer is restricted on the contract, we still want to allow burning and minting\n if (!accessControl.hasRole(TRANSFER_ROLE, address(0)) && from != address(0) && to != address(0)) {\n if (!(accessControl.hasRole(TRANSFER_ROLE, from) || accessControl.hasRole(TRANSFER_ROLE, to)))\n revert IDropErrorsV0.InvalidPermission();\n }\n\n if (to != address(this)) {\n if (termsData.termsActivated) {\n if (!termsData.termsAccepted[to] || termsData.termsVersion != termsData.acceptedVersion[to])\n revert IDropErrorsV0.TermsNotAccepted(to, termsData.termsURI, termsData.termsVersion);\n }\n }\n\n if (from == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n claimData.totalSupply[ids[i]] += amounts[i];\n }\n }\n\n if (to == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n claimData.totalSupply[ids[i]] -= amounts[i];\n }\n }\n }\n\n /// @dev Checks if a value is outside of a limit.\n /// @param _limit The limit to check against.\n /// @param _value The value to check.\n /// @return True if the value is there is a limit and it's outside of that limit.\n function _isOutOfLimits(uint256 _limit, uint256 _value) internal pure returns (bool) {\n return _limit != 0 && !(_value <= _limit);\n }\n}\n" }, "contracts/aspen/drop/AspenERC1155DropStorage.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\n///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// //\n// _' AAA //\n// !jz_ A:::A //\n// ;Lzzzz- A:::::A //\n// '1zzzzxzz' A:::::::A //\n// !xzzzzzzi~ A:::::::::A ssssssssss ppppp ppppppppp eeeeeeeeeeee nnnn nnnnnnnn //\n// ;izzzzzzj^` A:::::A:::::A ss::::::::::s p::::ppp:::::::::p ee::::::::::::ee n:::nn::::::::nn //\n// `;^.````` A:::::A A:::::A ss:::::::::::::s p:::::::::::::::::p e::::::eeeee:::::een::::::::::::::nn //\n// -;;;;;;;- A:::::A A:::::A s::::::ssss:::::spp::::::ppppp::::::pe::::::e e:::::enn:::::::::::::::n //\n// .;;;;;;;_ A:::::A A:::::A s:::::s ssssss p:::::p p:::::pe:::::::eeeee::::::e n:::::nnnn:::::n //\n// ;;;;;;;;` A:::::AAAAAAAAA:::::A s::::::s p:::::p p:::::pe:::::::::::::::::e n::::n n::::n //\n// _;;;;;;;' A:::::::::::::::::::::A s::::::s p:::::p p:::::pe::::::eeeeeeeeeee n::::n n::::n //\n// ;{jjjjjjjjj A:::::AAAAAAAAAAAAA:::::A ssssss s:::::s p:::::p p::::::pe:::::::e n::::n n::::n //\n// `+IIIVVVVVVVVI` A:::::A A:::::A s:::::ssss::::::s p:::::ppppp:::::::pe::::::::e n::::n n::::n //\n// ^sIVVVVVVVVVVVVI` A:::::A A:::::As::::::::::::::s p::::::::::::::::p e::::::::eeeeeeee n::::n n::::n //\n// ~xIIIVVVVVVVVVVVVVI` A:::::A A:::::As:::::::::::ss p::::::::::::::pp ee:::::::::::::e n::::n n::::n //\n// -~~~;;;;;;;;;;;;;;;;; AAAAAAA AAAAAAAsssssssssss p::::::pppppppp eeeeeeeeeeeeee nnnnnn nnnnnn //\n// p:::::p //\n// p:::::p //\n// p:::::::p //\n// p:::::::p //\n// p:::::::p //\n// ppppppppp //\n// //\n// Website: https://aspenft.io/ //\n// Twitter: https://twitter.com/aspenft //\n// //\n///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n// ========== External imports ==========\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"./extension/operatorFilterer/UpdateableDefaultOperatorFiltererUpgradeable.sol\";\n/// ========== Features ==========\nimport \"./openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol\";\n\nimport \"./types/DropERC1155DataTypes.sol\";\nimport \"../terms/types/TermsDataTypes.sol\";\n\nimport \"./AspenERC1155DropLogic.sol\";\nimport \"../terms/lib/TermsLogic.sol\";\nimport \"../api/issuance/IDropClaimCondition.sol\";\nimport \"../api/errors/IDropErrors.sol\";\nimport \"../api/config/IGlobalConfig.sol\";\n\nabstract contract AspenERC1155DropStorage is\n Initializable,\n ReentrancyGuardUpgradeable,\n ERC2771ContextUpgradeable,\n AccessControlEnumerableUpgradeable,\n ERC1155Upgradeable,\n EIP712Upgradeable,\n UpdateableDefaultOperatorFiltererUpgradeable\n{\n /// ================================\n /// =========== Libraries ==========\n /// ================================\n using StringsUpgradeable for uint256;\n using TermsLogic for TermsDataTypes.Terms;\n using AspenERC1155DropLogic for DropERC1155DataTypes.ClaimData;\n\n /// ===============================================\n /// =========== State variables - public ==========\n /// ===============================================\n // FIXME: TRANSFER_ROLE is duplicated on AspenERC1155DropLogic (since we wish to access it from this contract externally)\n /// @dev Only transfers to or from TRANSFER_ROLE holders are valid, when transfers are restricted.\n bytes32 public constant TRANSFER_ROLE = keccak256(\"TRANSFER_ROLE\");\n /// @dev Only MINTER_ROLE holders can lazy mint NFTs.\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n /// @dev Only ISSUER_ROLE holders can issue NFTs.\n bytes32 public constant ISSUER_ROLE = keccak256(\"ISSUER_ROLE\");\n /// @dev Offset for token IDs.\n uint8 public constant TOKEN_INDEX_OFFSET = 1;\n /// @dev If true, users cannot claim.\n bool public claimIsPaused = false;\n\n /// @dev The address that receives all primary sales value.\n address public _primarySaleRecipient;\n /// @dev Token name\n string public __name;\n /// @dev Token symbol\n string public __symbol;\n /// @dev Owner of the contract (purpose: OpenSea compatibility)\n address public _owner;\n /// @dev Contract level metadata.\n string public _contractUri;\n\n /// @dev Mapping from 'Largest tokenId of a batch of tokens with the same baseURI'\n /// to base URI for the respective batch of tokens.\n mapping(uint256 => string) public baseURI;\n\n /// @dev address of delegate logic contract\n address public delegateLogicContract;\n /// @dev global Aspen config\n IGlobalConfigV0 public aspenConfig;\n\n /// @dev enable/disable operator filterer.\n // bool public operatorFiltererEnabled;\n // address public defaultSubscription;\n // address public operatorFilterRegistry;\n\n bytes32 public constant MESSAGE_HASH =\n keccak256(\"AcceptTerms(address acceptor,string termsURI,uint8 termsVersion)\");\n\n struct AcceptTerms {\n address acceptor;\n string termsURI;\n uint8 termsVersion;\n }\n\n DropERC1155DataTypes.ClaimData claimData;\n TermsDataTypes.Terms termsData;\n\n modifier isValidTokenId(uint256 _tokenId) {\n if (_tokenId <= 0) revert IDropErrorsV0.InvalidTokenId(_tokenId);\n _;\n }\n\n /// @dev See ERC 165\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC1155Upgradeable, AccessControlEnumerableUpgradeable)\n returns (bool)\n {\n return\n ERC1155Upgradeable.supportsInterface(interfaceId) ||\n AccessControlEnumerableUpgradeable.supportsInterface(interfaceId);\n }\n\n /// @dev See {ERC1155-_beforeTokenTransfer}.\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n AspenERC1155DropLogic.beforeTokenTransfer(claimData, termsData, this, from, to, ids, amounts);\n }\n\n function _canSetOperatorRestriction() internal virtual override onlyRole(DEFAULT_ADMIN_ROLE) returns (bool) {\n return true;\n }\n\n /// ======================================\n /// =========== Miscellaneous ============\n /// ======================================\n function _msgSender()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771ContextUpgradeable)\n returns (address sender)\n {\n return ERC2771ContextUpgradeable._msgSender();\n }\n\n function _msgData()\n internal\n view\n virtual\n override(ContextUpgradeable, ERC2771ContextUpgradeable)\n returns (bytes calldata)\n {\n return ERC2771ContextUpgradeable._msgData();\n }\n}\n" }, "contracts/aspen/drop/extension/operatorFilterer/DefaultOperatorFiltererUpgradeable.sol": { "content": "// SPDX-License-Identifier: Apache 2.0\npragma solidity ^0.8;\n\nimport \"./OperatorFiltererUpgradeable.sol\";\n\nabstract contract DefaultOperatorFiltererUpgradeable is OperatorFiltererUpgradeable {\n address DEFAULT_SUBSCRIPTION;\n\n function __DefaultOperatorFilterer_init(address defaultSubscription, address operatorFilterRegistry)\n internal\n onlyInitializing\n {\n __DefaultOperatorFilterer_init_internal(defaultSubscription, operatorFilterRegistry);\n }\n\n function __DefaultOperatorFilterer_init_internal(address defaultSubscription, address operatorFilterRegistry)\n internal\n {\n DEFAULT_SUBSCRIPTION = defaultSubscription;\n OperatorFiltererUpgradeable.__OperatorFilterer_init_internal(\n DEFAULT_SUBSCRIPTION,\n operatorFilterRegistry,\n true\n );\n }\n\n function getDefaultSubscriptionAddress() public view returns (address) {\n return address(DEFAULT_SUBSCRIPTION);\n }\n}\n" }, "contracts/aspen/drop/extension/operatorFilterer/interfaces/IOperatorFilterRegistry.sol": { "content": "// SPDX-License-Identifier: Apache 2.0\npragma solidity ^0.8;\n\ninterface IOperatorFilterRegistry {\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n\n function register(address registrant) external;\n\n function registerAndSubscribe(address registrant, address subscription) external;\n\n function registerAndCopyEntries(address registrant, address registrantToCopy) 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(address registrant, address registrantToSubscribe) external;\n\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n\n function subscriptionOf(address addr) external returns (address registrant);\n\n function subscribers(address registrant) external returns (address[] memory);\n\n function subscriberAt(address registrant, uint256 index) external returns (address);\n\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n\n function filteredOperators(address addr) external returns (address[] memory);\n\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n\n function isRegistered(address addr) external returns (bool);\n\n function codeHashOf(address addr) external returns (bytes32);\n}\n" }, "contracts/aspen/drop/extension/operatorFilterer/OperatorFiltererUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"./interfaces/IOperatorFilterRegistry.sol\";\nimport \"./OperatorFilterToggle.sol\";\n\nabstract contract OperatorFiltererUpgradeable is Initializable, OperatorFilterToggle {\n error OperatorNotAllowed(address operator);\n\n IOperatorFilterRegistry OPERATOR_FILTER_REGISTRY;\n\n function __OperatorFilterer_init(\n address subscriptionOrRegistrantToCopy,\n address operatorFilterRegistry,\n bool subscribe\n ) internal onlyInitializing {\n __OperatorFilterer_init_internal(subscriptionOrRegistrantToCopy, operatorFilterRegistry, subscribe);\n }\n\n function __OperatorFilterer_init_internal(\n address subscriptionOrRegistrantToCopy,\n address operatorFilterRegistry,\n bool subscribe\n ) internal {\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 OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(operatorFilterRegistry);\n if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {\n if (!OPERATOR_FILTER_REGISTRY.isRegistered(address(this))) {\n if (subscribe) {\n OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);\n } else {\n if (subscriptionOrRegistrantToCopy != address(0)) {\n OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);\n } else {\n OPERATOR_FILTER_REGISTRY.register(address(this));\n }\n }\n }\n }\n }\n\n function getOperatorFilterRegistryAddress() public view returns (address) {\n return address(OPERATOR_FILTER_REGISTRY);\n }\n\n modifier onlyAllowedOperator(address from) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (operatorRestriction) {\n if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {\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 _;\n return;\n }\n if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), msg.sender)) {\n revert OperatorNotAllowed(msg.sender);\n }\n }\n }\n _;\n }\n\n modifier onlyAllowedOperatorApproval(address operator) virtual {\n // Check registry code length to facilitate testing in environments without a deployed registry.\n if (operatorRestriction) {\n if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {\n if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {\n revert OperatorNotAllowed(operator);\n }\n }\n }\n _;\n }\n}\n" }, "contracts/aspen/drop/extension/operatorFilterer/OperatorFilterToggle.sol": { "content": "// SPDX-License-Identifier: Apache 2.0\npragma solidity ^0.8;\n\nimport \"../../../api/royalties/IRoyalty.sol\";\n\nabstract contract OperatorFilterToggle is IPublicOperatorFilterToggleV0, IRestrictedOperatorFilterToggleV0 {\n bool public operatorRestriction;\n\n function setOperatorRestriction(bool _restriction) external virtual {\n require(_canSetOperatorRestriction(), \"Not authorized to set operator restriction.\");\n _setOperatorRestriction(_restriction);\n }\n\n function _setOperatorRestriction(bool _restriction) internal {\n operatorRestriction = _restriction;\n emit OperatorRestriction(_restriction);\n }\n\n function _canSetOperatorRestriction() internal virtual returns (bool);\n}\n" }, "contracts/aspen/drop/extension/operatorFilterer/UpdateableDefaultOperatorFiltererUpgradeable.sol": { "content": "// SPDX-License-Identifier: Apache 2.0\npragma solidity ^0.8;\n\nimport \"../../../api/config/types/OperatorFiltererDataTypes.sol\";\nimport \"./DefaultOperatorFiltererUpgradeable.sol\";\n\nabstract contract UpdateableDefaultOperatorFiltererUpgradeable is DefaultOperatorFiltererUpgradeable {\n IOperatorFiltererDataTypesV0.OperatorFilterer private __operatorFilterer;\n\n function __UpdateableDefaultOperatorFiltererUpgradeable_init(\n IOperatorFiltererDataTypesV0.OperatorFilterer memory _operatorFilterer\n ) internal onlyInitializing {\n __operatorFilterer = _operatorFilterer;\n DefaultOperatorFiltererUpgradeable.__DefaultOperatorFilterer_init(\n _operatorFilterer.defaultSubscription,\n _operatorFilterer.operatorFilterRegistry\n );\n }\n\n function getOperatorFiltererDetails() public view returns (IOperatorFiltererDataTypesV0.OperatorFilterer memory) {\n return __operatorFilterer;\n }\n\n function _setOperatorFilterer(IOperatorFiltererDataTypesV0.OperatorFilterer memory _newOperatorFilterer)\n internal\n virtual\n {\n // Note: No need to check here as the flow for setting an operator filterer is by first retrieving it from Aspen Config\n __operatorFilterer = _newOperatorFilterer;\n __DefaultOperatorFilterer_init_internal(\n _newOperatorFilterer.defaultSubscription,\n _newOperatorFilterer.operatorFilterRegistry\n );\n }\n}\n" }, "contracts/aspen/drop/interfaces/IWETH.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\ninterface IWETH {\n function deposit() external payable;\n\n function withdraw(uint256 amount) external;\n\n function transfer(address to, uint256 value) external returns (bool);\n}\n" }, "contracts/aspen/drop/lib/CurrencyTransferLib.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\n// Helper interfaces\nimport {IWETH} from \"../interfaces/IWETH.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nlibrary CurrencyTransferLib {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /// @dev The address interpreted as native token of the chain.\n address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @dev Transfers a given amount of currency.\n function transferCurrency(\n address _currency,\n address _from,\n address _to,\n uint256 _amount\n ) internal {\n if (_amount == 0) {\n return;\n }\n\n if (_currency == NATIVE_TOKEN) {\n safeTransferNativeToken(_to, _amount);\n } else {\n safeTransferERC20(_currency, _from, _to, _amount);\n }\n }\n\n /// @dev Transfers a given amount of currency. (With native token wrapping)\n function transferCurrencyWithWrapper(\n address _currency,\n address _from,\n address _to,\n uint256 _amount,\n address _nativeTokenWrapper\n ) internal {\n if (_amount == 0) {\n return;\n }\n\n if (_currency == NATIVE_TOKEN) {\n if (_from == address(this)) {\n // withdraw from weth then transfer withdrawn native token to recipient\n IWETH(_nativeTokenWrapper).withdraw(_amount);\n safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);\n } else if (_to == address(this)) {\n // store native currency in weth\n require(_amount == msg.value, \"msg.value != amount\");\n IWETH(_nativeTokenWrapper).deposit{value: _amount}();\n } else {\n safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);\n }\n } else {\n safeTransferERC20(_currency, _from, _to, _amount);\n }\n }\n\n /// @dev Transfer `amount` of ERC20 token from `from` to `to`.\n function safeTransferERC20(\n address _currency,\n address _from,\n address _to,\n uint256 _amount\n ) internal {\n if (_from == _to) {\n return;\n }\n\n if (_from == address(this)) {\n IERC20Upgradeable(_currency).safeTransfer(_to, _amount);\n } else {\n IERC20Upgradeable(_currency).safeTransferFrom(_from, _to, _amount);\n }\n }\n\n /// @dev Transfers `amount` of native token to `to`.\n function safeTransferNativeToken(address to, uint256 value) internal {\n // solhint-disable avoid-low-level-calls\n // slither-disable-next-line low-level-calls\n (bool success, ) = to.call{value: value}(\"\");\n require(success, \"native token transfer failed\");\n }\n\n /// @dev Transfers `amount` of native token to `to`. (With native token wrapping)\n function safeTransferNativeTokenWithWrapper(\n address to,\n uint256 value,\n address _nativeTokenWrapper\n ) internal {\n // solhint-disable avoid-low-level-calls\n // slither-disable-next-line low-level-calls\n (bool success, ) = to.call{value: value}(\"\");\n if (!success) {\n IWETH(_nativeTokenWrapper).deposit{value: value}();\n IERC20Upgradeable(_nativeTokenWrapper).safeTransfer(to, value);\n }\n }\n}\n" }, "contracts/aspen/drop/lib/FeeType.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\nlibrary FeeType {\n uint256 internal constant PRIMARY_SALE = 0;\n uint256 internal constant MARKET_SALE = 1;\n uint256 internal constant SPLIT = 2;\n}\n" }, "contracts/aspen/drop/lib/MerkleProof.sol": { "content": "// SPDX-License-Identifier: MIT\n// Modified from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.3.0/contracts/utils/cryptography/MerkleProof.sol\n// Copied from https://github.com/ensdomains/governance/blob/master/contracts/MerkleProof.sol\n\npragma solidity ^0.8;\n\n/**\n * @dev These functions deal with verification of Merkle Trees proofs.\n *\n * The proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\n *\n * Source: https://github.com/ensdomains/governance/blob/master/contracts/MerkleProof.sol\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool, uint256) {\n bytes32 computedHash = leaf;\n uint256 index = 0;\n\n for (uint256 i = 0; i < proof.length; i++) {\n index *= 2;\n bytes32 proofElement = proof[i];\n\n if (computedHash <= proofElement) {\n // Hash(current computed hash + current element of the proof)\n computedHash = keccak256(abi.encodePacked(computedHash, proofElement));\n } else {\n // Hash(current element of the proof + current computed hash)\n computedHash = keccak256(abi.encodePacked(proofElement, computedHash));\n index += 1;\n }\n }\n\n // Check if the computed hash (root) is equal to the provided root\n return (computedHash == root, index);\n }\n}\n" }, "contracts/aspen/drop/openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (metatx/ERC2771Context.sol)\n\npragma solidity ^0.8;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\n/**\n * @dev Context variant with ERC2771 support.\n */\nabstract contract ERC2771ContextUpgradeable is Initializable, ContextUpgradeable {\n mapping(address => bool) private _trustedForwarder;\n\n function __ERC2771Context_init(address[] memory trustedForwarder) internal onlyInitializing {\n __Context_init_unchained();\n __ERC2771Context_init_unchained(trustedForwarder);\n }\n\n function __ERC2771Context_init_unchained(address[] memory trustedForwarder) internal onlyInitializing {\n for (uint256 i = 0; i < trustedForwarder.length; i++) {\n _trustedForwarder[trustedForwarder[i]] = true;\n }\n }\n\n function isTrustedForwarder(address forwarder) public view virtual returns (bool) {\n return _trustedForwarder[forwarder];\n }\n\n function _msgSender() internal view virtual override returns (address sender) {\n if (isTrustedForwarder(msg.sender)) {\n // The assembly code is more direct than the Solidity version using `abi.decode`.\n assembly {\n sender := shr(96, calldataload(sub(calldatasize(), 20)))\n }\n } else {\n return super._msgSender();\n }\n }\n\n function _msgData() internal view virtual override returns (bytes calldata) {\n if (isTrustedForwarder(msg.sender)) {\n return msg.data[:msg.data.length - 20];\n } else {\n return super._msgData();\n }\n }\n\n uint256[49] private __gap;\n}\n" }, "contracts/aspen/drop/types/DropERC1155DataTypes.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport \"../../api/issuance/IDropClaimCondition.sol\";\nimport \"../../api/royalties/IRoyalty.sol\";\n\ninterface DropERC1155DataTypes {\n struct SequencedURI {\n /// @dev The URI with the token metadata.\n string uri;\n /// @dev The high-watermark sequence number a URI - used to tell if one URI is fresher than a another\n /// taken from the current value of uriSequenceCounter after it is incremented.\n uint256 sequenceNumber;\n /// @dev Indicates if a uri is permanent or not.\n bool isPermanent;\n /// @dev Indicates the number of tokens in this batch.\n uint256 amountOfTokens;\n }\n struct ClaimData {\n /// @dev The set of all claim conditions, at any given moment.\n mapping(uint256 => IDropClaimConditionV1.ClaimConditionList) claimCondition;\n /// @dev Mapping from token ID => claimer wallet address => total number of NFTs of the token ID a wallet has claimed.\n mapping(uint256 => mapping(address => uint256)) walletClaimCount;\n /// @dev The next token ID of the NFT to \"lazy mint\".\n uint256 nextTokenIdToMint;\n /// @dev Mapping from token ID => maximum possible total circulating supply of tokens with that ID.\n mapping(uint256 => uint256) maxTotalSupply;\n /// @dev Mapping from token ID => the max number of NFTs of the token ID a wallet can claim.\n mapping(uint256 => uint256) maxWalletClaimCount;\n /// @dev The address that receives all platform fees from all sales.\n address platformFeeRecipient;\n /// @dev The % of primary sales collected as platform fees.\n uint16 platformFeeBps;\n /// @dev Mapping from token ID => total circulating supply of tokens with that ID.\n mapping(uint256 => uint256) totalSupply;\n /// @dev The address that receives all primary sales value.\n address primarySaleRecipient;\n /// @dev Mapping from token ID => the address of the recipient of primary sales.\n mapping(uint256 => address) saleRecipient;\n /// @dev The recipient of who gets the royalty.\n address royaltyRecipient;\n /// @dev The (default) address that receives all royalty value.\n uint16 royaltyBps;\n /// @dev Mapping from token ID => royalty recipient and bps for tokens of the token ID.\n mapping(uint256 => IRoyaltyV0.RoyaltyInfo) royaltyInfoForToken;\n /// @dev Sequence number counter for the synchronisation of per-token URIs and baseURIs relative base on which\n /// was set most recently. Incremented on each URI-mutating action.\n CountersUpgradeable.Counter uriSequenceCounter;\n /// @dev One more than the Largest tokenId of each batch of tokens with the same baseURI\n uint256[] baseURIIndices;\n /// @dev Mapping from the 'base URI index' defined as the tokenId one more than the largest tokenId a batch of\n /// tokens which all same the same baseURI.\n /// Suppose we have two batches (and two baseURIs), with 3 and 4 tokens respectively, then in pictures we have:\n /// [baseURI1 | baseURI2]\n /// [ 0, 1, 2 | 3, 4, 5, 6]\n /// The baseURIIndices would be:\n /// [ 3, 7]\n mapping(uint256 => SequencedURI) baseURI;\n // Optional mapping for token URIs\n mapping(uint256 => SequencedURI) tokenURIs;\n }\n}\n" }, "contracts/aspen/generated/impl/BaseAspenERC1155DropV2.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\n// Generated by impl.ts. Will be overwritten.\n// Filename: './BaseAspenERC1155DropV2.sol'\n\npragma solidity ^0.8.4;\n\nimport \"../../api/impl/IAspenERC1155Drop.sol\";\nimport \"../../api/IAspenFeatures.sol\";\nimport \"../../api/IAspenVersioned.sol\";\nimport \"../../api/IMulticallable.sol\";\nimport \"../../api/standard/IERC1155.sol\";\nimport \"../../api/standard/IERC2981.sol\";\nimport \"../../api/standard/IERC4906.sol\";\nimport \"../../api/issuance/ISFTSupply.sol\";\nimport \"../../api/issuance/ISFTSupply.sol\";\nimport \"../../api/issuance/ISFTLimitSupply.sol\";\nimport \"../../api/issuance/ICedarSFTIssuance.sol\";\nimport \"../../api/issuance/ICedarSFTIssuance.sol\";\nimport \"../../api/issuance/ICedarSFTIssuance.sol\";\nimport \"../../api/royalties/IRoyalty.sol\";\nimport \"../../api/royalties/IRoyalty.sol\";\nimport \"../../api/baseURI/IUpdateBaseURI.sol\";\nimport \"../../api/baseURI/IUpdateBaseURI.sol\";\nimport \"../../api/metadata/IContractMetadata.sol\";\nimport \"../../api/metadata/IContractMetadata.sol\";\nimport \"../../api/metadata/ISFTMetadata.sol\";\nimport \"../../api/ownable/IOwnable.sol\";\nimport \"../../api/ownable/IOwnable.sol\";\nimport \"../../api/pausable/IPausable.sol\";\nimport \"../../api/pausable/IPausable.sol\";\nimport \"../../api/agreement/IAgreement.sol\";\nimport \"../../api/agreement/IAgreement.sol\";\nimport \"../../api/agreement/IAgreement.sol\";\nimport \"../../api/primarysale/IPrimarySale.sol\";\nimport \"../../api/primarysale/IPrimarySale.sol\";\nimport \"../../api/primarysale/IPrimarySale.sol\";\nimport \"../../api/royalties/IRoyalty.sol\";\nimport \"../../api/royalties/IRoyalty.sol\";\nimport \"../../api/royalties/IRoyalty.sol\";\nimport \"../../api/royalties/IPlatformFee.sol\";\nimport \"../../api/lazymint/ILazyMint.sol\";\nimport \"../../api/issuance/ISFTClaimCount.sol\";\n\n/// Delegate features\ninterface IDelegateBaseAspenERC1155DropV2 is IRestrictedERC4906V0, IDelegatedSFTSupplyV0, IRestrictedSFTLimitSupplyV1, IDelegatedSFTIssuanceV0, IRestrictedSFTIssuanceV4, IRestrictedRoyaltyV1, IDelegatedUpdateBaseURIV0, IRestrictedUpdateBaseURIV1, IRestrictedMetadataV2, IRestrictedOwnableV0, IDelegatedPausableV0, IRestrictedPausableV1, IDelegatedAgreementV0, IRestrictedAgreementV1, IRestrictedPrimarySaleV2, IRestrictedSFTPrimarySaleV0, IRestrictedOperatorFiltererV0, IRestrictedOperatorFilterToggleV0, IDelegatedPlatformFeeV0, IRestrictedLazyMintV1, IRestrictedSFTClaimCountV0 {}\n\n/// Inherit from this base to implement introspection\nabstract contract BaseAspenERC1155DropV2 is IAspenFeaturesV0, IAspenVersionedV2, IMulticallableV0, IERC1155V3, IERC2981V0, IPublicSFTSupplyV0, IPublicSFTIssuanceV4, IPublicRoyaltyV0, IPublicMetadataV0, IAspenSFTMetadataV1, IPublicOwnableV0, IPublicAgreementV1, IPublicPrimarySaleV1, IPublicOperatorFilterToggleV0 {\n function supportedFeatures() override public pure returns (string[] memory features) {\n features = new string[](32);\n features[0] = \"IAspenFeatures.sol:IAspenFeaturesV0\";\n features[1] = \"IAspenVersioned.sol:IAspenVersionedV2\";\n features[2] = \"IMulticallable.sol:IMulticallableV0\";\n features[3] = \"issuance/ISFTSupply.sol:IPublicSFTSupplyV0\";\n features[4] = \"issuance/ISFTSupply.sol:IDelegatedSFTSupplyV0\";\n features[5] = \"issuance/ISFTLimitSupply.sol:IRestrictedSFTLimitSupplyV1\";\n features[6] = \"issuance/ICedarSFTIssuance.sol:IPublicSFTIssuanceV4\";\n features[7] = \"issuance/ICedarSFTIssuance.sol:IDelegatedSFTIssuanceV0\";\n features[8] = \"issuance/ICedarSFTIssuance.sol:IRestrictedSFTIssuanceV4\";\n features[9] = \"royalties/IRoyalty.sol:IPublicRoyaltyV0\";\n features[10] = \"royalties/IRoyalty.sol:IRestrictedRoyaltyV1\";\n features[11] = \"baseURI/IUpdateBaseURI.sol:IDelegatedUpdateBaseURIV0\";\n features[12] = \"baseURI/IUpdateBaseURI.sol:IRestrictedUpdateBaseURIV1\";\n features[13] = \"metadata/IContractMetadata.sol:IPublicMetadataV0\";\n features[14] = \"metadata/IContractMetadata.sol:IRestrictedMetadataV2\";\n features[15] = \"metadata/ISFTMetadata.sol:IAspenSFTMetadataV1\";\n features[16] = \"ownable/IOwnable.sol:IPublicOwnableV0\";\n features[17] = \"ownable/IOwnable.sol:IRestrictedOwnableV0\";\n features[18] = \"pausable/IPausable.sol:IDelegatedPausableV0\";\n features[19] = \"pausable/IPausable.sol:IRestrictedPausableV1\";\n features[20] = \"agreement/IAgreement.sol:IPublicAgreementV1\";\n features[21] = \"agreement/IAgreement.sol:IDelegatedAgreementV0\";\n features[22] = \"agreement/IAgreement.sol:IRestrictedAgreementV1\";\n features[23] = \"primarysale/IPrimarySale.sol:IPublicPrimarySaleV1\";\n features[24] = \"primarysale/IPrimarySale.sol:IRestrictedPrimarySaleV2\";\n features[25] = \"primarysale/IPrimarySale.sol:IRestrictedSFTPrimarySaleV0\";\n features[26] = \"royalties/IRoyalty.sol:IRestrictedOperatorFiltererV0\";\n features[27] = \"royalties/IRoyalty.sol:IPublicOperatorFilterToggleV0\";\n features[28] = \"royalties/IRoyalty.sol:IRestrictedOperatorFilterToggleV0\";\n features[29] = \"royalties/IPlatformFee.sol:IDelegatedPlatformFeeV0\";\n features[30] = \"lazymint/ILazyMint.sol:IRestrictedLazyMintV1\";\n features[31] = \"issuance/ISFTClaimCount.sol:IRestrictedSFTClaimCountV0\";\n }\n\n /// This needs to be public to be callable from initialize via delegatecall\n function minorVersion() virtual override public pure returns (uint256 minor, uint256 patch);\n\n function implementationVersion() override public pure returns (uint256 major, uint256 minor, uint256 patch) {\n (minor, patch) = minorVersion();\n major = 2;\n }\n\n function implementationInterfaceId() virtual override public pure returns (string memory interfaceId) {\n interfaceId = \"impl/IAspenERC1155Drop.sol:IAspenERC1155DropV2\";\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public view returns (bool) {\n return (interfaceID != 0x0) && ((interfaceID != 0xffffffff) && ((interfaceID == 0x01ffc9a7) || ((interfaceID == type(IAspenFeaturesV0).interfaceId) || ((interfaceID == type(IAspenVersionedV2).interfaceId) || ((interfaceID == type(IMulticallableV0).interfaceId) || ((interfaceID == type(IERC1155V3).interfaceId) || ((interfaceID == type(IERC2981V0).interfaceId) || ((interfaceID == type(IRestrictedERC4906V0).interfaceId) || ((interfaceID == type(IPublicSFTSupplyV0).interfaceId) || ((interfaceID == type(IDelegatedSFTSupplyV0).interfaceId) || ((interfaceID == type(IRestrictedSFTLimitSupplyV1).interfaceId) || ((interfaceID == type(IPublicSFTIssuanceV4).interfaceId) || ((interfaceID == type(IDelegatedSFTIssuanceV0).interfaceId) || ((interfaceID == type(IRestrictedSFTIssuanceV4).interfaceId) || ((interfaceID == type(IPublicRoyaltyV0).interfaceId) || ((interfaceID == type(IRestrictedRoyaltyV1).interfaceId) || ((interfaceID == type(IDelegatedUpdateBaseURIV0).interfaceId) || ((interfaceID == type(IRestrictedUpdateBaseURIV1).interfaceId) || ((interfaceID == type(IPublicMetadataV0).interfaceId) || ((interfaceID == type(IRestrictedMetadataV2).interfaceId) || ((interfaceID == type(IAspenSFTMetadataV1).interfaceId) || ((interfaceID == type(IPublicOwnableV0).interfaceId) || ((interfaceID == type(IRestrictedOwnableV0).interfaceId) || ((interfaceID == type(IDelegatedPausableV0).interfaceId) || ((interfaceID == type(IRestrictedPausableV1).interfaceId) || ((interfaceID == type(IPublicAgreementV1).interfaceId) || ((interfaceID == type(IDelegatedAgreementV0).interfaceId) || ((interfaceID == type(IRestrictedAgreementV1).interfaceId) || ((interfaceID == type(IPublicPrimarySaleV1).interfaceId) || ((interfaceID == type(IRestrictedPrimarySaleV2).interfaceId) || ((interfaceID == type(IRestrictedSFTPrimarySaleV0).interfaceId) || ((interfaceID == type(IRestrictedOperatorFiltererV0).interfaceId) || ((interfaceID == type(IPublicOperatorFilterToggleV0).interfaceId) || ((interfaceID == type(IRestrictedOperatorFilterToggleV0).interfaceId) || ((interfaceID == type(IDelegatedPlatformFeeV0).interfaceId) || ((interfaceID == type(IRestrictedLazyMintV1).interfaceId) || ((interfaceID == type(IRestrictedSFTClaimCountV0).interfaceId) || (interfaceID == type(IAspenERC1155DropV2).interfaceId))))))))))))))))))))))))))))))))))))));\n }\n\n function isIAspenFeaturesV0() override public pure returns (bool) {\n return true;\n }\n}\n" }, "contracts/aspen/terms/lib/TermsLogic.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\n///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// //\n// _' AAA //\n// !jz_ A:::A //\n// ;Lzzzz- A:::::A //\n// '1zzzzxzz' A:::::::A //\n// !xzzzzzzi~ A:::::::::A ssssssssss ppppp ppppppppp eeeeeeeeeeee nnnn nnnnnnnn //\n// ;izzzzzzj^` A:::::A:::::A ss::::::::::s p::::ppp:::::::::p ee::::::::::::ee n:::nn::::::::nn //\n// `;^.````` A:::::A A:::::A ss:::::::::::::s p:::::::::::::::::p e::::::eeeee:::::een::::::::::::::nn //\n// -;;;;;;;- A:::::A A:::::A s::::::ssss:::::spp::::::ppppp::::::pe::::::e e:::::enn:::::::::::::::n //\n// .;;;;;;;_ A:::::A A:::::A s:::::s ssssss p:::::p p:::::pe:::::::eeeee::::::e n:::::nnnn:::::n //\n// ;;;;;;;;` A:::::AAAAAAAAA:::::A s::::::s p:::::p p:::::pe:::::::::::::::::e n::::n n::::n //\n// _;;;;;;;' A:::::::::::::::::::::A s::::::s p:::::p p:::::pe::::::eeeeeeeeeee n::::n n::::n //\n// ;{jjjjjjjjj A:::::AAAAAAAAAAAAA:::::A ssssss s:::::s p:::::p p::::::pe:::::::e n::::n n::::n //\n// `+IIIVVVVVVVVI` A:::::A A:::::A s:::::ssss::::::s p:::::ppppp:::::::pe::::::::e n::::n n::::n //\n// ^sIVVVVVVVVVVVVI` A:::::A A:::::As::::::::::::::s p::::::::::::::::p e::::::::eeeeeeee n::::n n::::n //\n// ~xIIIVVVVVVVVVVVVVI` A:::::A A:::::As:::::::::::ss p::::::::::::::pp ee:::::::::::::e n::::n n::::n //\n// -~~~;;;;;;;;;;;;;;;;; AAAAAAA AAAAAAAsssssssssss p::::::pppppppp eeeeeeeeeeeeee nnnnnn nnnnnn //\n// p:::::p //\n// p:::::p //\n// p:::::::p //\n// p:::::::p //\n// p:::::::p //\n// ppppppppp //\n// //\n// Website: https://aspenft.io/ //\n// Twitter: https://twitter.com/aspenft //\n// //\n///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\npragma solidity ^0.8;\n\nimport \"../../api/errors/ITermsErrors.sol\";\nimport \"../types/TermsDataTypes.sol\";\n\nlibrary TermsLogic {\n using TermsLogic for TermsDataTypes.Terms;\n\n event TermsActivationStatusUpdated(bool isActivated);\n event TermsUpdated(string termsURI, uint8 termsVersion);\n event TermsAccepted(string termsURI, uint8 termsVersion, address indexed acceptor);\n\n /// @notice activates / deactivates the terms of use.\n function setTermsActivation(TermsDataTypes.Terms storage termsData, bool _active) external {\n if (_active) {\n _activateTerms(termsData);\n } else {\n _deactivateTerms(termsData);\n }\n }\n\n /// @notice updates the term URI and pumps the terms version\n function setTermsURI(TermsDataTypes.Terms storage termsData, string calldata _termsURI) external {\n if (keccak256(abi.encodePacked(termsData.termsURI)) == keccak256(abi.encodePacked(_termsURI)))\n revert ITermsErrorsV0.TermsUriAlreadySet();\n if (bytes(_termsURI).length > 0) {\n termsData.termsVersion = termsData.termsVersion + 1;\n termsData.termsActivated = true;\n } else {\n termsData.termsActivated = false;\n }\n termsData.termsURI = _termsURI;\n }\n\n /// @notice by signing this transaction, you are confirming that you have read and agreed to the terms of use at `termsURI`\n function acceptTerms(TermsDataTypes.Terms storage termsData, address _acceptor) external {\n if (!termsData.termsActivated) revert ITermsErrorsV0.TermsNotActivated();\n if (termsData.termsAccepted[_acceptor] && termsData.acceptedVersion[_acceptor] == termsData.termsVersion)\n revert ITermsErrorsV0.TermsAlreadyAccepted(termsData.termsVersion);\n termsData.termsAccepted[_acceptor] = true;\n termsData.acceptedVersion[_acceptor] = termsData.termsVersion;\n }\n\n /// @notice returns the details of the terms\n /// @return termsURI - the URI of the terms\n /// @return termsVersion - the version of the terms\n /// @return termsActivated - the status of the terms\n function getTermsDetails(TermsDataTypes.Terms storage termsData)\n external\n view\n returns (\n string memory termsURI,\n uint8 termsVersion,\n bool termsActivated\n )\n {\n return (termsData.termsURI, termsData.termsVersion, termsData.termsActivated);\n }\n\n /// @notice returns true / false for whether the account owner accepted terms\n function hasAcceptedTerms(TermsDataTypes.Terms storage termsData, address _address) external view returns (bool) {\n return termsData.termsAccepted[_address] && termsData.acceptedVersion[_address] == termsData.termsVersion;\n }\n\n /// @notice returns true / false for whether the account owner accepted terms\n function hasAcceptedTerms(\n TermsDataTypes.Terms storage termsData,\n address _address,\n uint8 _version\n ) external view returns (bool) {\n return termsData.termsAccepted[_address] && termsData.acceptedVersion[_address] == _version;\n }\n\n /// @notice activates the terms\n function _activateTerms(TermsDataTypes.Terms storage termsData) internal {\n if (bytes(termsData.termsURI).length == 0) revert ITermsErrorsV0.TermsURINotSet();\n if (termsData.termsActivated) revert ITermsErrorsV0.TermsStatusAlreadySet();\n termsData.termsActivated = true;\n }\n\n /// @notice deactivates the terms\n function _deactivateTerms(TermsDataTypes.Terms storage termsData) internal {\n if (!termsData.termsActivated) revert ITermsErrorsV0.TermsStatusAlreadySet();\n termsData.termsActivated = false;\n }\n}\n" }, "contracts/aspen/terms/types/TermsDataTypes.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\n\npragma solidity ^0.8;\n\ninterface TermsDataTypes {\n /**\n * @notice The criteria that make up terms.\n *\n * @param termsActivated Indicates whether the terms are activated or not.\n *\n * @param termsVersion The version of the terms.\n *\n * @param termsURI The URI of the terms.\n *\n * @param acceptedVersion Mapping with the address of the acceptor and the version of the terms accepted.\n *\n * @param termsAccepted Mapping with the address of the acceptor and the status of the terms accepted.\n *\n */\n struct Terms {\n bool termsActivated;\n uint8 termsVersion;\n string termsURI;\n mapping(address => uint8) acceptedVersion;\n mapping(address => bool) termsAccepted;\n }\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 1 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": { "contracts/aspen/drop/AspenERC1155DropLogic.sol": { "AspenERC1155DropLogic": "0xcc755e3a10e74beb6ec7c583c9a8ca54f2b54c46" }, "contracts/aspen/terms/lib/TermsLogic.sol": { "TermsLogic": "0x36233627729300a841876ceb0ddb94527f84e092" } } } }