forked from ChromaPDX/liquidCollectionXChroma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolc-input-contracts.json
187 lines (187 loc) · 216 KB
/
solc-input-contracts.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
{
"language": "Solidity",
"sources": {
"./contracts/LiquidCollectionsSignatureDrop.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"@thirdweb-dev/contracts/base/ERC721Drop.sol\";\nimport \"@thirdweb-dev/contracts/drop/DropERC721.sol\";\nimport \"@thirdweb-dev/contracts/eip/interface/IERC721Enumerable.sol\";\nimport \"@thirdweb-dev/contracts/extension/Drop.sol\";\n\n// import \"@thirdweb-dev/contracts/signature-drop/SignatureDrop.sol\";\n\ncontract LiquidCollections2 is DropERC721 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _royaltyRecipient,\n uint128 _royaltyBps,\n address _primarySaleRecipient\n )\n DropERC721(\n // _name,\n // _symbol,\n // _royaltyRecipient,\n // _royaltyBps,\n // _primarySaleRecipient\n )\n {}\n\n // // copy-pasted from DropSinglePhase.sol\n // function canClaim(\n // address _receiver,\n // uint256 _quantity,\n // address _currency,\n // uint256 _pricePerToken,\n // AllowlistProof calldata _allowlistProof,\n // bytes memory _data\n // ) public view {\n // _beforeClaim(\n // _receiver,\n // _quantity,\n // _currency,\n // _pricePerToken,\n // _allowlistProof,\n // _data\n // );\n\n // // bytes32 activeConditionId = conditionId;\n\n // /**\n // * 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 // */\n\n // // Verify inclusion in allowlist.\n // (\n // bool validMerkleProof,\n // uint256 merkleProofIndex\n // ) = verifyClaimMerkleProof(\n // _dropMsgSender(),\n // _quantity,\n // _allowlistProof\n // );\n\n // // Verify claim validity. If not valid, revert.\n // // when there's allowlist present --> verifyClaimMerkleProof will verify the maxQuantityInAllowlist value with hashed leaf in the allowlist\n // // when there's no allowlist, this check is true --> verifyClaim will check for _quantity being equal/less than the limit\n // bool toVerifyMaxQuantityPerTransaction = _allowlistProof\n // .maxQuantityInAllowlist ==\n // 0 ||\n // claimCondition.merkleRoot == bytes32(0);\n\n // verifyClaim(\n // _dropMsgSender(),\n // _quantity,\n // _currency,\n // _pricePerToken,\n // toVerifyMaxQuantityPerTransaction\n // );\n // }\n\n /////////////////////\n // redemption\n /////////////////////\n mapping(uint256 => bool) private redeemed;\n\n event Redeem(address indexed from, uint256 indexed tokenId);\n\n function isRedeemable(uint256 tokenId) public view virtual returns (bool) {\n require(_exists(tokenId), \"LiquidCollections: Token does not exist\");\n return !redeemed[tokenId];\n }\n\n function redeem(uint256 tokenId) public virtual {\n require(_exists(tokenId), \"LiquidCollections: Token does not exist\");\n require(\n ownerOf(tokenId) == msg.sender,\n \"LiquidCollections: You are not the owner of this token\"\n );\n require(\n redeemed[tokenId] == false,\n \"LiquidCollections: NFT is aleady redeemed\"\n );\n\n redeemed[tokenId] = true;\n\n emit Redeem(msg.sender, tokenId);\n }\n\n struct Redeemey {\n uint256 id;\n string tokenURI;\n bool redeemed;\n }\n\n function getMineWithMetadata(address _owner)\n public\n view\n returns (Redeemey[] memory)\n {\n // address _owner = msg.sender;\n uint256 lngth = balanceOf(_owner);\n Redeemey[] memory _metadatasOfOwners = new Redeemey[](lngth);\n\n uint256 i;\n for (i = 0; i < lngth; i++) {\n uint256 tUid = tokenOfOwnerByIndex(_owner, i);\n\n _metadatasOfOwners[i] = Redeemey({\n id: tUid,\n redeemed: redeemed[tUid],\n tokenURI: tokenURI(tUid)\n });\n }\n\n return (_metadatasOfOwners);\n }\n\n /////////////////////\n // enumerability\n /////////////////////\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n // function tokenOfOwnerByIndex(address owner, uint256 index)\n // public\n // view\n // virtual\n // override\n // returns (uint256)\n // {\n // require(\n // index < balanceOf(owner),\n // \"ERC721Enumerable: owner index out of bounds\"\n // );\n // return _ownedTokens[owner][index];\n // }\n\n // /**\n // * @dev See {IERC721Enumerable-totalSupply}.\n // */\n // function totalSupply() public view virtual override returns (uint256) {\n // return _allTokens.length;\n // }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n // function tokenByIndex(uint256 index)\n // public\n // view\n // virtual\n // override\n // returns (uint256)\n // {\n // require(\n // index < totalSupply(),\n // \"ERC721Enumerable: global index out of bounds\"\n // );\n // return _allTokens[index];\n // }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and 'to' cannot be the zero address at the same time.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n // function _beforeTokenTransfers(\n // address from,\n // address to,\n // uint256 tokenId,\n // uint256 quantity\n // ) internal virtual override {\n // // super._beforeTokenTransfer(from, to, tokenId);\n\n // if (from == address(0)) {\n // _addTokenToAllTokensEnumeration(tokenId);\n // } else if (from != to) {\n // _removeTokenFromOwnerEnumeration(from, tokenId);\n // }\n // if (to == address(0)) {\n // _removeTokenFromAllTokensEnumeration(tokenId);\n // } else if (to != from) {\n // _addTokenToOwnerEnumeration(to, tokenId);\n // }\n // }\n\n // /**\n // * @dev Hook that is called before any batch token transfer. For now this is limited\n // * to batch minting by the {ERC721Consecutive} extension.\n // *\n // * Calling conditions:\n // *\n // * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n // * transferred to `to`.\n // * - When `from` is zero, `tokenId` will be minted for `to`.\n // * - When `to` is zero, ``from``'s `tokenId` will be burned.\n // * - `from` cannot be the zero address.\n // * - `to` cannot be the zero address.\n // *\n // * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n // */\n // function _beforeConsecutiveTokenTransfer(\n // address,\n // address,\n // uint256,\n // uint96\n // ) internal virtual override {\n // revert(\"ERC721Enumerable: consecutive transfers not supported\");\n // }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n // function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n // uint256 length = ERC721A.balanceOf(to);\n // _ownedTokens[to][length] = tokenId;\n // _ownedTokensIndex[tokenId] = length;\n // }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n // function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n // _allTokensIndex[tokenId] = _allTokens.length;\n // _allTokens.push(tokenId);\n // }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n // function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId)\n // private\n // {\n // // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // // then delete the last slot (swap and pop).\n\n // uint256 lastTokenIndex = ERC721A.balanceOf(from) - 1;\n // uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // // When the token to delete is the last token, the swap operation is unnecessary\n // if (tokenIndex != lastTokenIndex) {\n // uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n // _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n // _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n // }\n\n // // This also deletes the contents at the last position of the array\n // delete _ownedTokensIndex[tokenId];\n // delete _ownedTokens[from][lastTokenIndex];\n // }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n // function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // // then delete the last slot (swap and pop).\n\n // uint256 lastTokenIndex = _allTokens.length - 1;\n // uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n // uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n // _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n // _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // // This also deletes the contents at the last position of the array\n // delete _allTokensIndex[tokenId];\n // _allTokens.pop();\n // }\n}\n"
},
"./contracts/LiquidCollections.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"@thirdweb-dev/contracts/base/ERC721Drop.sol\";\nimport \"@thirdweb-dev/contracts/eip/interface/IERC721Enumerable.sol\";\nimport \"@thirdweb-dev/contracts/extension/Drop.sol\";\n\ncontract LiquidCollections is IERC721Enumerable, ERC721Drop {\n constructor(\n string memory _name,\n string memory _symbol,\n address _royaltyRecipient,\n uint128 _royaltyBps,\n address _primarySaleRecipient\n )\n ERC721Drop(\n _name,\n _symbol,\n _royaltyRecipient,\n _royaltyBps,\n _primarySaleRecipient\n )\n {}\n\n // // copy-pasted from DropSinglePhase.sol\n // function canClaim(\n // address _receiver,\n // uint256 _quantity,\n // address _currency,\n // uint256 _pricePerToken,\n // AllowlistProof calldata _allowlistProof,\n // bytes memory _data\n // ) public view {\n // _beforeClaim(\n // _receiver,\n // _quantity,\n // _currency,\n // _pricePerToken,\n // _allowlistProof,\n // _data\n // );\n\n // // bytes32 activeConditionId = conditionId;\n\n // /**\n // * 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 // */\n\n // // Verify inclusion in allowlist.\n // (\n // bool validMerkleProof,\n // uint256 merkleProofIndex\n // ) = verifyClaimMerkleProof(\n // _dropMsgSender(),\n // _quantity,\n // _allowlistProof\n // );\n\n // // Verify claim validity. If not valid, revert.\n // // when there's allowlist present --> verifyClaimMerkleProof will verify the maxQuantityInAllowlist value with hashed leaf in the allowlist\n // // when there's no allowlist, this check is true --> verifyClaim will check for _quantity being equal/less than the limit\n // bool toVerifyMaxQuantityPerTransaction = _allowlistProof\n // .maxQuantityInAllowlist ==\n // 0 ||\n // claimCondition.merkleRoot == bytes32(0);\n\n // verifyClaim(\n // _dropMsgSender(),\n // _quantity,\n // _currency,\n // _pricePerToken,\n // toVerifyMaxQuantityPerTransaction\n // );\n // }\n\n /////////////////////\n // redemption\n /////////////////////\n mapping(uint256 => bool) private redeemed;\n\n event Redeem(address indexed from, uint256 indexed tokenId);\n\n function isRedeemable(uint256 tokenId) public view virtual returns (bool) {\n require(_exists(tokenId), \"LiquidCollections: Token does not exist\");\n return !redeemed[tokenId];\n }\n\n function redeem(uint256 tokenId) public virtual {\n require(_exists(tokenId), \"LiquidCollections: Token does not exist\");\n require(\n ownerOf(tokenId) == msg.sender,\n \"LiquidCollections: You are not the owner of this token\"\n );\n require(\n redeemed[tokenId] == false,\n \"LiquidCollections: NFT is aleady redeemed\"\n );\n\n redeemed[tokenId] = true;\n\n emit Redeem(msg.sender, tokenId);\n }\n\n struct Redeemey {\n uint256 id;\n string tokenURI;\n bool redeemed;\n }\n\n function getMineWithMetadata(address _owner)\n public\n view\n returns (Redeemey[] memory)\n {\n // address _owner = msg.sender;\n uint256 lngth = ERC721A.balanceOf(_owner);\n Redeemey[] memory _metadatasOfOwners = new Redeemey[](lngth);\n\n uint256 i;\n for (i = 0; i < lngth; i++) {\n uint256 tUid = tokenOfOwnerByIndex(_owner, i);\n\n _metadatasOfOwners[i] = Redeemey({\n id: tUid,\n redeemed: redeemed[tUid],\n tokenURI: tokenURI(tUid)\n });\n }\n\n return (_metadatasOfOwners);\n }\n\n /////////////////////\n // enumerability\n /////////////////////\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index)\n public\n view\n virtual\n override\n returns (uint256)\n {\n require(\n index < ERC721A.balanceOf(owner),\n \"ERC721Enumerable: owner index out of bounds\"\n );\n return _ownedTokens[owner][index];\n }\n\n // /**\n // * @dev See {IERC721Enumerable-totalSupply}.\n // */\n // function totalSupply() public view virtual override returns (uint256) {\n // return _allTokens.length;\n // }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index)\n public\n view\n virtual\n override\n returns (uint256)\n {\n require(\n index < ERC721A.totalSupply(),\n \"ERC721Enumerable: global index out of bounds\"\n );\n return _allTokens[index];\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and 'to' cannot be the zero address at the same time.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfers(\n address from,\n address to,\n uint256 tokenId,\n uint256 quantity\n ) internal virtual override {\n // super._beforeTokenTransfer(from, to, tokenId);\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n // /**\n // * @dev Hook that is called before any batch token transfer. For now this is limited\n // * to batch minting by the {ERC721Consecutive} extension.\n // *\n // * Calling conditions:\n // *\n // * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n // * transferred to `to`.\n // * - When `from` is zero, `tokenId` will be minted for `to`.\n // * - When `to` is zero, ``from``'s `tokenId` will be burned.\n // * - `from` cannot be the zero address.\n // * - `to` cannot be the zero address.\n // *\n // * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n // */\n // function _beforeConsecutiveTokenTransfer(\n // address,\n // address,\n // uint256,\n // uint96\n // ) internal virtual override {\n // revert(\"ERC721Enumerable: consecutive transfers not supported\");\n // }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721A.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId)\n private\n {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721A.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n}\n"
},
"@thirdweb-dev/contracts/base/ERC721Drop.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport { ERC721A } from \"../eip/ERC721A.sol\";\n\nimport \"../extension/ContractMetadata.sol\";\nimport \"../extension/Multicall.sol\";\nimport \"../extension/Ownable.sol\";\nimport \"../extension/Royalty.sol\";\nimport \"../extension/BatchMintMetadata.sol\";\nimport \"../extension/PrimarySale.sol\";\nimport \"../extension/PermissionsEnumerable.sol\";\nimport \"../extension/DropSinglePhase.sol\";\nimport \"../extension/LazyMint.sol\";\nimport \"../extension/DelayedReveal.sol\";\n\nimport \"../lib/TWStrings.sol\";\nimport \"../lib/CurrencyTransferLib.sol\";\n\n/**\n * BASE: ERC721A\n * EXTENSION: DropSinglePhase\n *\n * The `ERC721Drop` contract implements the ERC721 NFT standard, along with the ERC721A optimization to the standard.\n * It includes the following additions to standard ERC721 logic:\n *\n * - Contract metadata for royalty support on platforms such as OpenSea that use\n * off-chain information to distribute roaylties.\n *\n * - Ownership of the contract, with the ability to restrict certain functions to\n * only be called by the contract's owner.\n *\n * - Multicall capability to perform multiple actions atomically\n *\n * - EIP 2981 compliance for royalty support on NFT marketplaces.\n *\n * The `drop` mechanism in the `DropSinglePhase` extension is a distribution mechanism for lazy minted tokens. It lets\n * you set restrictions such as a price to charge, an allowlist etc. when an address atttempts to mint lazy minted tokens.\n *\n * The `ERC721Drop` contract lets you lazy mint tokens, and distribute those lazy minted tokens via the drop mechanism.\n */\n\ncontract ERC721Drop is\n ERC721A,\n ContractMetadata,\n Multicall,\n Ownable,\n Royalty,\n BatchMintMetadata,\n PrimarySale,\n LazyMint,\n DelayedReveal,\n DropSinglePhase\n{\n using TWStrings for uint256;\n\n /*///////////////////////////////////////////////////////////////\n Constructor\n //////////////////////////////////////////////////////////////*/\n\n constructor(\n string memory _name,\n string memory _symbol,\n address _royaltyRecipient,\n uint128 _royaltyBps,\n address _primarySaleRecipient\n ) ERC721A(_name, _symbol) {\n _setupOwner(msg.sender);\n _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);\n _setupPrimarySaleRecipient(_primarySaleRecipient);\n }\n\n /*//////////////////////////////////////////////////////////////\n ERC165 Logic\n //////////////////////////////////////////////////////////////*/\n\n /// @dev See ERC165: https://eips.ethereum.org/EIPS/eip-165\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, IERC165) returns (bool) {\n return\n interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165\n interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721\n interfaceId == 0x5b5e139f || // ERC165 Interface ID for ERC721Metadata\n interfaceId == type(IERC2981).interfaceId; // ERC165 ID for ERC2981\n }\n\n /*///////////////////////////////////////////////////////////////\n Overriden ERC 721 logic\n //////////////////////////////////////////////////////////////*/\n\n /**\n * @notice Returns the metadata URI for an NFT.\n * @dev See `BatchMintMetadata` for handling of metadata in this contract.\n *\n * @param _tokenId The tokenId of an NFT.\n */\n function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {\n (uint256 batchId, ) = _getBatchId(_tokenId);\n string memory batchUri = _getBaseURI(_tokenId);\n\n if (isEncryptedBatch(batchId)) {\n return string(abi.encodePacked(batchUri, \"0\"));\n } else {\n return string(abi.encodePacked(batchUri, _tokenId.toString()));\n }\n }\n\n /*///////////////////////////////////////////////////////////////\n Overriden lazy minting logic\n //////////////////////////////////////////////////////////////*/\n\n /**\n * @notice Lets an authorized address lazy mint a given amount of NFTs.\n *\n * @param _amount The number of NFTs to lazy mint.\n * @param _baseURIForTokens The placeholder base URI for the 'n' number of NFTs being lazy minted, where the\n * metadata for each of those NFTs is `${baseURIForTokens}/${tokenId}`.\n * @param _data The encrypted base URI + provenance hash for the batch of NFTs being lazy minted.\n * @return batchId A unique integer identifier for the batch of NFTs lazy minted together.\n */\n function lazyMint(\n uint256 _amount,\n string calldata _baseURIForTokens,\n bytes calldata _data\n ) public override returns (uint256 batchId) {\n if (_data.length > 0) {\n (bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(_data, (bytes, bytes32));\n if (encryptedURI.length != 0 && provenanceHash != \"\") {\n _setEncryptedData(nextTokenIdToLazyMint + _amount, _data);\n }\n }\n\n return LazyMint.lazyMint(_amount, _baseURIForTokens, _data);\n }\n\n /// @notice The tokenId assigned to the next new NFT to be lazy minted.\n function nextTokenIdToMint() public view virtual returns (uint256) {\n return nextTokenIdToLazyMint;\n }\n\n /// @notice The tokenId assigned to the next new NFT to be claimed.\n function nextTokenIdToClaim() public view virtual returns (uint256) {\n return _currentIndex;\n }\n\n /*///////////////////////////////////////////////////////////////\n Delayed reveal logic\n //////////////////////////////////////////////////////////////*/\n\n /**\n * @notice Lets an authorized address reveal a batch of delayed reveal NFTs.\n *\n * @param _index The ID for the batch of delayed-reveal NFTs to reveal.\n * @param _key The key with which the base URI for the relevant batch of NFTs was encrypted.\n */\n function reveal(uint256 _index, bytes calldata _key) public virtual override returns (string memory revealedURI) {\n require(_canReveal(), \"Not authorized\");\n\n uint256 batchId = getBatchIdAtIndex(_index);\n revealedURI = getRevealURI(batchId, _key);\n\n _setEncryptedData(batchId, \"\");\n _setBaseURI(batchId, revealedURI);\n\n emit TokenURIRevealed(_index, revealedURI);\n }\n\n /*//////////////////////////////////////////////////////////////\n Minting/burning logic\n //////////////////////////////////////////////////////////////*/\n\n /**\n * @notice Lets an owner or approved operator burn the NFT of the given tokenId.\n * @dev ERC721A's `_burn(uint256,bool)` internally checks for token approvals.\n *\n * @param _tokenId The tokenId of the NFT to burn.\n */\n function burn(uint256 _tokenId) external virtual {\n _burn(_tokenId, true);\n }\n\n /*///////////////////////////////////////////////////////////////\n Internal functions\n //////////////////////////////////////////////////////////////*/\n\n /// @dev Runs before every `claim` function call.\n function _beforeClaim(\n address,\n uint256 _quantity,\n address,\n uint256,\n AllowlistProof calldata,\n bytes memory\n ) internal view virtual override {\n require(msg.sender == tx.origin, \"BOT\");\n if (_currentIndex + _quantity > nextTokenIdToLazyMint) {\n revert(\"Not enough minted tokens\");\n }\n }\n\n /// @dev Collects and distributes the primary sale value of NFTs being claimed.\n function _collectPriceOnClaim(\n address _primarySaleRecipient,\n uint256 _quantityToClaim,\n address _currency,\n uint256 _pricePerToken\n ) internal virtual override {\n if (_pricePerToken == 0) {\n return;\n }\n\n uint256 totalPrice = _quantityToClaim * _pricePerToken;\n\n if (_currency == CurrencyTransferLib.NATIVE_TOKEN) {\n if (msg.value != totalPrice) {\n revert(\"Must send total price\");\n }\n }\n\n address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient;\n CurrencyTransferLib.transferCurrency(_currency, msg.sender, saleRecipient, totalPrice);\n }\n\n /// @dev Transfers the NFTs being claimed.\n function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed)\n internal\n virtual\n override\n returns (uint256 startTokenId)\n {\n startTokenId = _currentIndex;\n _safeMint(_to, _quantityBeingClaimed);\n }\n\n /// @dev Checks whether primary sale recipient can be set in the given execution context.\n function _canSetPrimarySaleRecipient() internal view virtual override returns (bool) {\n return msg.sender == owner();\n }\n\n /// @dev Checks whether owner can be set in the given execution context.\n function _canSetOwner() internal view virtual override returns (bool) {\n return msg.sender == owner();\n }\n\n /// @dev Checks whether royalty info can be set in the given execution context.\n function _canSetRoyaltyInfo() internal view virtual override returns (bool) {\n return msg.sender == owner();\n }\n\n /// @dev Checks whether contract metadata can be set in the given execution context.\n function _canSetContractURI() internal view virtual override returns (bool) {\n return msg.sender == owner();\n }\n\n /// @dev Checks whether platform fee info can be set in the given execution context.\n function _canSetClaimConditions() internal view virtual override returns (bool) {\n return msg.sender == owner();\n }\n\n /// @dev Returns whether lazy minting can be done in the given execution context.\n function _canLazyMint() internal view virtual override returns (bool) {\n return msg.sender == owner();\n }\n\n /// @dev Checks whether NFTs can be revealed in the given execution context.\n function _canReveal() internal view virtual returns (bool) {\n return msg.sender == owner();\n }\n\n /*///////////////////////////////////////////////////////////////\n Miscellaneous\n //////////////////////////////////////////////////////////////*/\n\n function _dropMsgSender() internal view virtual override returns (address) {\n return msg.sender;\n }\n}\n"
},
"@thirdweb-dev/contracts/eip/ERC721A.sol": {
"content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v3.3.0\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport \"./interface/IERC721A.sol\";\nimport \"../openzeppelin-presets/token/ERC721/IERC721Receiver.sol\";\nimport \"../lib/TWAddress.sol\";\nimport \"../openzeppelin-presets/utils/Context.sol\";\nimport \"../lib/TWStrings.sol\";\nimport \"./ERC165.sol\";\n\n/**\n * @dev Implementation of [ERC721](https://eips.ethereum.org/EIPS/eip-721) Non-Fungible Token Standard, including\n * the Metadata extension. Built to optimize for lower gas during batch mints.\n *\n * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).\n *\n * Assumes that an owner cannot have more than 2^64 - 1 (max value of uint64) of supply.\n *\n * Assumes that the maximum token id cannot exceed 2^256 - 1 (max value of uint256).\n */\ncontract ERC721A is Context, ERC165, IERC721A {\n using TWAddress for address;\n using TWStrings for uint256;\n\n // The tokenId of the next token to be minted.\n uint256 internal _currentIndex;\n\n // The number of tokens burned.\n uint256 internal _burnCounter;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to ownership details\n // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.\n mapping(uint256 => TokenOwnership) internal _ownerships;\n\n // Mapping owner address to address data\n mapping(address => AddressData) private _addressData;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n _currentIndex = _startTokenId();\n }\n\n /**\n * To change the starting tokenId, please override this function.\n */\n function _startTokenId() internal view virtual returns (uint256) {\n return 0;\n }\n\n /**\n * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.\n */\n function totalSupply() public view override returns (uint256) {\n // Counter underflow is impossible as _burnCounter cannot be incremented\n // more than _currentIndex - _startTokenId() times\n unchecked {\n return _currentIndex - _burnCounter - _startTokenId();\n }\n }\n\n /**\n * Returns the total amount of tokens minted in the contract.\n */\n function _totalMinted() internal view returns (uint256) {\n // Counter underflow is impossible as _currentIndex does not decrement,\n // and it is initialized to _startTokenId()\n unchecked {\n return _currentIndex - _startTokenId();\n }\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view override returns (uint256) {\n if (owner == address(0)) revert BalanceQueryForZeroAddress();\n return uint256(_addressData[owner].balance);\n }\n\n /**\n * Returns the number of tokens minted by `owner`.\n */\n function _numberMinted(address owner) internal view returns (uint256) {\n return uint256(_addressData[owner].numberMinted);\n }\n\n /**\n * Returns the number of tokens burned by or on behalf of `owner`.\n */\n function _numberBurned(address owner) internal view returns (uint256) {\n return uint256(_addressData[owner].numberBurned);\n }\n\n /**\n * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).\n */\n function _getAux(address owner) internal view returns (uint64) {\n return _addressData[owner].aux;\n }\n\n /**\n * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).\n * If there are multiple variables, please pack them into a uint64.\n */\n function _setAux(address owner, uint64 aux) internal {\n _addressData[owner].aux = aux;\n }\n\n /**\n * Gas spent here starts off proportional to the maximum mint batch size.\n * It gradually moves to O(1) as tokens get transferred around in the collection over time.\n */\n function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {\n uint256 curr = tokenId;\n\n unchecked {\n if (_startTokenId() <= curr)\n if (curr < _currentIndex) {\n TokenOwnership memory ownership = _ownerships[curr];\n if (!ownership.burned) {\n if (ownership.addr != address(0)) {\n return ownership;\n }\n // Invariant:\n // There will always be an ownership that has an address and is not burned\n // before an ownership that does not have an address and is not burned.\n // Hence, curr will not underflow.\n while (true) {\n curr--;\n ownership = _ownerships[curr];\n if (ownership.addr != address(0)) {\n return ownership;\n }\n }\n }\n }\n }\n revert OwnerQueryForNonexistentToken();\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view override returns (address) {\n return _ownershipOf(tokenId).addr;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n if (!_exists(tokenId)) revert URIQueryForNonexistentToken();\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overriden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public override {\n address owner = ERC721A.ownerOf(tokenId);\n if (to == owner) revert ApprovalToCurrentOwner();\n\n if (_msgSender() != owner)\n if (!isApprovedForAll(owner, _msgSender())) {\n revert ApprovalCallerNotOwnerNorApproved();\n }\n\n _approve(to, tokenId, owner);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view override returns (address) {\n if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n if (operator == _msgSender()) revert ApproveToCaller();\n\n _operatorApprovals[_msgSender()][operator] = approved;\n emit ApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n _transfer(from, to, tokenId);\n if (to.isContract())\n if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n */\n function _exists(uint256 tokenId) internal view returns (bool) {\n return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned;\n }\n\n /**\n * @dev Equivalent to `_safeMint(to, quantity, '')`.\n */\n function _safeMint(address to, uint256 quantity) internal {\n _safeMint(to, quantity, \"\");\n }\n\n /**\n * @dev Safely mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.\n * - `quantity` must be greater than 0.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(\n address to,\n uint256 quantity,\n bytes memory _data\n ) internal {\n uint256 startTokenId = _currentIndex;\n if (to == address(0)) revert MintToZeroAddress();\n if (quantity == 0) revert MintZeroQuantity();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are incredibly unrealistic.\n // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1\n // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1\n unchecked {\n _addressData[to].balance += uint64(quantity);\n _addressData[to].numberMinted += uint64(quantity);\n\n _ownerships[startTokenId].addr = to;\n _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);\n\n uint256 updatedIndex = startTokenId;\n uint256 end = updatedIndex + quantity;\n\n if (to.isContract()) {\n do {\n emit Transfer(address(0), to, updatedIndex);\n if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n } while (updatedIndex < end);\n // Reentrancy protection\n if (_currentIndex != startTokenId) revert();\n } else {\n do {\n emit Transfer(address(0), to, updatedIndex++);\n } while (updatedIndex < end);\n }\n _currentIndex = updatedIndex;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 quantity) internal {\n uint256 startTokenId = _currentIndex;\n if (to == address(0)) revert MintToZeroAddress();\n if (quantity == 0) revert MintZeroQuantity();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are incredibly unrealistic.\n // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1\n // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1\n unchecked {\n _addressData[to].balance += uint64(quantity);\n _addressData[to].numberMinted += uint64(quantity);\n\n _ownerships[startTokenId].addr = to;\n _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);\n\n uint256 updatedIndex = startTokenId;\n uint256 end = updatedIndex + quantity;\n\n do {\n emit Transfer(address(0), to, updatedIndex++);\n } while (updatedIndex < end);\n\n _currentIndex = updatedIndex;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) private {\n TokenOwnership memory prevOwnership = _ownershipOf(tokenId);\n\n if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();\n\n bool isApprovedOrOwner = (_msgSender() == from ||\n isApprovedForAll(from, _msgSender()) ||\n getApproved(tokenId) == _msgSender());\n\n if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();\n if (to == address(0)) revert TransferToZeroAddress();\n\n _beforeTokenTransfers(from, to, tokenId, 1);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId, from);\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.\n unchecked {\n _addressData[from].balance -= 1;\n _addressData[to].balance += 1;\n\n TokenOwnership storage currSlot = _ownerships[tokenId];\n currSlot.addr = to;\n currSlot.startTimestamp = uint64(block.timestamp);\n\n // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.\n // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.\n uint256 nextTokenId = tokenId + 1;\n TokenOwnership storage nextSlot = _ownerships[nextTokenId];\n if (nextSlot.addr == address(0)) {\n // This will suffice for checking _exists(nextTokenId),\n // as a burned slot cannot contain the zero address.\n if (nextTokenId != _currentIndex) {\n nextSlot.addr = from;\n nextSlot.startTimestamp = prevOwnership.startTimestamp;\n }\n }\n }\n\n emit Transfer(from, to, tokenId);\n _afterTokenTransfers(from, to, tokenId, 1);\n }\n\n /**\n * @dev Equivalent to `_burn(tokenId, false)`.\n */\n function _burn(uint256 tokenId) internal virtual {\n _burn(tokenId, false);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId, bool approvalCheck) internal virtual {\n TokenOwnership memory prevOwnership = _ownershipOf(tokenId);\n\n address from = prevOwnership.addr;\n\n if (approvalCheck) {\n bool isApprovedOrOwner = (_msgSender() == from ||\n isApprovedForAll(from, _msgSender()) ||\n getApproved(tokenId) == _msgSender());\n\n if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();\n }\n\n _beforeTokenTransfers(from, address(0), tokenId, 1);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId, from);\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.\n unchecked {\n AddressData storage addressData = _addressData[from];\n addressData.balance -= 1;\n addressData.numberBurned += 1;\n\n // Keep track of who burned the token, and the timestamp of burning.\n TokenOwnership storage currSlot = _ownerships[tokenId];\n currSlot.addr = from;\n currSlot.startTimestamp = uint64(block.timestamp);\n currSlot.burned = true;\n\n // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.\n // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.\n uint256 nextTokenId = tokenId + 1;\n TokenOwnership storage nextSlot = _ownerships[nextTokenId];\n if (nextSlot.addr == address(0)) {\n // This will suffice for checking _exists(nextTokenId),\n // as a burned slot cannot contain the zero address.\n if (nextTokenId != _currentIndex) {\n nextSlot.addr = from;\n nextSlot.startTimestamp = prevOwnership.startTimestamp;\n }\n }\n }\n\n emit Transfer(from, address(0), tokenId);\n _afterTokenTransfers(from, address(0), tokenId, 1);\n\n // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.\n unchecked {\n _burnCounter++;\n }\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(\n address to,\n uint256 tokenId,\n address owner\n ) private {\n _tokenApprovals[tokenId] = to;\n emit Approval(owner, to, tokenId);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkContractOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert TransferToNonERC721ReceiverImplementer();\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n\n /**\n * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.\n * And also called before burning one token.\n *\n * startTokenId - the first token id to be transferred\n * quantity - the amount to be transferred\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _beforeTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes\n * minting.\n * And also called after one token has been burned.\n *\n * startTokenId - the first token id to be transferred\n * quantity - the amount to be transferred\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been\n * transferred to `to`.\n * - When `from` is zero, `tokenId` has been minted for `to`.\n * - When `to` is zero, `tokenId` has been burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _afterTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n}\n"
},
"@thirdweb-dev/contracts/eip/interface/IERC721A.sol": {
"content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v3.3.0\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Metadata.sol\";\n\n/**\n * @dev Interface of an ERC721A compliant contract.\n */\ninterface IERC721A is IERC721, IERC721Metadata {\n /**\n * The caller must own the token or be an approved operator.\n */\n error ApprovalCallerNotOwnerNorApproved();\n\n /**\n * The token does not exist.\n */\n error ApprovalQueryForNonexistentToken();\n\n /**\n * The caller cannot approve to their own address.\n */\n error ApproveToCaller();\n\n /**\n * The caller cannot approve to the current owner.\n */\n error ApprovalToCurrentOwner();\n\n /**\n * Cannot query the balance for the zero address.\n */\n error BalanceQueryForZeroAddress();\n\n /**\n * Cannot mint to the zero address.\n */\n error MintToZeroAddress();\n\n /**\n * The quantity of tokens minted must be more than zero.\n */\n error MintZeroQuantity();\n\n /**\n * The token does not exist.\n */\n error OwnerQueryForNonexistentToken();\n\n /**\n * The caller must own the token or be an approved operator.\n */\n error TransferCallerNotOwnerNorApproved();\n\n /**\n * The token must be owned by `from`.\n */\n error TransferFromIncorrectOwner();\n\n /**\n * Cannot safely transfer to a contract that does not implement the ERC721Receiver interface.\n */\n error TransferToNonERC721ReceiverImplementer();\n\n /**\n * Cannot transfer to the zero address.\n */\n error TransferToZeroAddress();\n\n /**\n * The token does not exist.\n */\n error URIQueryForNonexistentToken();\n\n // Compiler will pack this into a single 256bit word.\n struct TokenOwnership {\n // The address of the owner.\n address addr;\n // Keeps track of the start time of ownership with minimal overhead for tokenomics.\n uint64 startTimestamp;\n // Whether the token has been burned.\n bool burned;\n }\n\n // Compiler will pack this into a single 256bit word.\n struct AddressData {\n // Realistically, 2**64-1 is more than enough.\n uint64 balance;\n // Keeps track of mint count with minimal overhead for tokenomics.\n uint64 numberMinted;\n // Keeps track of burn count with minimal overhead for tokenomics.\n uint64 numberBurned;\n // For miscellaneous variable(s) pertaining to the address\n // (e.g. number of whitelist mint slots used).\n // If there are multiple variables, please pack them into a uint64.\n uint64 aux;\n }\n\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n *\n * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.\n */\n function totalSupply() external view returns (uint256);\n}\n"
},
"@thirdweb-dev/contracts/eip/interface/IERC721.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n"
},
"@thirdweb-dev/contracts/eip/interface/IERC721Metadata.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n/// @dev See https://eips.ethereum.org/EIPS/eip-721\n/// Note: the ERC-165 identifier for this interface is 0x5b5e139f.\n/* is ERC721 */\ninterface IERC721Metadata {\n /// @notice A descriptive name for a collection of NFTs in this contract\n function name() external view returns (string memory);\n\n /// @notice An abbreviated name for NFTs in this contract\n function symbol() external view returns (string memory);\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\n /// 3986. The URI may point to a JSON file that conforms to the \"ERC721\n /// Metadata JSON Schema\".\n function tokenURI(uint256 _tokenId) external view returns (string memory);\n}\n"
},
"@thirdweb-dev/contracts/openzeppelin-presets/token/ERC721/IERC721Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@thirdweb-dev/contracts/lib/TWAddress.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary TWAddress {\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 * [EIP1884](https://eips.ethereum.org/EIPS/eip-1884) 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 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 require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(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"
},
"@thirdweb-dev/contracts/openzeppelin-presets/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
},
"@thirdweb-dev/contracts/lib/TWStrings.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 TWStrings {\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"
},
"@thirdweb-dev/contracts/eip/ERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./interface/IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
},
"@thirdweb-dev/contracts/eip/interface/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * [EIP](https://eips.ethereum.org/EIPS/eip-165).\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@thirdweb-dev/contracts/extension/ContractMetadata.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./interface/IContractMetadata.sol\";\n\n/**\n * @title Contract Metadata\n * @notice Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI\n * for you contract.\n * Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.\n */\n\nabstract contract ContractMetadata is IContractMetadata {\n /// @notice Returns the contract metadata URI.\n string public override contractURI;\n\n /**\n * @notice Lets a contract admin set the URI for contract-level metadata.\n * @dev Caller should be authorized to setup contractURI, e.g. contract admin.\n * See {_canSetContractURI}.\n * Emits {ContractURIUpdated Event}.\n *\n * @param _uri keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n */\n function setContractURI(string memory _uri) external override {\n if (!_canSetContractURI()) {\n revert(\"Not authorized\");\n }\n\n _setupContractURI(_uri);\n }\n\n /// @dev Lets a contract admin set the URI for contract-level metadata.\n function _setupContractURI(string memory _uri) internal {\n string memory prevURI = contractURI;\n contractURI = _uri;\n\n emit ContractURIUpdated(prevURI, _uri);\n }\n\n /// @dev Returns whether contract metadata can be set in the given execution context.\n function _canSetContractURI() internal view virtual returns (bool);\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IContractMetadata.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI\n * for you contract.\n *\n * Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.\n */\n\ninterface IContractMetadata {\n /// @dev Returns the metadata URI of the contract.\n function contractURI() external view returns (string memory);\n\n /**\n * @dev Sets contract URI for the storefront-level metadata of the contract.\n * Only module admin can call this function.\n */\n function setContractURI(string calldata _uri) external;\n\n /// @dev Emitted when the contract URI is updated.\n event ContractURIUpdated(string prevURI, string newURI);\n}\n"
},
"@thirdweb-dev/contracts/extension/Multicall.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../lib/TWAddress.sol\";\nimport \"./interface/IMulticall.sol\";\n\n/**\n * @dev Provides a function to batch together multiple calls in a single external call.\n *\n * _Available since v4.1._\n */\ncontract Multicall is IMulticall {\n /**\n * @notice Receives and executes a batch of function calls on this contract.\n * @dev Receives and executes a batch of function calls on this contract.\n *\n * @param data The bytes data that makes up the batch of function calls to execute.\n * @return results The bytes data that makes up the result of the batch of function calls executed.\n */\n function multicall(bytes[] calldata data) external virtual override returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n results[i] = TWAddress.functionDelegateCall(address(this), data[i]);\n }\n return results;\n }\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IMulticall.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides a function to batch together multiple calls in a single external call.\n *\n * _Available since v4.1._\n */\ninterface IMulticall {\n /**\n * @dev Receives and executes a batch of function calls on this contract.\n */\n function multicall(bytes[] calldata data) external returns (bytes[] memory results);\n}\n"
},
"@thirdweb-dev/contracts/extension/Ownable.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./interface/IOwnable.sol\";\n\n/**\n * @title Ownable\n * @notice Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading\n * who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses\n * information about who the contract's owner is.\n */\n\nabstract contract Ownable is IOwnable {\n /// @dev Owner of the contract (purpose: OpenSea compatibility)\n address private _owner;\n\n /// @dev Reverts if caller is not the owner.\n modifier onlyOwner() {\n if (msg.sender != _owner) {\n revert(\"Not authorized\");\n }\n _;\n }\n\n /**\n * @notice Returns the owner of the contract.\n */\n function owner() public view override returns (address) {\n return _owner;\n }\n\n /**\n * @notice Lets an authorized wallet set a new owner for the contract.\n * @param _newOwner The address to set as the new owner of the contract.\n */\n function setOwner(address _newOwner) external override {\n if (!_canSetOwner()) {\n revert(\"Not authorized\");\n }\n _setupOwner(_newOwner);\n }\n\n /// @dev Lets a contract admin set a new owner for the contract. The new owner must be a contract admin.\n function _setupOwner(address _newOwner) internal {\n address _prevOwner = _owner;\n _owner = _newOwner;\n\n emit OwnerUpdated(_prevOwner, _newOwner);\n }\n\n /// @dev Returns whether owner can be set in the given execution context.\n function _canSetOwner() internal view virtual returns (bool);\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IOwnable.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading\n * who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses\n * information about who the contract's owner is.\n */\n\ninterface IOwnable {\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 OwnerUpdated(address indexed prevOwner, address indexed newOwner);\n}\n"
},
"@thirdweb-dev/contracts/extension/Royalty.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./interface/IRoyalty.sol\";\n\n/**\n * @title Royalty\n * @notice Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading\n * the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic\n * that uses information about royalty fees, if desired.\n *\n * @dev The `Royalty` contract is ERC2981 compliant.\n */\n\nabstract contract Royalty is IRoyalty {\n /// @dev The (default) address that receives all royalty value.\n address private royaltyRecipient;\n\n /// @dev The (default) % of a sale to take as royalty (in basis points).\n uint16 private royaltyBps;\n\n /// @dev Token ID => royalty recipient and bps for token\n mapping(uint256 => RoyaltyInfo) private royaltyInfoForToken;\n\n /**\n * @notice View royalty info for a given token and sale price.\n * @dev Returns royalty amount and recipient for `tokenId` and `salePrice`.\n * @param tokenId The tokenID of the NFT for which to query royalty info.\n * @param salePrice Sale price of the token.\n *\n * @return receiver Address of royalty recipient account.\n * @return royaltyAmount Royalty amount calculated at current royaltyBps value.\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n virtual\n override\n returns (address receiver, uint256 royaltyAmount)\n {\n (address recipient, uint256 bps) = getRoyaltyInfoForToken(tokenId);\n receiver = recipient;\n royaltyAmount = (salePrice * bps) / 10_000;\n }\n\n /**\n * @notice View royalty info for a given token.\n * @dev Returns royalty recipient and bps for `_tokenId`.\n * @param _tokenId The tokenID of the NFT for which to query royalty info.\n */\n function getRoyaltyInfoForToken(uint256 _tokenId) public view override returns (address, uint16) {\n RoyaltyInfo memory royaltyForToken = royaltyInfoForToken[_tokenId];\n\n return\n royaltyForToken.recipient == address(0)\n ? (royaltyRecipient, uint16(royaltyBps))\n : (royaltyForToken.recipient, uint16(royaltyForToken.bps));\n }\n\n /**\n * @notice Returns the defualt royalty recipient and BPS for this contract's NFTs.\n */\n function getDefaultRoyaltyInfo() external view override returns (address, uint16) {\n return (royaltyRecipient, uint16(royaltyBps));\n }\n\n /**\n * @notice Updates default royalty recipient and bps.\n * @dev Caller should be authorized to set royalty info.\n * See {_canSetRoyaltyInfo}.\n * Emits {DefaultRoyalty Event}; See {_setupDefaultRoyaltyInfo}.\n *\n * @param _royaltyRecipient Address to be set as default royalty recipient.\n * @param _royaltyBps Updated royalty bps.\n */\n function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external override {\n if (!_canSetRoyaltyInfo()) {\n revert(\"Not authorized\");\n }\n\n _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);\n }\n\n /// @dev Lets a contract admin update the default royalty recipient and bps.\n function _setupDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) internal {\n if (_royaltyBps > 10_000) {\n revert(\"Exceeds max bps\");\n }\n\n royaltyRecipient = _royaltyRecipient;\n royaltyBps = uint16(_royaltyBps);\n\n emit DefaultRoyalty(_royaltyRecipient, _royaltyBps);\n }\n\n /**\n * @notice Updates default royalty recipient and bps for a particular token.\n * @dev Sets royalty info for `_tokenId`. Caller should be authorized to set royalty info.\n * See {_canSetRoyaltyInfo}.\n * Emits {RoyaltyForToken Event}; See {_setupRoyaltyInfoForToken}.\n *\n * @param _recipient Address to be set as royalty recipient for given token Id.\n * @param _bps Updated royalty bps for the token Id.\n */\n function setRoyaltyInfoForToken(\n uint256 _tokenId,\n address _recipient,\n uint256 _bps\n ) external override {\n if (!_canSetRoyaltyInfo()) {\n revert(\"Not authorized\");\n }\n\n _setupRoyaltyInfoForToken(_tokenId, _recipient, _bps);\n }\n\n /// @dev Lets a contract admin set the royalty recipient and bps for a particular token Id.\n function _setupRoyaltyInfoForToken(\n uint256 _tokenId,\n address _recipient,\n uint256 _bps\n ) internal {\n if (_bps > 10_000) {\n revert(\"Exceeds max bps\");\n }\n\n royaltyInfoForToken[_tokenId] = RoyaltyInfo({ recipient: _recipient, bps: _bps });\n\n emit RoyaltyForToken(_tokenId, _recipient, _bps);\n }\n\n /// @dev Returns whether royalty info can be set in the given execution context.\n function _canSetRoyaltyInfo() internal view virtual returns (bool);\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IRoyalty.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"../../eip/interface/IERC2981.sol\";\n\n/**\n * Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading\n * the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic\n * that uses information about royalty fees, if desired.\n *\n * The `Royalty` contract is ERC2981 compliant.\n */\n\ninterface IRoyalty is IERC2981 {\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 indexed newRoyaltyRecipient, uint256 newRoyaltyBps);\n\n /// @dev Emitted when royalty recipient for tokenId is set\n event RoyaltyForToken(uint256 indexed tokenId, address indexed royaltyRecipient, uint256 royaltyBps);\n}\n"
},
"@thirdweb-dev/contracts/eip/interface/IERC2981.sol": {
"content": "// SPDX-License-Identifier: Apache 2.0\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981 is IERC165 {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be payed in that same unit of exchange.\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n returns (address receiver, uint256 royaltyAmount);\n}\n"
},
"@thirdweb-dev/contracts/extension/BatchMintMetadata.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * @title Batch-mint Metadata\n * @notice The `BatchMintMetadata` is a contract extension for any base NFT contract. It lets the smart contract\n * using this extension set metadata for `n` number of NFTs all at once. This is enabled by storing a single\n * base URI for a batch of `n` NFTs, where the metadata for each NFT in a relevant batch is `baseURI/tokenId`.\n */\n\ncontract BatchMintMetadata {\n /// @dev Largest tokenId of each batch of tokens with the same baseURI.\n uint256[] private batchIds;\n\n /// @dev Mapping from id of a batch of tokens => to base URI for the respective batch of tokens.\n mapping(uint256 => string) private baseURI;\n\n /**\n * @notice Returns the count of batches of NFTs.\n * @dev Each batch of tokens has an in ID and an associated `baseURI`.\n * See {batchIds}.\n */\n function getBaseURICount() public view returns (uint256) {\n return batchIds.length;\n }\n\n /**\n * @notice Returns the ID for the batch of tokens the given tokenId belongs to.\n * @dev See {getBaseURICount}.\n * @param _index ID of a token.\n */\n function getBatchIdAtIndex(uint256 _index) public view returns (uint256) {\n if (_index >= getBaseURICount()) {\n revert(\"Invalid index\");\n }\n return batchIds[_index];\n }\n\n /// @dev Returns the id for the batch of tokens the given tokenId belongs to.\n function _getBatchId(uint256 _tokenId) internal view returns (uint256 batchId, uint256 index) {\n uint256 numOfTokenBatches = getBaseURICount();\n uint256[] memory indices = batchIds;\n\n for (uint256 i = 0; i < numOfTokenBatches; i += 1) {\n if (_tokenId < indices[i]) {\n index = i;\n batchId = indices[i];\n\n return (batchId, index);\n }\n }\n\n revert(\"Invalid tokenId\");\n }\n\n /// @dev Returns the baseURI for a token. The intended metadata URI for the token is baseURI + tokenId.\n function _getBaseURI(uint256 _tokenId) internal view returns (string memory) {\n uint256 numOfTokenBatches = getBaseURICount();\n uint256[] memory indices = batchIds;\n\n for (uint256 i = 0; i < numOfTokenBatches; i += 1) {\n if (_tokenId < indices[i]) {\n return baseURI[indices[i]];\n }\n }\n revert(\"Invalid tokenId\");\n }\n\n /// @dev Sets the base URI for the batch of tokens with the given batchId.\n function _setBaseURI(uint256 _batchId, string memory _baseURI) internal {\n baseURI[_batchId] = _baseURI;\n }\n\n /// @dev Mints a batch of tokenIds and associates a common baseURI to all those Ids.\n function _batchMintMetadata(\n uint256 _startId,\n uint256 _amountToMint,\n string memory _baseURIForTokens\n ) internal returns (uint256 nextTokenIdToMint, uint256 batchId) {\n batchId = _startId + _amountToMint;\n nextTokenIdToMint = batchId;\n\n batchIds.push(batchId);\n\n baseURI[batchId] = _baseURIForTokens;\n }\n}\n"
},
"@thirdweb-dev/contracts/extension/PrimarySale.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./interface/IPrimarySale.sol\";\n\n/**\n * @title Primary Sale\n * @notice Thirdweb's `PrimarySale` is a contract extension to be used with any base contract. It exposes functions for setting and reading\n * the recipient of primary sales, and lets the inheriting contract perform conditional logic that uses information about\n * primary sales, if desired.\n */\n\nabstract contract PrimarySale is IPrimarySale {\n /// @dev The address that receives all primary sales value.\n address private recipient;\n\n /// @dev Returns primary sale recipient address.\n function primarySaleRecipient() public view override returns (address) {\n return recipient;\n }\n\n /**\n * @notice Updates primary sale recipient.\n * @dev Caller should be authorized to set primary sales info.\n * See {_canSetPrimarySaleRecipient}.\n * Emits {PrimarySaleRecipientUpdated Event}; See {_setupPrimarySaleRecipient}.\n *\n * @param _saleRecipient Address to be set as new recipient of primary sales.\n */\n function setPrimarySaleRecipient(address _saleRecipient) external override {\n if (!_canSetPrimarySaleRecipient()) {\n revert(\"Not authorized\");\n }\n _setupPrimarySaleRecipient(_saleRecipient);\n }\n\n /// @dev Lets a contract admin set the recipient for all primary sales.\n function _setupPrimarySaleRecipient(address _saleRecipient) internal {\n recipient = _saleRecipient;\n emit PrimarySaleRecipientUpdated(_saleRecipient);\n }\n\n /// @dev Returns whether primary sale recipient can be set in the given execution context.\n function _canSetPrimarySaleRecipient() internal view virtual returns (bool);\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IPrimarySale.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * Thirdweb's `Primary` is a contract extension to be used with any base contract. It exposes functions for setting and reading\n * the recipient of primary sales, and lets the inheriting contract perform conditional logic that uses information about\n * primary sales, if desired.\n */\n\ninterface IPrimarySale {\n /// @dev The adress 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"
},
"@thirdweb-dev/contracts/extension/PermissionsEnumerable.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./interface/IPermissionsEnumerable.sol\";\nimport \"./Permissions.sol\";\n\n/**\n * @title PermissionsEnumerable\n * @dev This contracts provides extending-contracts with role-based access control mechanisms.\n * Also provides interfaces to view all members with a given role, and total count of members.\n */\ncontract PermissionsEnumerable is IPermissionsEnumerable, Permissions {\n /**\n * @notice A data structure to store data of members for a given role.\n *\n * @param index Current index in the list of accounts that have a role.\n * @param members map from index => address of account that has a role\n * @param indexOf map from address => index which the account has.\n */\n struct RoleMembers {\n uint256 index;\n mapping(uint256 => address) members;\n mapping(address => uint256) indexOf;\n }\n\n /// @dev map from keccak256 hash of a role to its members' data. See {RoleMembers}.\n mapping(bytes32 => RoleMembers) private roleMembers;\n\n /**\n * @notice Returns the role-member from a list of members for a role,\n * at a given index.\n * @dev Returns `member` who has `role`, at `index` of role-members list.\n * See struct {RoleMembers}, and mapping {roleMembers}\n *\n * @param role keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n * @param index Index in list of current members for the role.\n *\n * @return member Address of account that has `role`\n */\n function getRoleMember(bytes32 role, uint256 index) external view override returns (address member) {\n uint256 currentIndex = roleMembers[role].index;\n uint256 check;\n\n for (uint256 i = 0; i < currentIndex; i += 1) {\n if (roleMembers[role].members[i] != address(0)) {\n if (check == index) {\n member = roleMembers[role].members[i];\n return member;\n }\n check += 1;\n } else if (hasRole(role, address(0)) && i == roleMembers[role].indexOf[address(0)]) {\n check += 1;\n }\n }\n }\n\n /**\n * @notice Returns total number of accounts that have a role.\n * @dev Returns `count` of accounts that have `role`.\n * See struct {RoleMembers}, and mapping {roleMembers}\n *\n * @param role keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n *\n * @return count Total number of accounts that have `role`\n */\n function getRoleMemberCount(bytes32 role) external view override returns (uint256 count) {\n uint256 currentIndex = roleMembers[role].index;\n\n for (uint256 i = 0; i < currentIndex; i += 1) {\n if (roleMembers[role].members[i] != address(0)) {\n count += 1;\n }\n }\n if (hasRole(role, address(0))) {\n count += 1;\n }\n }\n\n /// @dev Revokes `role` from `account`, and removes `account` from {roleMembers}\n /// See {_removeMember}\n function _revokeRole(bytes32 role, address account) internal override {\n super._revokeRole(role, account);\n _removeMember(role, account);\n }\n\n /// @dev Grants `role` to `account`, and adds `account` to {roleMembers}\n /// See {_addMember}\n function _setupRole(bytes32 role, address account) internal override {\n super._setupRole(role, account);\n _addMember(role, account);\n }\n\n /// @dev adds `account` to {roleMembers}, for `role`\n function _addMember(bytes32 role, address account) internal {\n uint256 idx = roleMembers[role].index;\n roleMembers[role].index += 1;\n\n roleMembers[role].members[idx] = account;\n roleMembers[role].indexOf[account] = idx;\n }\n\n /// @dev removes `account` from {roleMembers}, for `role`\n function _removeMember(bytes32 role, address account) internal {\n uint256 idx = roleMembers[role].indexOf[account];\n\n delete roleMembers[role].members[idx];\n delete roleMembers[role].indexOf[account];\n }\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IPermissionsEnumerable.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./IPermissions.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IPermissionsEnumerable is IPermissions {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * [forum post](https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296)\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IPermissions.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IPermissions {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n"
},
"@thirdweb-dev/contracts/extension/Permissions.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./interface/IPermissions.sol\";\nimport \"../lib/TWStrings.sol\";\n\n/**\n * @title Permissions\n * @dev This contracts provides extending-contracts with role-based access control mechanisms\n */\ncontract Permissions is IPermissions {\n /// @dev Map from keccak256 hash of a role => a map from address => whether address has role.\n mapping(bytes32 => mapping(address => bool)) private _hasRole;\n\n /// @dev Map from keccak256 hash of a role to role admin. See {getRoleAdmin}.\n mapping(bytes32 => bytes32) private _getRoleAdmin;\n\n /// @dev Default admin role for all roles. Only accounts with this role can grant/revoke other roles.\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /// @dev Modifier that checks if an account has the specified role; reverts otherwise.\n modifier onlyRole(bytes32 role) {\n _checkRole(role, msg.sender);\n _;\n }\n\n /**\n * @notice Checks whether an account has a particular role.\n * @dev Returns `true` if `account` has been granted `role`.\n *\n * @param role keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n * @param account Address of the account for which the role is being checked.\n */\n function hasRole(bytes32 role, address account) public view override returns (bool) {\n return _hasRole[role][account];\n }\n\n /**\n * @notice Checks whether an account has a particular role;\n * role restrictions can be swtiched on and off.\n *\n * @dev Returns `true` if `account` has been granted `role`.\n * Role restrictions can be swtiched on and off:\n * - If address(0) has ROLE, then the ROLE restrictions\n * don't apply.\n * - If address(0) does not have ROLE, then the ROLE\n * restrictions will apply.\n *\n * @param role keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n * @param account Address of the account for which the role is being checked.\n */\n function hasRoleWithSwitch(bytes32 role, address account) public view returns (bool) {\n if (!_hasRole[role][address(0)]) {\n return _hasRole[role][account];\n }\n\n return true;\n }\n\n /**\n * @notice Returns the admin role that controls the specified role.\n * @dev See {grantRole} and {revokeRole}.\n * To change a role's admin, use {_setRoleAdmin}.\n *\n * @param role keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n */\n function getRoleAdmin(bytes32 role) external view override returns (bytes32) {\n return _getRoleAdmin[role];\n }\n\n /**\n * @notice Grants a role to an account, if not previously granted.\n * @dev Caller must have admin role for the `role`.\n * Emits {RoleGranted Event}.\n *\n * @param role keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n * @param account Address of the account to which the role is being granted.\n */\n function grantRole(bytes32 role, address account) public virtual override {\n _checkRole(_getRoleAdmin[role], msg.sender);\n if (_hasRole[role][account]) {\n revert(\"Can only grant to non holders\");\n }\n _setupRole(role, account);\n }\n\n /**\n * @notice Revokes role from an account.\n * @dev Caller must have admin role for the `role`.\n * Emits {RoleRevoked Event}.\n *\n * @param role keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n * @param account Address of the account from which the role is being revoked.\n */\n function revokeRole(bytes32 role, address account) public virtual override {\n _checkRole(_getRoleAdmin[role], msg.sender);\n _revokeRole(role, account);\n }\n\n /**\n * @notice Revokes role from the account.\n * @dev Caller must have the `role`, with caller being the same as `account`.\n * Emits {RoleRevoked Event}.\n *\n * @param role keccak256 hash of the role. e.g. keccak256(\"TRANSFER_ROLE\")\n * @param account Address of the account from which the role is being revoked.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n if (msg.sender != account) {\n revert(\"Can only renounce for self\");\n }\n _revokeRole(role, account);\n }\n\n /// @dev Sets `adminRole` as `role`'s admin role.\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = _getRoleAdmin[role];\n _getRoleAdmin[role] = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /// @dev Sets up `role` for `account`\n function _setupRole(bytes32 role, address account) internal virtual {\n _hasRole[role][account] = true;\n emit RoleGranted(role, account, msg.sender);\n }\n\n /// @dev Revokes `role` from `account`\n function _revokeRole(bytes32 role, address account) internal virtual {\n _checkRole(role, account);\n delete _hasRole[role][account];\n emit RoleRevoked(role, account, msg.sender);\n }\n\n /// @dev Checks `role` for `account`. Reverts with a message including the required role.\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!_hasRole[role][account]) {\n revert(\n string(\n abi.encodePacked(\n \"Permissions: account \",\n TWStrings.toHexString(uint160(account), 20),\n \" is missing role \",\n TWStrings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /// @dev Checks `role` for `account`. Reverts with a message including the required role.\n function _checkRoleWithSwitch(bytes32 role, address account) internal view virtual {\n if (!hasRoleWithSwitch(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"Permissions: account \",\n TWStrings.toHexString(uint160(account), 20),\n \" is missing role \",\n TWStrings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n}\n"
},
"@thirdweb-dev/contracts/extension/DropSinglePhase.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./interface/IDropSinglePhase.sol\";\nimport \"../lib/MerkleProof.sol\";\nimport \"../lib/TWBitMaps.sol\";\n\nabstract contract DropSinglePhase is IDropSinglePhase {\n using TWBitMaps for TWBitMaps.BitMap;\n\n /*///////////////////////////////////////////////////////////////\n State variables\n //////////////////////////////////////////////////////////////*/\n\n /// @dev The active conditions for claiming tokens.\n ClaimCondition public claimCondition;\n\n /// @dev The ID for the active claim condition.\n bytes32 private conditionId;\n\n /*///////////////////////////////////////////////////////////////\n Mappings\n //////////////////////////////////////////////////////////////*/\n\n /**\n * @dev Map from an account and uid for a claim condition, to the last timestamp\n * at which the account claimed tokens under that claim condition.\n */\n mapping(bytes32 => mapping(address => uint256)) private lastClaimTimestamp;\n\n /**\n * @dev Map from a claim condition uid to whether an address in an allowlist\n * has already claimed tokens i.e. used their place in the allowlist.\n */\n mapping(bytes32 => TWBitMaps.BitMap) private usedAllowlistSpot;\n\n /*///////////////////////////////////////////////////////////////\n Drop logic\n //////////////////////////////////////////////////////////////*/\n\n /// @dev Lets an account claim tokens.\n function claim(\n address _receiver,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n AllowlistProof calldata _allowlistProof,\n bytes memory _data\n ) public payable virtual override {\n _beforeClaim(_receiver, _quantity, _currency, _pricePerToken, _allowlistProof, _data);\n\n bytes32 activeConditionId = conditionId;\n\n /**\n * 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 */\n\n // Verify inclusion in allowlist.\n (bool validMerkleProof, ) = verifyClaimMerkleProof(_dropMsgSender(), _quantity, _allowlistProof);\n\n // Verify claim validity. If not valid, revert.\n // when there's allowlist present --> verifyClaimMerkleProof will verify the maxQuantityInAllowlist value with hashed leaf in the allowlist\n // when there's no allowlist, this check is true --> verifyClaim will check for _quantity being equal/less than the limit\n bool toVerifyMaxQuantityPerTransaction = _allowlistProof.maxQuantityInAllowlist == 0 ||\n claimCondition.merkleRoot == bytes32(0);\n\n verifyClaim(_dropMsgSender(), _quantity, _currency, _pricePerToken, toVerifyMaxQuantityPerTransaction);\n\n if (validMerkleProof && _allowlistProof.maxQuantityInAllowlist > 0) {\n /**\n * Mark the claimer's use of their position in the allowlist. A spot in an allowlist\n * can be used only once.\n */\n usedAllowlistSpot[activeConditionId].set(uint256(uint160(_dropMsgSender())));\n }\n\n // Update contract state.\n claimCondition.supplyClaimed += _quantity;\n lastClaimTimestamp[activeConditionId][_dropMsgSender()] = block.timestamp;\n\n // If there's a price, collect price.\n _collectPriceOnClaim(address(0), _quantity, _currency, _pricePerToken);\n\n // Mint the relevant NFTs to claimer.\n uint256 startTokenId = _transferTokensOnClaim(_receiver, _quantity);\n\n emit TokensClaimed(_dropMsgSender(), _receiver, startTokenId, _quantity);\n\n _afterClaim(_receiver, _quantity, _currency, _pricePerToken, _allowlistProof, _data);\n }\n\n /// @dev Lets a contract admin set claim conditions.\n function setClaimConditions(ClaimCondition calldata _condition, bool _resetClaimEligibility) external override {\n if (!_canSetClaimConditions()) {\n revert(\"Not authorized\");\n }\n\n bytes32 targetConditionId = conditionId;\n uint256 supplyClaimedAlready = claimCondition.supplyClaimed;\n\n if (_resetClaimEligibility) {\n supplyClaimedAlready = 0;\n targetConditionId = keccak256(abi.encodePacked(_dropMsgSender(), block.number));\n }\n\n if (supplyClaimedAlready > _condition.maxClaimableSupply) {\n revert(\"max supply claimed\");\n }\n\n claimCondition = ClaimCondition({\n startTimestamp: _condition.startTimestamp,\n maxClaimableSupply: _condition.maxClaimableSupply,\n supplyClaimed: supplyClaimedAlready,\n quantityLimitPerTransaction: _condition.quantityLimitPerTransaction,\n waitTimeInSecondsBetweenClaims: _condition.waitTimeInSecondsBetweenClaims,\n merkleRoot: _condition.merkleRoot,\n pricePerToken: _condition.pricePerToken,\n currency: _condition.currency\n });\n conditionId = targetConditionId;\n\n emit ClaimConditionUpdated(_condition, _resetClaimEligibility);\n }\n\n /// @dev Checks a request to claim NFTs against the active claim condition's criteria.\n function verifyClaim(\n address _claimer,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bool verifyMaxQuantityPerTransaction\n ) public view {\n ClaimCondition memory currentClaimPhase = claimCondition;\n\n if (_currency != currentClaimPhase.currency || _pricePerToken != currentClaimPhase.pricePerToken) {\n revert(\"Invalid price or currency\");\n }\n\n // If we're checking for an allowlist quantity restriction, ignore the general quantity restriction.\n if (\n _quantity == 0 ||\n (verifyMaxQuantityPerTransaction && _quantity > currentClaimPhase.quantityLimitPerTransaction)\n ) {\n revert(\"Invalid quantity\");\n }\n\n if (currentClaimPhase.supplyClaimed + _quantity > currentClaimPhase.maxClaimableSupply) {\n revert(\"exceeds max supply\");\n }\n\n (uint256 lastClaimedAt, uint256 nextValidClaimTimestamp) = getClaimTimestamp(_claimer);\n if (\n currentClaimPhase.startTimestamp > block.timestamp ||\n (lastClaimedAt != 0 && block.timestamp < nextValidClaimTimestamp)\n ) {\n revert(\"cant claim yet\");\n }\n }\n\n /// @dev Checks whether a claimer meets the claim condition's allowlist criteria.\n function verifyClaimMerkleProof(\n address _claimer,\n uint256 _quantity,\n AllowlistProof calldata _allowlistProof\n ) public view returns (bool validMerkleProof, uint256 merkleProofIndex) {\n ClaimCondition memory currentClaimPhase = claimCondition;\n\n if (currentClaimPhase.merkleRoot != bytes32(0)) {\n (validMerkleProof, merkleProofIndex) = MerkleProof.verify(\n _allowlistProof.proof,\n currentClaimPhase.merkleRoot,\n keccak256(abi.encodePacked(_claimer, _allowlistProof.maxQuantityInAllowlist))\n );\n if (!validMerkleProof) {\n revert(\"not in allowlist\");\n }\n\n if (usedAllowlistSpot[conditionId].get(uint256(uint160(_claimer)))) {\n revert(\"proof claimed\");\n }\n\n if (_allowlistProof.maxQuantityInAllowlist != 0 && _quantity > _allowlistProof.maxQuantityInAllowlist) {\n revert(\"Invalid qty proof\");\n }\n }\n }\n\n /// @dev Returns the timestamp for when a claimer is eligible for claiming NFTs again.\n function getClaimTimestamp(address _claimer)\n public\n view\n returns (uint256 lastClaimedAt, uint256 nextValidClaimTimestamp)\n {\n lastClaimedAt = lastClaimTimestamp[conditionId][_claimer];\n\n unchecked {\n nextValidClaimTimestamp = lastClaimedAt + claimCondition.waitTimeInSecondsBetweenClaims;\n\n if (nextValidClaimTimestamp < lastClaimedAt) {\n nextValidClaimTimestamp = type(uint256).max;\n }\n }\n }\n\n /*////////////////////////////////////////////////////////////////////\n Optional hooks that can be implemented in the derived contract\n ///////////////////////////////////////////////////////////////////*/\n\n /// @dev Exposes the ability to override the msg sender.\n function _dropMsgSender() internal virtual returns (address) {\n return msg.sender;\n }\n\n /// @dev Runs before every `claim` function call.\n function _beforeClaim(\n address _receiver,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n AllowlistProof calldata _allowlistProof,\n bytes memory _data\n ) internal virtual {}\n\n /// @dev Runs after every `claim` function call.\n function _afterClaim(\n address _receiver,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n AllowlistProof calldata _allowlistProof,\n bytes memory _data\n ) internal virtual {}\n\n /// @dev Collects and distributes the primary sale value of NFTs being claimed.\n function _collectPriceOnClaim(\n address _primarySaleRecipient,\n uint256 _quantityToClaim,\n address _currency,\n uint256 _pricePerToken\n ) internal virtual;\n\n /// @dev Transfers the NFTs being claimed.\n function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed)\n internal\n virtual\n returns (uint256 startTokenId);\n\n function _canSetClaimConditions() internal view virtual returns (bool);\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IDropSinglePhase.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./IClaimCondition.sol\";\n\ninterface IDropSinglePhase is IClaimCondition {\n struct AllowlistProof {\n bytes32[] proof;\n uint256 maxQuantityInAllowlist;\n }\n\n /// @dev Emitted when tokens are claimed via `claim`.\n event TokensClaimed(\n address indexed claimer,\n address indexed receiver,\n uint256 indexed startTokenId,\n uint256 quantityClaimed\n );\n\n /// @dev Emitted when the contract's claim conditions are updated.\n event ClaimConditionUpdated(ClaimCondition condition, bool resetEligibility);\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 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 allowlistProof The proof of the claimer's inclusion in the merkle root allowlist\n * of the claim conditions that apply.\n * @param data Arbitrary bytes data that can be leveraged in the implementation of this interface.\n */\n function claim(\n address receiver,\n uint256 quantity,\n address currency,\n uint256 pricePerToken,\n AllowlistProof calldata allowlistProof,\n bytes memory data\n ) external payable;\n\n /**\n * @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.\n *\n * @param phase Claim condition to set.\n *\n * @param resetClaimEligibility Whether to reset `limitLastClaimTimestamp` and `limitMerkleProofClaim` values when setting new\n * claim conditions.\n */\n function setClaimConditions(ClaimCondition calldata phase, bool resetClaimEligibility) external;\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IClaimCondition.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"../../lib/TWBitMaps.sol\";\n\n/**\n * Thirdweb'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 IClaimCondition {\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"
},
"@thirdweb-dev/contracts/lib/TWBitMaps.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 * Largely inspired by Uniswap's [merkle-distributor](https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol).\n */\nlibrary TWBitMaps {\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"
},
"@thirdweb-dev/contracts/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.0;\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"
},
"@thirdweb-dev/contracts/extension/LazyMint.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./interface/ILazyMint.sol\";\nimport \"./BatchMintMetadata.sol\";\n\n/**\n * The `LazyMint` is a contract extension for any base NFT contract. It lets you 'lazy mint' any number of NFTs\n * at once. Here, 'lazy mint' means defining the metadata for particular tokenIds of your NFT contract, without actually\n * minting a non-zero balance of NFTs of those tokenIds.\n */\n\nabstract contract LazyMint is ILazyMint, BatchMintMetadata {\n /// @notice The tokenId assigned to the next new NFT to be lazy minted.\n uint256 internal nextTokenIdToLazyMint;\n\n /**\n * @notice Lets an authorized address lazy mint a given amount of NFTs.\n *\n * @param _amount The number of NFTs to lazy mint.\n * @param _baseURIForTokens The base URI for the 'n' number of NFTs being lazy minted, where the metadata for each\n * of those NFTs is `${baseURIForTokens}/${tokenId}`.\n * @param _data Additional bytes data to be used at the discretion of the consumer of the contract.\n * @return batchId A unique integer identifier for the batch of NFTs lazy minted together.\n */\n function lazyMint(\n uint256 _amount,\n string calldata _baseURIForTokens,\n bytes calldata _data\n ) public virtual override returns (uint256 batchId) {\n if (!_canLazyMint()) {\n revert(\"Not authorized\");\n }\n\n if (_amount == 0) {\n revert(\"Minting 0 tokens\");\n }\n\n uint256 startId = nextTokenIdToLazyMint;\n\n (nextTokenIdToLazyMint, batchId) = _batchMintMetadata(startId, _amount, _baseURIForTokens);\n\n emit TokensLazyMinted(startId, startId + _amount - 1, _baseURIForTokens, _data);\n\n return batchId;\n }\n\n /// @dev Returns whether lazy minting can be performed in the given execution context.\n function _canLazyMint() internal view virtual returns (bool);\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/ILazyMint.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * Thirdweb's `LazyMint` is a contract extension for any base NFT contract. It lets you 'lazy mint' any number of NFTs\n * at once. Here, 'lazy mint' means defining the metadata for particular tokenIds of your NFT contract, without actually\n * minting a non-zero balance of NFTs of those tokenIds.\n */\n\ninterface ILazyMint {\n /// @dev Emitted when tokens are lazy minted.\n event TokensLazyMinted(uint256 indexed startTokenId, uint256 endTokenId, string baseURI, bytes encryptedBaseURI);\n\n /**\n * @notice Lazy mints a given amount of NFTs.\n *\n * @param amount The number of NFTs to lazy mint.\n *\n * @param baseURIForTokens The base URI for the 'n' number of NFTs being lazy minted, where the metadata for each\n * of those NFTs is `${baseURIForTokens}/${tokenId}`.\n *\n * @param extraData Additional bytes data to be used at the discretion of the consumer of the contract.\n *\n * @return batchId A unique integer identifier for the batch of NFTs lazy minted together.\n */\n function lazyMint(\n uint256 amount,\n string calldata baseURIForTokens,\n bytes calldata extraData\n ) external returns (uint256 batchId);\n}\n"
},
"@thirdweb-dev/contracts/extension/DelayedReveal.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./interface/IDelayedReveal.sol\";\n\n/**\n * @title Delayed Reveal\n * @notice Thirdweb's `DelayedReveal` is a contract extension for base NFT contracts. It lets you create batches of\n * 'delayed-reveal' NFTs. You can learn more about the usage of delayed reveal NFTs here - https://blog.thirdweb.com/delayed-reveal-nfts\n */\n\nabstract contract DelayedReveal is IDelayedReveal {\n /// @dev Mapping from tokenId of a batch of tokens => to delayed reveal data.\n mapping(uint256 => bytes) public encryptedData;\n\n /// @dev Sets the delayed reveal data for a batchId.\n function _setEncryptedData(uint256 _batchId, bytes memory _encryptedData) internal {\n encryptedData[_batchId] = _encryptedData;\n }\n\n /**\n * @notice Returns revealed URI for a batch of NFTs.\n * @dev Reveal encrypted base URI for `_batchId` with caller/admin's `_key` used for encryption.\n * Reverts if there's no encrypted URI for `_batchId`.\n * See {encryptDecrypt}.\n *\n * @param _batchId ID of the batch for which URI is being revealed.\n * @param _key Secure key used by caller/admin for encryption of baseURI.\n *\n * @return revealedURI Decrypted base URI.\n */\n function getRevealURI(uint256 _batchId, bytes calldata _key) public view returns (string memory revealedURI) {\n bytes memory data = encryptedData[_batchId];\n if (data.length == 0) {\n revert(\"Nothing to reveal\");\n }\n\n (bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(data, (bytes, bytes32));\n\n revealedURI = string(encryptDecrypt(encryptedURI, _key));\n\n require(keccak256(abi.encodePacked(revealedURI, _key, block.chainid)) == provenanceHash, \"Incorrect key\");\n }\n\n /**\n * @notice Encrypt/decrypt data on chain.\n * @dev Encrypt/decrypt given `data` with `key`. Uses inline assembly.\n * See: https://ethereum.stackexchange.com/questions/69825/decrypt-message-on-chain\n *\n * @param data Bytes of data to encrypt/decrypt.\n * @param key Secure key used by caller for encryption/decryption.\n *\n * @return result Output after encryption/decryption of given data.\n */\n function encryptDecrypt(bytes memory data, bytes calldata key) public pure override returns (bytes memory result) {\n // Store data length on stack for later use\n uint256 length = data.length;\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Set result to free memory pointer\n result := mload(0x40)\n // Increase free memory pointer by lenght + 32\n mstore(0x40, add(add(result, length), 32))\n // Set result length\n mstore(result, length)\n }\n\n // Iterate over the data stepping by 32 bytes\n for (uint256 i = 0; i < length; i += 32) {\n // Generate hash of the key and offset\n bytes32 hash = keccak256(abi.encodePacked(key, i));\n\n bytes32 chunk;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Read 32-bytes data chunk\n chunk := mload(add(data, add(i, 32)))\n }\n // XOR the chunk with hash\n chunk ^= hash;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Write 32-byte encrypted chunk\n mstore(add(result, add(i, 32)), chunk)\n }\n }\n }\n\n /**\n * @notice Returns whether the relvant batch of NFTs is subject to a delayed reveal.\n * @dev Returns `true` if `_batchId`'s base URI is encrypted.\n * @param _batchId ID of a batch of NFTs.\n */\n function isEncryptedBatch(uint256 _batchId) public view returns (bool) {\n return encryptedData[_batchId].length > 0;\n }\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IDelayedReveal.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * Thirdweb's `DelayedReveal` is a contract extension for base NFT contracts. It lets you create batches of\n * 'delayed-reveal' NFTs. You can learn more about the usage of delayed reveal NFTs here - https://blog.thirdweb.com/delayed-reveal-nfts\n */\n\ninterface IDelayedReveal {\n /// @dev Emitted when tokens are revealed.\n event TokenURIRevealed(uint256 indexed index, string revealedURI);\n\n /**\n * @notice Reveals a batch of delayed reveal NFTs.\n *\n * @param identifier The ID for the batch of delayed-reveal NFTs to reveal.\n *\n * @param key The key with which the base URI for the relevant batch of NFTs was encrypted.\n */\n function reveal(uint256 identifier, bytes calldata key) external returns (string memory revealedURI);\n\n /**\n * @notice Performs XOR encryption/decryption.\n *\n * @param data The data to encrypt. In the case of delayed-reveal NFTs, this is the \"revealed\" state\n * base URI of the relevant batch of NFTs.\n *\n * @param key The key with which to encrypt data\n */\n function encryptDecrypt(bytes memory data, bytes calldata key) external pure returns (bytes memory result);\n}\n"
},
"@thirdweb-dev/contracts/lib/CurrencyTransferLib.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n// Helper interfaces\nimport { IWETH } from \"../interfaces/IWETH.sol\";\n\nimport \"../openzeppelin-presets/token/ERC20/utils/SafeERC20.sol\";\n\nlibrary CurrencyTransferLib {\n using SafeERC20 for IERC20;\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 IERC20(_currency).safeTransfer(_to, _amount);\n } else {\n IERC20(_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 IERC20(_nativeTokenWrapper).safeTransfer(to, value);\n }\n }\n}\n"
},
"@thirdweb-dev/contracts/interfaces/IWETH.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\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"
},
"@thirdweb-dev/contracts/openzeppelin-presets/token/ERC20/utils/SafeERC20.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 \"../../../../eip/interface/IERC20.sol\";\nimport \"../../../../lib/TWAddress.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 SafeERC20 {\n using TWAddress for address;\n\n function safeTransfer(\n IERC20 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 IERC20 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 IERC20 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 IERC20 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 IERC20 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(IERC20 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"
},
"@thirdweb-dev/contracts/eip/interface/IERC20.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * @title ERC20 interface\n * @dev see https://github.com/ethereum/EIPs/issues/20\n */\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address who) external view returns (uint256);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"
},
"@thirdweb-dev/contracts/drop/DropERC721.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.11;\n\n// ========== External imports ==========\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\n\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\n\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/structs/BitMapsUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\";\n\n// ========== Internal imports ==========\n\nimport { IDropERC721 } from \"../interfaces/drop/IDropERC721.sol\";\nimport \"../interfaces/IThirdwebContract.sol\";\n\n// ========== Features ==========\n\nimport \"../extension/interface/IPlatformFee.sol\";\nimport \"../extension/interface/IPrimarySale.sol\";\nimport \"../extension/interface/IRoyalty.sol\";\nimport \"../extension/interface/IOwnable.sol\";\n\nimport \"../openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol\";\n\nimport \"../lib/CurrencyTransferLib.sol\";\nimport \"../lib/FeeType.sol\";\nimport \"../lib/MerkleProof.sol\";\n\ncontract DropERC721 is\n Initializable,\n IThirdwebContract,\n IOwnable,\n IRoyalty,\n IPrimarySale,\n IPlatformFee,\n ReentrancyGuardUpgradeable,\n ERC2771ContextUpgradeable,\n MulticallUpgradeable,\n AccessControlEnumerableUpgradeable,\n ERC721EnumerableUpgradeable,\n IDropERC721\n{\n using BitMapsUpgradeable for BitMapsUpgradeable.BitMap;\n using StringsUpgradeable for uint256;\n\n /*///////////////////////////////////////////////////////////////\n State variables\n //////////////////////////////////////////////////////////////*/\n\n bytes32 private constant MODULE_TYPE = bytes32(\"DropERC721\");\n uint256 private constant VERSION = 3;\n\n /// @dev Only transfers to or from TRANSFER_ROLE holders are valid, when transfers are restricted.\n bytes32 private constant TRANSFER_ROLE = keccak256(\"TRANSFER_ROLE\");\n /// @dev Only MINTER_ROLE holders can lazy mint NFTs.\n bytes32 private constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n /// @dev Max bps in the thirdweb system.\n uint256 private constant MAX_BPS = 10_000;\n\n /// @dev Owner of the contract (purpose: OpenSea compatibility)\n address private _owner;\n\n /// @dev The next token ID of the NFT to \"lazy mint\".\n uint256 public nextTokenIdToMint;\n\n /// @dev The next token ID of the NFT that can be claimed.\n uint256 public nextTokenIdToClaim;\n\n /// @dev The address that receives all primary sales value.\n address public primarySaleRecipient;\n\n /// @dev The max number of NFTs a wallet can claim.\n uint256 public maxWalletClaimCount;\n\n /// @dev Global max total supply of NFTs.\n uint256 public maxTotalSupply;\n\n /// @dev The address that receives all platform fees from all sales.\n address private platformFeeRecipient;\n\n /// @dev The % of primary sales collected as platform fees.\n uint16 private platformFeeBps;\n\n /// @dev The (default) address that receives all royalty value.\n address private royaltyRecipient;\n\n /// @dev The (default) % of a sale to take as royalty (in basis points).\n uint16 private royaltyBps;\n\n /// @dev Contract level metadata.\n string public contractURI;\n\n /// @dev Largest tokenId of each batch of tokens with the same baseURI\n uint256[] public baseURIIndices;\n\n /// @dev The set of all claim conditions, at any given moment.\n ClaimConditionList public claimCondition;\n\n /*///////////////////////////////////////////////////////////////\n Mappings\n //////////////////////////////////////////////////////////////*/\n\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 **/\n mapping(uint256 => string) private baseURI;\n\n /**\n * @dev Mapping from 'Largest tokenId of a batch of 'delayed-reveal' tokens with\n * the same baseURI' to encrypted base URI for the respective batch of tokens.\n **/\n mapping(uint256 => bytes) public encryptedData;\n\n /// @dev Mapping from address => total number of NFTs a wallet has claimed.\n mapping(address => uint256) public walletClaimCount;\n\n /// @dev Token ID => royalty recipient and bps for token\n mapping(uint256 => RoyaltyInfo) private royaltyInfoForToken;\n\n /*///////////////////////////////////////////////////////////////\n Constructor + initializer logic\n //////////////////////////////////////////////////////////////*/\n\n constructor() initializer {}\n\n /// @dev Initiliazes the contract, like a constructor.\n function initialize(\n address _defaultAdmin,\n string memory _name,\n string memory _symbol,\n string memory _contractURI,\n address[] memory _trustedForwarders,\n address _saleRecipient,\n address _royaltyRecipient,\n uint128 _royaltyBps,\n uint128 _platformFeeBps,\n address _platformFeeRecipient\n ) external initializer {\n // Initialize inherited contracts, most base-like -> most derived.\n __ReentrancyGuard_init();\n __ERC2771Context_init(_trustedForwarders);\n __ERC721_init(_name, _symbol);\n\n // Initialize this contract's state.\n royaltyRecipient = _royaltyRecipient;\n royaltyBps = uint16(_royaltyBps);\n platformFeeRecipient = _platformFeeRecipient;\n platformFeeBps = uint16(_platformFeeBps);\n primarySaleRecipient = _saleRecipient;\n contractURI = _contractURI;\n _owner = _defaultAdmin;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);\n _setupRole(MINTER_ROLE, _defaultAdmin);\n _setupRole(TRANSFER_ROLE, _defaultAdmin);\n _setupRole(TRANSFER_ROLE, address(0));\n }\n\n /*///////////////////////////////////////////////////////////////\n Generic contract logic\n //////////////////////////////////////////////////////////////*/\n\n /// @dev Returns the type of the contract.\n function contractType() external pure returns (bytes32) {\n return MODULE_TYPE;\n }\n\n /// @dev Returns the version of the contract.\n function contractVersion() external pure returns (uint8) {\n return uint8(VERSION);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view returns (address) {\n return hasRole(DEFAULT_ADMIN_ROLE, _owner) ? _owner : address(0);\n }\n\n /*///////////////////////////////////////////////////////////////\n ERC 165 / 721 / 2981 logic\n //////////////////////////////////////////////////////////////*/\n\n /// @dev Returns the URI for a given tokenId.\n function tokenURI(uint256 _tokenId) public view override returns (string memory) {\n for (uint256 i = 0; i < baseURIIndices.length; i += 1) {\n if (_tokenId < baseURIIndices[i]) {\n if (encryptedData[baseURIIndices[i]].length != 0) {\n return string(abi.encodePacked(baseURI[baseURIIndices[i]], \"0\"));\n } else {\n return string(abi.encodePacked(baseURI[baseURIIndices[i]], _tokenId.toString()));\n }\n }\n }\n\n return \"\";\n }\n\n /// @dev See ERC 165\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC721EnumerableUpgradeable, AccessControlEnumerableUpgradeable, IERC165Upgradeable, IERC165)\n returns (bool)\n {\n return super.supportsInterface(interfaceId) || type(IERC2981Upgradeable).interfaceId == interfaceId;\n }\n\n /// @dev 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 returns (address receiver, uint256 royaltyAmount)\n {\n (address recipient, uint256 bps) = getRoyaltyInfoForToken(tokenId);\n receiver = recipient;\n royaltyAmount = (salePrice * bps) / MAX_BPS;\n }\n\n /*///////////////////////////////////////////////////////////////\n Minting + delayed-reveal logic\n //////////////////////////////////////////////////////////////*/\n\n /**\n * @dev Lets an account with `MINTER_ROLE` lazy mint 'n' NFTs.\n * The URIs for each token is the provided `_baseURIForTokens` + `{tokenId}`.\n */\n function lazyMint(\n uint256 _amount,\n string calldata _baseURIForTokens,\n bytes calldata _data\n ) external onlyRole(MINTER_ROLE) {\n uint256 startId = nextTokenIdToMint;\n uint256 baseURIIndex = startId + _amount;\n\n nextTokenIdToMint = baseURIIndex;\n baseURI[baseURIIndex] = _baseURIForTokens;\n baseURIIndices.push(baseURIIndex);\n\n if (_data.length > 0) {\n (bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(_data, (bytes, bytes32));\n\n if (encryptedURI.length != 0 && provenanceHash != \"\") {\n encryptedData[baseURIIndex] = _data;\n }\n }\n\n emit TokensLazyMinted(startId, startId + _amount - 1, _baseURIForTokens, _data);\n }\n\n /// @dev Lets an account with `MINTER_ROLE` reveal the URI for a batch of 'delayed-reveal' NFTs.\n function reveal(uint256 index, bytes calldata _key)\n external\n onlyRole(MINTER_ROLE)\n returns (string memory revealedURI)\n {\n require(index < baseURIIndices.length, \"invalid index.\");\n\n uint256 _index = baseURIIndices[index];\n bytes memory data = encryptedData[_index];\n (bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(data, (bytes, bytes32));\n\n require(encryptedURI.length != 0, \"nothing to reveal.\");\n\n revealedURI = string(encryptDecrypt(encryptedURI, _key));\n\n require(keccak256(abi.encodePacked(revealedURI, _key, block.chainid)) == provenanceHash, \"Incorrect key\");\n\n baseURI[_index] = revealedURI;\n delete encryptedData[_index];\n\n emit NFTRevealed(_index, revealedURI);\n\n return revealedURI;\n }\n\n /// @dev See: https://ethereum.stackexchange.com/questions/69825/decrypt-message-on-chain\n function encryptDecrypt(bytes memory data, bytes calldata key) public pure returns (bytes memory result) {\n // Store data length on stack for later use\n uint256 length = data.length;\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Set result to free memory pointer\n result := mload(0x40)\n // Increase free memory pointer by lenght + 32\n mstore(0x40, add(add(result, length), 32))\n // Set result length\n mstore(result, length)\n }\n\n // Iterate over the data stepping by 32 bytes\n for (uint256 i = 0; i < length; i += 32) {\n // Generate hash of the key and offset\n bytes32 hash = keccak256(abi.encodePacked(key, i));\n\n bytes32 chunk;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Read 32-bytes data chunk\n chunk := mload(add(data, add(i, 32)))\n }\n // XOR the chunk with hash\n chunk ^= hash;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Write 32-byte encrypted chunk\n mstore(add(result, add(i, 32)), chunk)\n }\n }\n }\n\n /*///////////////////////////////////////////////////////////////\n Claim logic\n //////////////////////////////////////////////////////////////*/\n\n /// @dev Lets an account claim NFTs.\n function claim(\n address _receiver,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bytes32[] calldata _proofs,\n uint256 _proofMaxQuantityPerTransaction\n ) external payable nonReentrant {\n require(isTrustedForwarder(msg.sender) || _msgSender() == tx.origin, \"BOT\");\n\n uint256 tokenIdToClaim = nextTokenIdToClaim;\n\n // Get the claim conditions.\n uint256 activeConditionId = getActiveClaimConditionId();\n\n /**\n * 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 */\n\n // Verify inclusion in allowlist.\n (bool validMerkleProof, ) = verifyClaimMerkleProof(\n activeConditionId,\n _msgSender(),\n _quantity,\n _proofs,\n _proofMaxQuantityPerTransaction\n );\n\n // Verify claim validity. If not valid, revert.\n // when there's allowlist present --> verifyClaimMerkleProof will verify the _proofMaxQuantityPerTransaction value with hashed leaf in the allowlist\n // when there's no allowlist, this check is true --> verifyClaim will check for _quantity being less/equal than the limit\n bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 ||\n claimCondition.phases[activeConditionId].merkleRoot == bytes32(0);\n verifyClaim(\n activeConditionId,\n _msgSender(),\n _quantity,\n _currency,\n _pricePerToken,\n toVerifyMaxQuantityPerTransaction\n );\n\n if (validMerkleProof && _proofMaxQuantityPerTransaction > 0) {\n /**\n * Mark the claimer's use of their position in the allowlist. A spot in an allowlist\n * can be used only once.\n */\n claimCondition.limitMerkleProofClaim[activeConditionId].set(uint256(uint160(_msgSender())));\n }\n\n // If there's a price, collect price.\n collectClaimPrice(_quantity, _currency, _pricePerToken);\n\n // Mint the relevant NFTs to claimer.\n transferClaimedTokens(_receiver, activeConditionId, _quantity);\n\n emit TokensClaimed(activeConditionId, _msgSender(), _receiver, tokenIdToClaim, _quantity);\n }\n\n /// @dev Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.\n function setClaimConditions(ClaimCondition[] calldata _phases, bool _resetClaimEligibility)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n uint256 existingStartIndex = claimCondition.currentStartId;\n uint256 existingPhaseCount = claimCondition.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 claimCondition.count = _phases.length;\n claimCondition.currentStartId = newStartIndex;\n\n uint256 lastConditionStartTimestamp;\n for (uint256 i = 0; i < _phases.length; i++) {\n require(i == 0 || lastConditionStartTimestamp < _phases[i].startTimestamp, \"ST\");\n\n uint256 supplyClaimedAlready = claimCondition.phases[newStartIndex + i].supplyClaimed;\n require(supplyClaimedAlready <= _phases[i].maxClaimableSupply, \"max supply claimed already\");\n\n claimCondition.phases[newStartIndex + i] = _phases[i];\n claimCondition.phases[newStartIndex + i].supplyClaimed = supplyClaimedAlready;\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 claimCondition.phases[i];\n delete claimCondition.limitMerkleProofClaim[i];\n }\n } else {\n if (existingPhaseCount > _phases.length) {\n for (uint256 i = _phases.length; i < existingPhaseCount; i++) {\n delete claimCondition.phases[newStartIndex + i];\n delete claimCondition.limitMerkleProofClaim[newStartIndex + i];\n }\n }\n }\n\n emit ClaimConditionsUpdated(_phases);\n }\n\n /// @dev Collects and distributes the primary sale value of NFTs being claimed.\n function collectClaimPrice(\n uint256 _quantityToClaim,\n address _currency,\n uint256 _pricePerToken\n ) internal {\n if (_pricePerToken == 0) {\n return;\n }\n\n uint256 totalPrice = _quantityToClaim * _pricePerToken;\n uint256 platformFees = (totalPrice * platformFeeBps) / MAX_BPS;\n\n if (_currency == CurrencyTransferLib.NATIVE_TOKEN) {\n require(msg.value == totalPrice, \"must send total price.\");\n }\n\n CurrencyTransferLib.transferCurrency(_currency, _msgSender(), platformFeeRecipient, platformFees);\n CurrencyTransferLib.transferCurrency(_currency, _msgSender(), primarySaleRecipient, totalPrice - platformFees);\n }\n\n /// @dev Transfers the NFTs being claimed.\n function transferClaimedTokens(\n address _to,\n uint256 _conditionId,\n uint256 _quantityBeingClaimed\n ) internal {\n // Update the supply minted under mint condition.\n claimCondition.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 claimCondition.limitLastClaimTimestamp[_conditionId][_msgSender()] = block.timestamp;\n walletClaimCount[_msgSender()] += _quantityBeingClaimed;\n\n uint256 tokenIdToClaim = nextTokenIdToClaim;\n\n for (uint256 i = 0; i < _quantityBeingClaimed; i += 1) {\n _mint(_to, tokenIdToClaim);\n tokenIdToClaim += 1;\n }\n\n nextTokenIdToClaim = tokenIdToClaim;\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 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bool verifyMaxQuantityPerTransaction\n ) public view {\n ClaimCondition memory currentClaimPhase = claimCondition.phases[_conditionId];\n\n require(\n _currency == currentClaimPhase.currency && _pricePerToken == currentClaimPhase.pricePerToken,\n \"invalid currency or price.\"\n );\n\n // If we're checking for an allowlist quantity restriction, ignore the general quantity restriction.\n require(\n _quantity > 0 &&\n (!verifyMaxQuantityPerTransaction || _quantity <= currentClaimPhase.quantityLimitPerTransaction),\n \"invalid quantity.\"\n );\n require(\n currentClaimPhase.supplyClaimed + _quantity <= currentClaimPhase.maxClaimableSupply,\n \"exceed max claimable supply.\"\n );\n require(nextTokenIdToClaim + _quantity <= nextTokenIdToMint, \"not enough minted tokens.\");\n require(maxTotalSupply == 0 || nextTokenIdToClaim + _quantity <= maxTotalSupply, \"exceed max total supply.\");\n require(\n maxWalletClaimCount == 0 || walletClaimCount[_claimer] + _quantity <= maxWalletClaimCount,\n \"exceed claim limit\"\n );\n\n (uint256 lastClaimTimestamp, uint256 nextValidClaimTimestamp) = getClaimTimestamp(_conditionId, _claimer);\n require(lastClaimTimestamp == 0 || block.timestamp >= nextValidClaimTimestamp, \"cannot claim.\");\n }\n\n /// @dev Checks whether a claimer meets the claim condition's allowlist criteria.\n function verifyClaimMerkleProof(\n uint256 _conditionId,\n address _claimer,\n uint256 _quantity,\n bytes32[] calldata _proofs,\n uint256 _proofMaxQuantityPerTransaction\n ) public view returns (bool validMerkleProof, uint256 merkleProofIndex) {\n ClaimCondition memory currentClaimPhase = claimCondition.phases[_conditionId];\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 require(validMerkleProof, \"not in whitelist.\");\n require(\n !claimCondition.limitMerkleProofClaim[_conditionId].get(uint256(uint160(_claimer))),\n \"proof claimed.\"\n );\n require(\n _proofMaxQuantityPerTransaction == 0 || _quantity <= _proofMaxQuantityPerTransaction,\n \"invalid quantity proof.\"\n );\n }\n }\n\n /*///////////////////////////////////////////////////////////////\n Getter functions\n //////////////////////////////////////////////////////////////*/\n\n /// @dev At any given moment, returns the uid for the active claim condition.\n function getActiveClaimConditionId() public view returns (uint256) {\n for (uint256 i = claimCondition.currentStartId + claimCondition.count; i > claimCondition.currentStartId; i--) {\n if (block.timestamp >= claimCondition.phases[i - 1].startTimestamp) {\n return i - 1;\n }\n }\n\n revert(\"!CONDITION.\");\n }\n\n /// @dev Returns the royalty recipient and bps for a particular token Id.\n function getRoyaltyInfoForToken(uint256 _tokenId) public view returns (address, uint16) {\n RoyaltyInfo memory royaltyForToken = royaltyInfoForToken[_tokenId];\n\n return\n royaltyForToken.recipient == address(0)\n ? (royaltyRecipient, uint16(royaltyBps))\n : (royaltyForToken.recipient, uint16(royaltyForToken.bps));\n }\n\n /// @dev Returns the platform fee recipient and bps.\n function getPlatformFeeInfo() external view returns (address, uint16) {\n return (platformFeeRecipient, uint16(platformFeeBps));\n }\n\n /// @dev Returns the default royalty recipient and bps.\n function getDefaultRoyaltyInfo() external view returns (address, uint16) {\n return (royaltyRecipient, uint16(royaltyBps));\n }\n\n /// @dev Returns the timestamp for when a claimer is eligible for claiming NFTs again.\n function getClaimTimestamp(uint256 _conditionId, address _claimer)\n public\n view\n returns (uint256 lastClaimTimestamp, uint256 nextValidClaimTimestamp)\n {\n lastClaimTimestamp = claimCondition.limitLastClaimTimestamp[_conditionId][_claimer];\n\n unchecked {\n nextValidClaimTimestamp =\n lastClaimTimestamp +\n claimCondition.phases[_conditionId].waitTimeInSecondsBetweenClaims;\n\n if (nextValidClaimTimestamp < lastClaimTimestamp) {\n nextValidClaimTimestamp = type(uint256).max;\n }\n }\n }\n\n /// @dev Returns the claim condition at the given uid.\n function getClaimConditionById(uint256 _conditionId) external view returns (ClaimCondition memory condition) {\n condition = claimCondition.phases[_conditionId];\n }\n\n /// @dev Returns the amount of stored baseURIs\n function getBaseURICount() external view returns (uint256) {\n return baseURIIndices.length;\n }\n\n /*///////////////////////////////////////////////////////////////\n Setter functions\n //////////////////////////////////////////////////////////////*/\n\n /// @dev Lets a contract admin set a claim count for a wallet.\n function setWalletClaimCount(address _claimer, uint256 _count) external onlyRole(DEFAULT_ADMIN_ROLE) {\n walletClaimCount[_claimer] = _count;\n emit WalletClaimCountUpdated(_claimer, _count);\n }\n\n /// @dev Lets a contract admin set a maximum number of NFTs that can be claimed by any wallet.\n function setMaxWalletClaimCount(uint256 _count) external onlyRole(DEFAULT_ADMIN_ROLE) {\n maxWalletClaimCount = _count;\n emit MaxWalletClaimCountUpdated(_count);\n }\n\n /// @dev Lets a contract admin set the global maximum supply for collection's NFTs.\n function setMaxTotalSupply(uint256 _maxTotalSupply) external onlyRole(DEFAULT_ADMIN_ROLE) {\n maxTotalSupply = _maxTotalSupply;\n emit MaxTotalSupplyUpdated(_maxTotalSupply);\n }\n\n /// @dev Lets a contract admin set the recipient for all primary sales.\n function setPrimarySaleRecipient(address _saleRecipient) external onlyRole(DEFAULT_ADMIN_ROLE) {\n primarySaleRecipient = _saleRecipient;\n emit PrimarySaleRecipientUpdated(_saleRecipient);\n }\n\n /// @dev Lets a contract admin update the default royalty recipient and bps.\n function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n require(_royaltyBps <= MAX_BPS, \"> MAX_BPS\");\n\n royaltyRecipient = _royaltyRecipient;\n royaltyBps = uint16(_royaltyBps);\n\n emit DefaultRoyalty(_royaltyRecipient, _royaltyBps);\n }\n\n /// @dev Lets a contract admin set the royalty recipient and bps for a particular token Id.\n function setRoyaltyInfoForToken(\n uint256 _tokenId,\n address _recipient,\n uint256 _bps\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(_bps <= MAX_BPS, \"> MAX_BPS\");\n\n royaltyInfoForToken[_tokenId] = RoyaltyInfo({ recipient: _recipient, bps: _bps });\n\n emit RoyaltyForToken(_tokenId, _recipient, _bps);\n }\n\n /// @dev Lets a contract admin update the platform fee recipient and bps\n function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps)\n external\n onlyRole(DEFAULT_ADMIN_ROLE)\n {\n require(_platformFeeBps <= MAX_BPS, \"> MAX_BPS.\");\n\n platformFeeBps = uint16(_platformFeeBps);\n platformFeeRecipient = _platformFeeRecipient;\n\n emit PlatformFeeInfoUpdated(_platformFeeRecipient, _platformFeeBps);\n }\n\n /// @dev Lets a contract admin set a new owner for the contract. The new owner must be a contract admin.\n function setOwner(address _newOwner) external onlyRole(DEFAULT_ADMIN_ROLE) {\n require(hasRole(DEFAULT_ADMIN_ROLE, _newOwner), \"!ADMIN\");\n address _prevOwner = _owner;\n _owner = _newOwner;\n\n emit OwnerUpdated(_prevOwner, _newOwner);\n }\n\n /// @dev Lets a contract admin set the URI for contract-level metadata.\n function setContractURI(string calldata _uri) external onlyRole(DEFAULT_ADMIN_ROLE) {\n contractURI = _uri;\n }\n\n /*///////////////////////////////////////////////////////////////\n Miscellaneous\n //////////////////////////////////////////////////////////////*/\n\n /// @dev Burns `tokenId`. See {ERC721-_burn}.\n function burn(uint256 tokenId) public virtual {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"caller not owner nor approved\");\n _burn(tokenId);\n }\n\n /// @dev See {ERC721-_beforeTokenTransfer}.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override(ERC721EnumerableUpgradeable) {\n super._beforeTokenTransfer(from, to, tokenId);\n\n // if transfer is restricted on the contract, we still want to allow burning and minting\n if (!hasRole(TRANSFER_ROLE, address(0)) && from != address(0) && to != address(0)) {\n require(hasRole(TRANSFER_ROLE, from) || hasRole(TRANSFER_ROLE, to), \"!TRANSFER_ROLE\");\n }\n }\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"
},
"@thirdweb-dev/contracts/interfaces/drop/IDropERC721.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.11;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\";\nimport \"./IDropClaimCondition.sol\";\n\n/**\n * Thirdweb'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 minter can choose to lazy mint 'delayed-reveal' tokens. More on 'delayed-reveal'\n * tokens in [this article](https://blog.thirdweb.com/delayed-reveal-nfts).\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 IDropERC721 is IERC721Upgradeable, IDropClaimCondition {\n /// @dev Emitted when tokens are claimed.\n event TokensClaimed(\n uint256 indexed claimConditionIndex,\n address indexed claimer,\n address indexed receiver,\n uint256 startTokenId,\n uint256 quantityClaimed\n );\n\n /// @dev Emitted when tokens are lazy minted.\n event TokensLazyMinted(uint256 startTokenId, uint256 endTokenId, string baseURI, bytes encryptedBaseURI);\n\n /// @dev Emitted when the URI for a batch of 'delayed-reveal' NFTs is revealed.\n event NFTRevealed(uint256 endTokenId, string revealedURI);\n\n /// @dev Emitted when new claim conditions are set.\n event ClaimConditionsUpdated(ClaimCondition[] claimConditions);\n\n /// @dev Emitted when the global max supply of tokens is updated.\n event MaxTotalSupplyUpdated(uint256 maxTotalSupply);\n\n /// @dev Emitted when the wallet claim count for an address is updated.\n event WalletClaimCountUpdated(address indexed wallet, uint256 count);\n\n /// @dev Emitted when the global max wallet claim count is updated.\n event MaxWalletClaimCountUpdated(uint256 count);\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 * @param encryptedBaseURI If lazy minting 'delayed-reveal' NFTs, this is the\n * result of encrypting the URI of the NFTs in the revealed\n * state.\n */\n function lazyMint(\n uint256 amount,\n string calldata baseURIForTokens,\n bytes calldata encryptedBaseURI\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 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 quantity,\n address currency,\n uint256 pricePerToken,\n bytes32[] calldata proofs,\n uint256 proofMaxQuantityPerTransaction\n ) external payable;\n\n /**\n * @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.\n *\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(ClaimCondition[] calldata phases, bool resetClaimEligibility) external;\n}\n"
},
"@thirdweb-dev/contracts/interfaces/drop/IDropClaimCondition.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/structs/BitMapsUpgradeable.sol\";\n\n/**\n * Thirdweb'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 IDropClaimCondition {\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 limitLastClaimTimestamp Map from an account and uid for a claim condition, to the last timestamp\n * at which the account claimed tokens under that claim condition.\n *\n * @param limitMerkleProofClaim Map from a claim condition uid to whether an address in an allowlist\n * has already claimed tokens i.e. used their place in the allowlist.\n */\n struct ClaimConditionList {\n uint256 currentStartId;\n uint256 count;\n mapping(uint256 => ClaimCondition) phases;\n mapping(uint256 => mapping(address => uint256)) limitLastClaimTimestamp;\n mapping(uint256 => BitMapsUpgradeable.BitMap) limitMerkleProofClaim;\n }\n}\n"
},
"@thirdweb-dev/contracts/interfaces/IThirdwebContract.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.11;\n\ninterface IThirdwebContract {\n /// @dev Returns the module type of the contract.\n function contractType() external pure returns (bytes32);\n\n /// @dev Returns the version of the contract.\n function contractVersion() external pure returns (uint8);\n\n /// @dev Returns the metadata URI of the contract.\n function contractURI() external view returns (string memory);\n\n /**\n * @dev Sets contract URI for the storefront-level metadata of the contract.\n * Only module admin can call this function.\n */\n function setContractURI(string calldata _uri) external;\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IPlatformFee.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * Thirdweb's `PlatformFee` is a contract extension to be used with any base contract. It exposes functions for setting and reading\n * the recipient of platform fee and the platform fee basis points, and lets the inheriting contract perform conditional logic\n * that uses information about platform fees, if desired.\n */\n\ninterface IPlatformFee {\n /// @dev Returns the platform fee bps and recipient.\n function getPlatformFeeInfo() external view returns (address, uint16);\n\n /// @dev Lets a module admin update the fees on primary sales.\n function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external;\n\n /// @dev Emitted when fee on primary sales is updated.\n event PlatformFeeInfoUpdated(address indexed platformFeeRecipient, uint256 platformFeeBps);\n}\n"
},
"@thirdweb-dev/contracts/openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (metatx/ERC2771Context.sol)\n\npragma solidity ^0.8.11;\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"
},
"@thirdweb-dev/contracts/lib/FeeType.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.11;\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"
},
"@thirdweb-dev/contracts/eip/interface/IERC721Enumerable.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n/// @dev See https://eips.ethereum.org/EIPS/eip-721\n/// Note: the ERC-165 identifier for this interface is 0x780e9d63.\n/* is ERC721 */\ninterface IERC721Enumerable {\n /// @notice Enumerate valid NFTs\n /// @dev Throws if `_index` >= `totalSupply()`.\n /// @param _index A counter less than `totalSupply()`\n /// @return The token identifier for the `_index`th NFT,\n /// (sort order not specified)\n function tokenByIndex(uint256 _index) external view returns (uint256);\n\n /// @notice Enumerate NFTs assigned to an owner\n /// @dev Throws if `_index` >= `balanceOf(_owner)` or if\n /// `_owner` is the zero address, representing invalid NFTs.\n /// @param _owner An address where we are interested in NFTs owned by them\n /// @param _index A counter less than `balanceOf(_owner)`\n /// @return The token identifier for the `_index`th NFT assigned to `_owner`,\n /// (sort order not specified)\n function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);\n}\n"
},
"@thirdweb-dev/contracts/extension/Drop.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./interface/IDrop.sol\";\nimport \"../lib/MerkleProof.sol\";\nimport \"../lib/TWBitMaps.sol\";\n\nabstract contract Drop is IDrop {\n using TWBitMaps for TWBitMaps.BitMap;\n\n /*///////////////////////////////////////////////////////////////\n State variables\n //////////////////////////////////////////////////////////////*/\n\n /// @dev The active conditions for claiming tokens.\n ClaimConditionList public claimCondition;\n\n /*///////////////////////////////////////////////////////////////\n Drop logic\n //////////////////////////////////////////////////////////////*/\n\n /// @dev Lets an account claim tokens.\n function claim(\n address _receiver,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n AllowlistProof calldata _allowlistProof,\n bytes memory _data\n ) public payable virtual override {\n _beforeClaim(_receiver, _quantity, _currency, _pricePerToken, _allowlistProof, _data);\n\n uint256 activeConditionId = getActiveClaimConditionId();\n ClaimCondition memory currentClaimPhase = claimCondition.conditions[activeConditionId];\n\n /**\n * 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 */\n\n // Verify inclusion in allowlist.\n (bool validMerkleProof, uint256 merkleProofIndex) = verifyClaimMerkleProof(\n activeConditionId,\n _dropMsgSender(),\n _quantity,\n _allowlistProof\n );\n\n // Verify claim validity. If not valid, revert.\n // when there's allowlist present --> verifyClaimMerkleProof will verify the maxQuantityInAllowlist value with hashed leaf in the allowlist\n // when there's no allowlist, this check is true --> verifyClaim will check for _quantity being equal/less than the limit\n bool toVerifyMaxQuantityPerTransaction = _allowlistProof.maxQuantityInAllowlist == 0 ||\n currentClaimPhase.merkleRoot == bytes32(0);\n\n verifyClaim(\n activeConditionId,\n _dropMsgSender(),\n _quantity,\n _currency,\n _pricePerToken,\n toVerifyMaxQuantityPerTransaction\n );\n\n if (validMerkleProof && _allowlistProof.maxQuantityInAllowlist > 0) {\n /**\n * Mark the claimer's use of their position in the allowlist. A spot in an allowlist\n * can be used only once.\n */\n claimCondition.usedAllowlistSpot[activeConditionId].set(merkleProofIndex);\n }\n\n // Update contract state.\n claimCondition.conditions[activeConditionId].supplyClaimed += _quantity;\n claimCondition.lastClaimTimestamp[activeConditionId][_dropMsgSender()] = block.timestamp;\n\n // If there's a price, collect price.\n _collectPriceOnClaim(_quantity, _currency, _pricePerToken);\n\n // Mint the relevant NFTs to claimer.\n uint256 startTokenId = _transferTokensOnClaim(_receiver, _quantity);\n\n emit TokensClaimed(activeConditionId, _dropMsgSender(), _receiver, startTokenId, _quantity);\n\n _afterClaim(_receiver, _quantity, _currency, _pricePerToken, _allowlistProof, _data);\n }\n\n /// @dev Lets a contract admin set claim conditions.\n function setClaimConditions(ClaimCondition[] calldata _conditions, bool _resetClaimEligibility)\n external\n virtual\n override\n {\n if (!_canSetClaimConditions()) {\n revert Drop__NotAuthorized();\n }\n\n uint256 existingStartIndex = claimCondition.currentStartId;\n uint256 existingPhaseCount = claimCondition.count;\n\n /**\n * `lastClaimTimestamp` and `usedAllowListSpot` 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 `_conditions`, effectively resetting the restrictions on claims expressed\n * by `lastClaimTimestamp` and `usedAllowListSpot`.\n */\n uint256 newStartIndex = existingStartIndex;\n if (_resetClaimEligibility) {\n newStartIndex = existingStartIndex + existingPhaseCount;\n }\n\n claimCondition.count = _conditions.length;\n claimCondition.currentStartId = newStartIndex;\n\n uint256 lastConditionStartTimestamp;\n for (uint256 i = 0; i < _conditions.length; i++) {\n require(i == 0 || lastConditionStartTimestamp < _conditions[i].startTimestamp, \"ST\");\n\n uint256 supplyClaimedAlready = claimCondition.conditions[newStartIndex + i].supplyClaimed;\n if (supplyClaimedAlready > _conditions[i].maxClaimableSupply) {\n revert Drop__MaxSupplyClaimedAlready(supplyClaimedAlready);\n }\n\n claimCondition.conditions[newStartIndex + i] = _conditions[i];\n claimCondition.conditions[newStartIndex + i].supplyClaimed = supplyClaimedAlready;\n\n lastConditionStartTimestamp = _conditions[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 `_conditions`. So, we delete claim conditions with UID < `newStartIndex`.\n *\n * If `_resetClaimEligibility == false`, and there are more existing claim conditions\n * than in `_conditions`, we delete the existing claim conditions that don't get replaced\n * by the conditions in `_conditions`.\n */\n if (_resetClaimEligibility) {\n for (uint256 i = existingStartIndex; i < newStartIndex; i++) {\n delete claimCondition.conditions[i];\n delete claimCondition.usedAllowlistSpot[i];\n }\n } else {\n if (existingPhaseCount > _conditions.length) {\n for (uint256 i = _conditions.length; i < existingPhaseCount; i++) {\n delete claimCondition.conditions[newStartIndex + i];\n delete claimCondition.usedAllowlistSpot[newStartIndex + i];\n }\n }\n }\n\n emit ClaimConditionsUpdated(_conditions, _resetClaimEligibility);\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 _quantity,\n address _currency,\n uint256 _pricePerToken,\n bool verifyMaxQuantityPerTransaction\n ) public view {\n ClaimCondition memory currentClaimPhase = claimCondition.conditions[_conditionId];\n\n if (_currency != currentClaimPhase.currency || _pricePerToken != currentClaimPhase.pricePerToken) {\n revert Drop__InvalidCurrencyOrPrice(\n _currency,\n currentClaimPhase.currency,\n _pricePerToken,\n currentClaimPhase.pricePerToken\n );\n }\n\n // If we're checking for an allowlist quantity restriction, ignore the general quantity restriction.\n if (\n _quantity == 0 ||\n (verifyMaxQuantityPerTransaction && _quantity > currentClaimPhase.quantityLimitPerTransaction)\n ) {\n revert Drop__InvalidQuantity();\n }\n if (currentClaimPhase.supplyClaimed + _quantity > currentClaimPhase.maxClaimableSupply) {\n revert Drop__ExceedMaxClaimableSupply(\n currentClaimPhase.supplyClaimed,\n currentClaimPhase.maxClaimableSupply\n );\n }\n\n (uint256 lastClaimedAt, uint256 nextValidClaimTimestamp) = getClaimTimestamp(_conditionId, _claimer);\n if (\n currentClaimPhase.startTimestamp > block.timestamp ||\n (lastClaimedAt != 0 && block.timestamp < nextValidClaimTimestamp)\n ) {\n revert Drop__CannotClaimYet(\n block.timestamp,\n currentClaimPhase.startTimestamp,\n lastClaimedAt,\n nextValidClaimTimestamp\n );\n }\n }\n\n /// @dev Checks whether a claimer meets the claim condition's allowlist criteria.\n function verifyClaimMerkleProof(\n uint256 _conditionId,\n address _claimer,\n uint256 _quantity,\n AllowlistProof calldata _allowlistProof\n ) public view returns (bool validMerkleProof, uint256 merkleProofIndex) {\n ClaimCondition memory currentClaimPhase = claimCondition.conditions[_conditionId];\n\n if (currentClaimPhase.merkleRoot != bytes32(0)) {\n (validMerkleProof, merkleProofIndex) = MerkleProof.verify(\n _allowlistProof.proof,\n currentClaimPhase.merkleRoot,\n keccak256(abi.encodePacked(_claimer, _allowlistProof.maxQuantityInAllowlist))\n );\n if (!validMerkleProof) {\n revert Drop__NotInWhitelist();\n }\n\n if (claimCondition.usedAllowlistSpot[_conditionId].get(merkleProofIndex)) {\n revert Drop__ProofClaimed();\n }\n\n if (_allowlistProof.maxQuantityInAllowlist != 0 && _quantity > _allowlistProof.maxQuantityInAllowlist) {\n revert Drop__InvalidQuantityProof(_allowlistProof.maxQuantityInAllowlist);\n }\n }\n }\n\n /// @dev At any given moment, returns the uid for the active claim condition.\n function getActiveClaimConditionId() public view returns (uint256) {\n for (uint256 i = claimCondition.currentStartId + claimCondition.count; i > claimCondition.currentStartId; i--) {\n if (block.timestamp >= claimCondition.conditions[i - 1].startTimestamp) {\n return i - 1;\n }\n }\n\n revert(\"!CONDITION.\");\n }\n\n /// @dev Returns the claim condition at the given uid.\n function getClaimConditionById(uint256 _conditionId) external view returns (ClaimCondition memory condition) {\n condition = claimCondition.conditions[_conditionId];\n }\n\n /// @dev Returns the timestamp for when a claimer is eligible for claiming NFTs again.\n function getClaimTimestamp(uint256 _conditionId, address _claimer)\n public\n view\n returns (uint256 lastClaimTimestamp, uint256 nextValidClaimTimestamp)\n {\n lastClaimTimestamp = claimCondition.lastClaimTimestamp[_conditionId][_claimer];\n\n unchecked {\n nextValidClaimTimestamp =\n lastClaimTimestamp +\n claimCondition.conditions[_conditionId].waitTimeInSecondsBetweenClaims;\n\n if (nextValidClaimTimestamp < lastClaimTimestamp) {\n nextValidClaimTimestamp = type(uint256).max;\n }\n }\n }\n\n /*////////////////////////////////////////////////////////////////////\n Optional hooks that can be implemented in the derived contract\n ///////////////////////////////////////////////////////////////////*/\n\n /// @dev Exposes the ability to override the msg sender.\n function _dropMsgSender() internal virtual returns (address) {\n return msg.sender;\n }\n\n /// @dev Runs before every `claim` function call.\n function _beforeClaim(\n address _receiver,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n AllowlistProof calldata _allowlistProof,\n bytes memory _data\n ) internal virtual {}\n\n /// @dev Runs after every `claim` function call.\n function _afterClaim(\n address _receiver,\n uint256 _quantity,\n address _currency,\n uint256 _pricePerToken,\n AllowlistProof calldata _allowlistProof,\n bytes memory _data\n ) internal virtual {}\n\n /*///////////////////////////////////////////////////////////////\n Virtual functions: to be implemented in derived contract\n //////////////////////////////////////////////////////////////*/\n\n /// @dev Collects and distributes the primary sale value of NFTs being claimed.\n function _collectPriceOnClaim(\n uint256 _quantityToClaim,\n address _currency,\n uint256 _pricePerToken\n ) internal virtual;\n\n /// @dev Transfers the NFTs being claimed.\n function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed)\n internal\n virtual\n returns (uint256 startTokenId);\n\n /// @dev Determine what wallet can update claim conditions\n function _canSetClaimConditions() internal view virtual returns (bool);\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IDrop.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"./IClaimConditionMultiPhase.sol\";\n\ninterface IDrop is IClaimConditionMultiPhase {\n struct AllowlistProof {\n bytes32[] proof;\n uint256 maxQuantityInAllowlist;\n }\n\n /// @dev Emitted when an unauthorized caller tries to set claim conditions.\n error Drop__NotAuthorized();\n\n /// @notice Emitted when given currency or price is invalid.\n error Drop__InvalidCurrencyOrPrice(\n address givenCurrency,\n address requiredCurrency,\n uint256 givenPricePerToken,\n uint256 requiredPricePerToken\n );\n\n /// @notice Emitted when claiming invalid quantity of tokens.\n error Drop__InvalidQuantity();\n\n /// @notice Emitted when claiming given quantity will exceed max claimable supply.\n error Drop__ExceedMaxClaimableSupply(uint256 supplyClaimed, uint256 maxClaimableSupply);\n\n /// @notice Emitted when the current timestamp is invalid for claim.\n error Drop__CannotClaimYet(\n uint256 blockTimestamp,\n uint256 startTimestamp,\n uint256 lastClaimedAt,\n uint256 nextValidClaimTimestamp\n );\n\n /// @notice Emitted when given allowlist proof is invalid.\n error Drop__NotInWhitelist();\n\n /// @notice Emitted when allowlist spot is already used.\n error Drop__ProofClaimed();\n\n /// @notice Emitted when claiming more than allowed quantity in allowlist.\n error Drop__InvalidQuantityProof(uint256 maxQuantityInAllowlist);\n\n /// @notice Emitted when max claimable supply in given condition is less than supply claimed already.\n error Drop__MaxSupplyClaimedAlready(uint256 supplyClaimedAlready);\n\n /// @dev Emitted when tokens are claimed via `claim`.\n event TokensClaimed(\n uint256 indexed claimConditionIndex,\n address indexed claimer,\n address indexed receiver,\n uint256 startTokenId,\n uint256 quantityClaimed\n );\n\n /// @dev Emitted when the contract's claim conditions are updated.\n event ClaimConditionsUpdated(ClaimCondition[] claimConditions, bool resetEligibility);\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 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 allowlistProof The proof of the claimer's inclusion in the merkle root allowlist\n * of the claim conditions that apply.\n * @param data Arbitrary bytes data that can be leveraged in the implementation of this interface.\n */\n function claim(\n address receiver,\n uint256 quantity,\n address currency,\n uint256 pricePerToken,\n AllowlistProof calldata allowlistProof,\n bytes memory data\n ) external payable;\n\n /**\n * @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.\n *\n * @param phases Claim conditions in ascending order by `startTimestamp`.\n *\n * @param resetClaimEligibility Whether to reset `limitLastClaimTimestamp` and `limitMerkleProofClaim` values when setting new\n * claim conditions.\n *\n */\n function setClaimConditions(ClaimCondition[] calldata phases, bool resetClaimEligibility) external;\n}\n"
},
"@thirdweb-dev/contracts/extension/interface/IClaimConditionMultiPhase.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\nimport \"../../lib/TWBitMaps.sol\";\nimport \"./IClaimCondition.sol\";\n\n/**\n * Thirdweb'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 IClaimConditionMultiPhase is IClaimCondition {\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 conditions The claim conditions at a given uid. Claim conditions\n * are ordered in an ascending order by their `startTimestamp`.\n *\n * @param lastClaimTimestamp Map from an account and uid for a claim condition, to the last timestamp\n * at which the account claimed tokens under that claim condition.\n *\n * @param usedAllowlistSpot Map from a claim condition uid to whether an address in an allowlist\n * has already claimed tokens i.e. used their place in the allowlist.\n */\n struct ClaimConditionList {\n uint256 currentStartId;\n uint256 count;\n mapping(uint256 => ClaimCondition) conditions;\n mapping(uint256 => mapping(address => uint256)) lastClaimTimestamp;\n mapping(uint256 => TWBitMaps.BitMap) usedAllowlistSpot;\n }\n}\n"
}
},
"settings": {
"metadata": {
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers"
],
"": [
"id",
"ast"
]
}
}
}
}