@artblocks/contracts 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/.env.example +10 -0
  2. package/LICENSE +165 -0
  3. package/README.md +286 -0
  4. package/artifacts/contracts/AdminACLV0.sol/AdminACLV0.json +164 -0
  5. package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +248 -0
  6. package/artifacts/contracts/BasicRandomizer.sol/BasicRandomizer.json +24 -0
  7. package/artifacts/contracts/BasicRandomizerV2.sol/BasicRandomizerV2.json +102 -0
  8. package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +1020 -0
  9. package/artifacts/contracts/GenArt721CoreV3.sol/GenArt721CoreV3.json +1928 -0
  10. package/artifacts/contracts/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +1942 -0
  11. package/artifacts/contracts/engine/GenArt721CoreV2_ENGINE_FLEX.sol/GenArt721CoreV2_ENGINE_FLEX.json +1708 -0
  12. package/artifacts/contracts/engine/GenArt721CoreV2_PBAB.sol/GenArt721CoreV2_PBAB.json +1410 -0
  13. package/artifacts/contracts/engine/GenArt721CoreV2_PRTNR.sol/GenArt721CoreV2_PRTNR.json +1436 -0
  14. package/artifacts/contracts/engine/GenArt721MinterBurner_PBAB.sol/GenArt721MinterBurner_PBAB.json +437 -0
  15. package/artifacts/contracts/engine/GenArt721MinterDAExp_PBAB.sol/GenArt721MinterDAExp_PBAB.json +508 -0
  16. package/artifacts/contracts/engine/GenArt721Minter_PBAB.sol/GenArt721Minter_PBAB.json +381 -0
  17. package/artifacts/contracts/engine-registry/EngineRegistryV0.sol/EngineRegistryV0.json +109 -0
  18. package/artifacts/contracts/engine-registry/future/EngineRegistryV1.sol/EngineRegistryV1.json +109 -0
  19. package/artifacts/contracts/explorations/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +1902 -0
  20. package/artifacts/contracts/interfaces/0.5.x/IBonusContract.sol/IBonusContract.json +47 -0
  21. package/artifacts/contracts/interfaces/0.5.x/IGenArt721CoreContractV1.sol/IGenArt721CoreContractV1.json +413 -0
  22. package/artifacts/contracts/interfaces/0.5.x/IGenArt721CoreV2_PBAB.sol/IGenArt721CoreV2_PBAB.json +392 -0
  23. package/artifacts/contracts/interfaces/0.5.x/IRandomizer.sol/IRandomizer.json +26 -0
  24. package/artifacts/contracts/interfaces/0.8.x/IAdminACLV0.sol/IAdminACLV0.json +122 -0
  25. package/artifacts/contracts/interfaces/0.8.x/IArtblocksRoyaltyOverride.sol/IArtblocksRoyaltyOverride.json +59 -0
  26. package/artifacts/contracts/interfaces/0.8.x/IBonusContract.sol/IBonusContract.json +43 -0
  27. package/artifacts/contracts/interfaces/0.8.x/IDelegationRegistry.sol/IDelegationRegistry.json +510 -0
  28. package/artifacts/contracts/interfaces/0.8.x/IDependencyRegistryCompatibleV0.sol/IDependencyRegistryCompatibleV0.json +53 -0
  29. package/artifacts/contracts/interfaces/0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +350 -0
  30. package/artifacts/contracts/interfaces/0.8.x/IEngineRegistryV0.sol/IEngineRegistryV0.json +85 -0
  31. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDAExpSettlementV0.sol/IFilteredMinterDAExpSettlementV0.json +730 -0
  32. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDAExpV0.sol/IFilteredMinterDAExpV0.json +311 -0
  33. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDAExpV1.sol/IFilteredMinterDAExpV1.json +617 -0
  34. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDALinV0.sol/IFilteredMinterDALinV0.json +292 -0
  35. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDALinV1.sol/IFilteredMinterDALinV1.json +598 -0
  36. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterHolderV0.sol/IFilteredMinterHolderV0.json +355 -0
  37. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterHolderV1.sol/IFilteredMinterHolderV1.json +368 -0
  38. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterHolderV2.sol/IFilteredMinterHolderV2.json +674 -0
  39. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterMerkleV0.sol/IFilteredMinterMerkleV0.json +551 -0
  40. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterMerkleV1.sol/IFilteredMinterMerkleV1.json +564 -0
  41. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterMerkleV2.sol/IFilteredMinterMerkleV2.json +601 -0
  42. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterV0.sol/IFilteredMinterV0.json +216 -0
  43. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterV1.sol/IFilteredMinterV1.json +485 -0
  44. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterV2.sol/IFilteredMinterV2.json +522 -0
  45. package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV1.sol/IGenArt721CoreContractV1.json +299 -0
  46. package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV3.sol/IGenArt721CoreContractV3.json +609 -0
  47. package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Base.sol/IGenArt721CoreContractV3_Base.json +448 -0
  48. package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Engine.sol/IGenArt721CoreContractV3_Engine.json +649 -0
  49. package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreV2_PBAB.sol/IGenArt721CoreV2_PBAB.json +362 -0
  50. package/artifacts/contracts/interfaces/0.8.x/IManifold.sol/IManifold.json +35 -0
  51. package/artifacts/contracts/interfaces/0.8.x/IMinterFilterV0.sol/IMinterFilterV0.json +192 -0
  52. package/artifacts/contracts/interfaces/0.8.x/IRandomizer.sol/IRandomizer.json +24 -0
  53. package/artifacts/contracts/interfaces/0.8.x/IRandomizerV2.sol/IRandomizerV2.json +37 -0
  54. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/Address.json +10 -0
  55. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/Counters.json +10 -0
  56. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/CustomERC721Metadata.json +425 -0
  57. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/ERC165.json +38 -0
  58. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/ERC721.json +322 -0
  59. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/ERC721Enumerable.json +384 -0
  60. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/GenArt721CoreV1.json +1773 -0
  61. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/IERC165.json +32 -0
  62. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/IERC721.json +316 -0
  63. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/IERC721Enumerable.json +378 -0
  64. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/IERC721Receiver.json +47 -0
  65. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/SafeMath.json +10 -0
  66. package/artifacts/contracts/legacy/GenArt721CoreV1.sol/Strings.json +10 -0
  67. package/artifacts/contracts/legacy/GenArt721LegacyMinter.sol/GenArt721LegacyMinter.json +338 -0
  68. package/artifacts/contracts/libs/0.5.x/CustomERC721Metadata.sol/CustomERC721Metadata.json +425 -0
  69. package/artifacts/contracts/libs/0.5.x/IERC20.sol/IERC20.json +206 -0
  70. package/artifacts/contracts/libs/0.5.x/SafeMath.sol/SafeMath.json +10 -0
  71. package/artifacts/contracts/libs/0.5.x/Strings.sol/Strings.json +10 -0
  72. package/artifacts/contracts/libs/0.8.x/BytecodeStorage.sol/BytecodeStorage.json +10 -0
  73. package/artifacts/contracts/libs/0.8.x/Bytes32Strings.sol/Bytes32Strings.json +10 -0
  74. package/artifacts/contracts/libs/0.8.x/ERC721_PackedHashSeed.sol/ERC721_PackedHashSeed.json +357 -0
  75. package/artifacts/contracts/libs/integration-refs/delegation-registry/DelegationRegistry.sol/DelegationRegistry.json +529 -0
  76. package/artifacts/contracts/libs/integration-refs/gnosis-safe/GnosisSafeMock.sol/GnosisSafeMock.json +1037 -0
  77. package/artifacts/contracts/libs/integration-refs/gnosis-safe/GnosisSafeProxyFactoryMock.sol/GnosisSafeProxyFactoryMock.json +172 -0
  78. package/artifacts/contracts/libs/integration-refs/gnosis-safe/MultiSendMock.sol/MultiSendMock.json +24 -0
  79. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV0.sol/MinterFilterV0.json +342 -0
  80. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV1.sol/MinterFilterV1.json +322 -0
  81. package/artifacts/contracts/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol/MinterDAExpV2.json +550 -0
  82. package/artifacts/contracts/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol/MinterDAExpV3.json +856 -0
  83. package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol/MinterDAExpSettlementV0.json +1053 -0
  84. package/artifacts/contracts/minter-suite/Minters/MinterDALin/MinterDALinV2.sol/MinterDALinV2.json +526 -0
  85. package/artifacts/contracts/minter-suite/Minters/MinterDALin/MinterDALinV3.sol/MinterDALinV3.json +832 -0
  86. package/artifacts/contracts/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +794 -0
  87. package/artifacts/contracts/minter-suite/Minters/MinterHolder/MinterHolderV3.sol/MinterHolderV3.json +1100 -0
  88. package/artifacts/contracts/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol/MinterMerkleV3.json +1002 -0
  89. package/artifacts/contracts/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol/MinterMerkleV4.json +1039 -0
  90. package/artifacts/contracts/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol/MinterSetPriceV2.json +365 -0
  91. package/artifacts/contracts/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol/MinterSetPriceV3.json +671 -0
  92. package/artifacts/contracts/minter-suite/Minters/MinterSetPrice/deprecated/MinterSetPriceV1.sol/MinterSetPriceV1.json +288 -0
  93. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol/MinterSetPriceERC20V2.json +436 -0
  94. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol/MinterSetPriceERC20V3.json +742 -0
  95. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20/deprecated/MinterSetPriceERC20V0.sol/MinterSetPriceERC20V0.json +461 -0
  96. package/artifacts/contracts/mock/BytecodeTextCR_DMock.sol/BytecodeTextCR_DMock.json +194 -0
  97. package/artifacts/contracts/mock/DeadReceiverMock.sol/DeadReceiverMock.json +15 -0
  98. package/artifacts/contracts/mock/ERC20Mock.sol/ERC20Mock.json +292 -0
  99. package/artifacts/contracts/mock/MockAdminACLV0.sol/MockAdminACLV0Events.json +165 -0
  100. package/artifacts/contracts/mock/RandomizerV2_NoAssignMock.sol/RandomizerV2_NoAssignMock.json +128 -0
  101. package/artifacts/contracts/mock/ReentrancyHolderMock.sol/ReentrancyHolderMock.json +118 -0
  102. package/artifacts/contracts/mock/ReentrancyMerkleMock.sol/ReentrancyMerkleMock.json +87 -0
  103. package/artifacts/contracts/mock/ReentrancyMock.sol/ReentrancyMock.json +82 -0
  104. package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverride.sol/GenArt721RoyaltyOverride.json +208 -0
  105. package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverride_PBAB.sol/GenArt721RoyaltyOverride_PBAB.json +301 -0
  106. package/contracts/AdminACLV0.sol +103 -0
  107. package/contracts/AdminACLV1.sol +193 -0
  108. package/contracts/BasicRandomizer.sol +23 -0
  109. package/contracts/BasicRandomizerV2.sol +36 -0
  110. package/contracts/DependencyRegistryV0.sol +893 -0
  111. package/contracts/GenArt721CoreV3.sol +2001 -0
  112. package/contracts/GenArt721CoreV3_Engine.sol +2061 -0
  113. package/contracts/engine/GenArt721CoreV2_ENGINE_FLEX.sol +887 -0
  114. package/contracts/engine/GenArt721CoreV2_PBAB.sol +695 -0
  115. package/contracts/engine/GenArt721CoreV2_PRTNR.sol +749 -0
  116. package/contracts/engine/GenArt721MinterBurner_PBAB.sol +467 -0
  117. package/contracts/engine/GenArt721MinterDAExp_PBAB.sol +614 -0
  118. package/contracts/engine/GenArt721Minter_PBAB.sol +420 -0
  119. package/contracts/engine-registry/EngineRegistryV0.sol +72 -0
  120. package/contracts/engine-registry/future/EngineRegistryV1.sol +86 -0
  121. package/contracts/explorations/GenArt721CoreV3_Explorations.sol +1989 -0
  122. package/contracts/interfaces/0.5.x/IBonusContract.sol +10 -0
  123. package/contracts/interfaces/0.5.x/IGenArt721CoreContractV1.sol +91 -0
  124. package/contracts/interfaces/0.5.x/IGenArt721CoreV2_PBAB.sol +92 -0
  125. package/contracts/interfaces/0.5.x/IRandomizer.sol +8 -0
  126. package/contracts/interfaces/0.8.x/IAdminACLV0.sol +51 -0
  127. package/contracts/interfaces/0.8.x/IArtblocksRoyaltyOverride.sol +34 -0
  128. package/contracts/interfaces/0.8.x/IBonusContract.sol +10 -0
  129. package/contracts/interfaces/0.8.x/IDelegationRegistry.sol +221 -0
  130. package/contracts/interfaces/0.8.x/IDependencyRegistryCompatibleV0.sol +31 -0
  131. package/contracts/interfaces/0.8.x/IDependencyRegistryV0.sol +95 -0
  132. package/contracts/interfaces/0.8.x/IEngineRegistryV0.sol +38 -0
  133. package/contracts/interfaces/0.8.x/IFilteredMinterDAExpSettlementV0.sol +70 -0
  134. package/contracts/interfaces/0.8.x/IFilteredMinterDAExpV0.sol +35 -0
  135. package/contracts/interfaces/0.8.x/IFilteredMinterDAExpV1.sol +16 -0
  136. package/contracts/interfaces/0.8.x/IFilteredMinterDALinV0.sol +32 -0
  137. package/contracts/interfaces/0.8.x/IFilteredMinterDALinV1.sol +16 -0
  138. package/contracts/interfaces/0.8.x/IFilteredMinterHolderV0.sol +68 -0
  139. package/contracts/interfaces/0.8.x/IFilteredMinterHolderV1.sol +19 -0
  140. package/contracts/interfaces/0.8.x/IFilteredMinterHolderV2.sol +19 -0
  141. package/contracts/interfaces/0.8.x/IFilteredMinterMerkleV0.sol +37 -0
  142. package/contracts/interfaces/0.8.x/IFilteredMinterMerkleV1.sol +19 -0
  143. package/contracts/interfaces/0.8.x/IFilteredMinterMerkleV2.sol +19 -0
  144. package/contracts/interfaces/0.8.x/IFilteredMinterV0.sol +74 -0
  145. package/contracts/interfaces/0.8.x/IFilteredMinterV1.sol +127 -0
  146. package/contracts/interfaces/0.8.x/IFilteredMinterV2.sol +30 -0
  147. package/contracts/interfaces/0.8.x/IGenArt721CoreContractV1.sol +73 -0
  148. package/contracts/interfaces/0.8.x/IGenArt721CoreContractV3.sol +79 -0
  149. package/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Base.sol +127 -0
  150. package/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Engine.sol +80 -0
  151. package/contracts/interfaces/0.8.x/IGenArt721CoreV2_PBAB.sol +91 -0
  152. package/contracts/interfaces/0.8.x/IManifold.sol +24 -0
  153. package/contracts/interfaces/0.8.x/IMinterFilterV0.sol +47 -0
  154. package/contracts/interfaces/0.8.x/IRandomizer.sol +8 -0
  155. package/contracts/interfaces/0.8.x/IRandomizerV2.sol +15 -0
  156. package/contracts/legacy/GenArt721CoreV1.sol +1593 -0
  157. package/contracts/legacy/GenArt721LegacyMinter.sol +275 -0
  158. package/contracts/libs/0.5.x/CustomERC721Metadata.sol +52 -0
  159. package/contracts/libs/0.5.x/IERC20.sol +96 -0
  160. package/contracts/libs/0.5.x/SafeMath.sol +98 -0
  161. package/contracts/libs/0.5.x/Strings.sol +92 -0
  162. package/contracts/libs/0.8.x/BytecodeStorage.sol +314 -0
  163. package/contracts/libs/0.8.x/Bytes32Strings.sol +66 -0
  164. package/contracts/libs/0.8.x/ERC721_PackedHashSeed.sol +514 -0
  165. package/contracts/libs/integration-refs/delegation-registry/DelegationRegistry.sol +663 -0
  166. package/contracts/libs/integration-refs/gnosis-safe/GnosisSafeMock.sol +6 -0
  167. package/contracts/libs/integration-refs/gnosis-safe/GnosisSafeProxyFactoryMock.sol +6 -0
  168. package/contracts/libs/integration-refs/gnosis-safe/MultiSendMock.sol +6 -0
  169. package/contracts/minter-suite/MinterFilter/MinterFilterV0.sol +291 -0
  170. package/contracts/minter-suite/MinterFilter/MinterFilterV1.sol +320 -0
  171. package/contracts/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol +571 -0
  172. package/contracts/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol +622 -0
  173. package/contracts/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol +1066 -0
  174. package/contracts/minter-suite/Minters/MinterDALin/MinterDALinV2.sol +527 -0
  175. package/contracts/minter-suite/Minters/MinterDALin/MinterDALinV3.sol +576 -0
  176. package/contracts/minter-suite/Minters/MinterHolder/MinterHolderV2.sol +749 -0
  177. package/contracts/minter-suite/Minters/MinterHolder/MinterHolderV3.sol +798 -0
  178. package/contracts/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol +682 -0
  179. package/contracts/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol +733 -0
  180. package/contracts/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol +350 -0
  181. package/contracts/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol +401 -0
  182. package/contracts/minter-suite/Minters/MinterSetPrice/deprecated/MinterSetPriceV1.sol +274 -0
  183. package/contracts/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol +491 -0
  184. package/contracts/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol +542 -0
  185. package/contracts/minter-suite/Minters/MinterSetPriceERC20/deprecated/MinterSetPriceERC20V0.sol +470 -0
  186. package/contracts/mock/BytecodeTextCR_DMock.sol +184 -0
  187. package/contracts/mock/DeadReceiverMock.sol +13 -0
  188. package/contracts/mock/ERC20Mock.sol +11 -0
  189. package/contracts/mock/MockAdminACLV0.sol +65 -0
  190. package/contracts/mock/RandomizerV2_NoAssignMock.sol +43 -0
  191. package/contracts/mock/ReentrancyHolderMock.sol +50 -0
  192. package/contracts/mock/ReentrancyMerkleMock.sol +64 -0
  193. package/contracts/mock/ReentrancyMock.sol +44 -0
  194. package/contracts/royalty-registry/GenArt721RoyaltyOverride.sol +168 -0
  195. package/contracts/royalty-registry/GenArt721RoyaltyOverride_PBAB.sol +221 -0
  196. package/package.json +83 -0
@@ -0,0 +1,733 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ import "../../../interfaces/0.8.x/IGenArt721CoreContractV3.sol";
5
+ import "../../../interfaces/0.8.x/IMinterFilterV0.sol";
6
+ import "../../../interfaces/0.8.x/IFilteredMinterMerkleV2.sol";
7
+ import "../../../interfaces/0.8.x/IDelegationRegistry.sol";
8
+
9
+ import "@openzeppelin-4.7/contracts/utils/cryptography/MerkleProof.sol";
10
+ import "@openzeppelin-4.7/contracts/token/ERC20/IERC20.sol";
11
+ import "@openzeppelin-4.7/contracts/security/ReentrancyGuard.sol";
12
+
13
+ pragma solidity 0.8.17;
14
+
15
+ /**
16
+ * @title Filtered Minter contract that allows tokens to be minted with ETH
17
+ * for addresses in a Merkle allowlist.
18
+ * This is designed to be used with IGenArt721CoreContractV3 contracts.
19
+ * @author Art Blocks Inc.
20
+ * @notice Privileged Roles and Ownership:
21
+ * This contract is designed to be managed, with limited powers.
22
+ * Privileged roles and abilities are controlled by the project's artist, which
23
+ * can be modified by the core contract's Admin ACL contract. Both of these
24
+ * roles hold extensive power and can modify minter details.
25
+ * Care must be taken to ensure that the admin ACL contract and artist
26
+ * addresses are secure behind a multi-sig or other access control mechanism.
27
+ * ----------------------------------------------------------------------------
28
+ * The following functions are restricted to a project's artist:
29
+ * - updateMerkleRoot
30
+ * - updatePricePerTokenInWei
31
+ * - setProjectInvocationsPerAddress
32
+ * - setProjectMaxInvocations
33
+ * - manuallyLimitProjectMaxInvocations
34
+ * ----------------------------------------------------------------------------
35
+ * Additional admin and artist privileged roles may be described on other
36
+ * contracts that this minter integrates with.
37
+ * ----------------------------------------------------------------------------
38
+ * This contract allows vaults to configure token-level or wallet-level
39
+ * delegation of minting privileges. This allows a vault on an allowlist to
40
+ * delegate minting privileges to a wallet that is not on the allowlist,
41
+ * enabling the vault to remain air-gapped while still allowing minting. The
42
+ * delegation registry contract is responsible for managing these delegations,
43
+ * and is available at the address returned by the public immutable
44
+ * `delegationRegistryAddress`. At the time of writing, the delegation
45
+ * registry enables easy delegation configuring at https://delegate.cash/.
46
+ * Art Blocks does not guarentee the security of the delegation registry, and
47
+ * users should take care to ensure that the delegation registry is secure.
48
+ * Token-level delegations are configured by the vault owner, and contract-
49
+ * level delegations must be configured for the core token contract as returned
50
+ * by the public immutable variable `genArt721CoreAddress`.
51
+ */
52
+ contract MinterMerkleV4 is ReentrancyGuard, IFilteredMinterMerkleV2 {
53
+ using MerkleProof for bytes32[];
54
+
55
+ /// Delegation registry address
56
+ address public immutable delegationRegistryAddress;
57
+
58
+ /// Delegation registry address
59
+ IDelegationRegistry private immutable delegationRegistryContract;
60
+
61
+ /// Core contract address this minter interacts with
62
+ address public immutable genArt721CoreAddress;
63
+
64
+ /// This contract handles cores with interface IV3
65
+ IGenArt721CoreContractV3 private immutable genArtCoreContract;
66
+
67
+ /// Minter filter address this minter interacts with
68
+ address public immutable minterFilterAddress;
69
+
70
+ /// Minter filter this minter may interact with.
71
+ IMinterFilterV0 private immutable minterFilter;
72
+
73
+ /// minterType for this minter
74
+ string public constant minterType = "MinterMerkleV4";
75
+
76
+ /// project minter configuration keys used by this minter
77
+ bytes32 private constant CONFIG_MERKLE_ROOT = "merkleRoot";
78
+ bytes32 private constant CONFIG_USE_MAX_INVOCATIONS_PER_ADDRESS_OVERRIDE =
79
+ "useMaxMintsPerAddrOverride"; // shortened to fit in 32 bytes
80
+ bytes32 private constant CONFIG_MAX_INVOCATIONS_OVERRIDE =
81
+ "maxMintsPerAddrOverride"; // shortened to match format of previous key
82
+
83
+ uint256 constant ONE_MILLION = 1_000_000;
84
+
85
+ uint256 public constant DEFAULT_MAX_INVOCATIONS_PER_ADDRESS = 1;
86
+
87
+ struct ProjectConfig {
88
+ bool maxHasBeenInvoked;
89
+ bool priceIsConfigured;
90
+ // initial value is false, so by default, projects limit allowlisted
91
+ // addresses to a mint qty of `DEFAULT_MAX_INVOCATIONS_PER_ADDRESS`
92
+ bool useMaxInvocationsPerAddressOverride;
93
+ // a value of 0 means no limit
94
+ // (only used if `useMaxInvocationsPerAddressOverride` is true)
95
+ uint24 maxInvocationsPerAddressOverride;
96
+ uint24 maxInvocations;
97
+ uint256 pricePerTokenInWei;
98
+ }
99
+
100
+ mapping(uint256 => ProjectConfig) public projectConfig;
101
+
102
+ /// projectId => merkle root
103
+ mapping(uint256 => bytes32) public projectMerkleRoot;
104
+
105
+ /// projectId => purchaser address => qty of mints purchased for project
106
+ mapping(uint256 => mapping(address => uint256))
107
+ public projectUserMintInvocations;
108
+
109
+ modifier onlyArtist(uint256 _projectId) {
110
+ require(
111
+ msg.sender ==
112
+ genArtCoreContract.projectIdToArtistAddress(_projectId),
113
+ "Only Artist"
114
+ );
115
+ _;
116
+ }
117
+
118
+ /**
119
+ * @notice Initializes contract to be a Filtered Minter for
120
+ * `_minterFilter`, integrated with Art Blocks core contract
121
+ * at address `_genArt721Address`. Also configures the delegation
122
+ * registry address to be address `_delegationRegistryAddress`.
123
+ * @param _genArt721Address Art Blocks core contract address for
124
+ * which this contract will be a minter.
125
+ * @param _minterFilter Minter filter for which this will be a
126
+ * filtered minter.
127
+ * @param _delegationRegistryAddress Delegation registry contract address.
128
+ */
129
+ constructor(
130
+ address _genArt721Address,
131
+ address _minterFilter,
132
+ address _delegationRegistryAddress
133
+ ) ReentrancyGuard() {
134
+ genArt721CoreAddress = _genArt721Address;
135
+ genArtCoreContract = IGenArt721CoreContractV3(_genArt721Address);
136
+ delegationRegistryAddress = _delegationRegistryAddress;
137
+ emit DelegationRegistryUpdated(_delegationRegistryAddress);
138
+ delegationRegistryContract = IDelegationRegistry(
139
+ _delegationRegistryAddress
140
+ );
141
+ minterFilterAddress = _minterFilter;
142
+ minterFilter = IMinterFilterV0(_minterFilter);
143
+ require(
144
+ minterFilter.genArt721CoreAddress() == _genArt721Address,
145
+ "Illegal contract pairing"
146
+ );
147
+ // broadcast default max invocations per address for this minter
148
+ emit DefaultMaxInvocationsPerAddress(
149
+ DEFAULT_MAX_INVOCATIONS_PER_ADDRESS
150
+ );
151
+ }
152
+
153
+ /**
154
+ * @notice Update the Merkle root for project `_projectId`.
155
+ * @param _projectId Project ID to be updated.
156
+ * @param _root root of Merkle tree defining addresses allowed to mint
157
+ * on project `_projectId`.
158
+ */
159
+ function updateMerkleRoot(
160
+ uint256 _projectId,
161
+ bytes32 _root
162
+ ) external onlyArtist(_projectId) {
163
+ require(_root != bytes32(0), "Root must be provided");
164
+ projectMerkleRoot[_projectId] = _root;
165
+ emit ConfigValueSet(_projectId, CONFIG_MERKLE_ROOT, _root);
166
+ }
167
+
168
+ /**
169
+ * @notice Returns hashed address (to be used as merkle tree leaf).
170
+ * Included as a public function to enable users to calculate their hashed
171
+ * address in Solidity when generating proofs off-chain.
172
+ * @param _address address to be hashed
173
+ * @return bytes32 hashed address, via keccak256 (using encodePacked)
174
+ */
175
+ function hashAddress(address _address) public pure returns (bytes32) {
176
+ return keccak256(abi.encodePacked(_address));
177
+ }
178
+
179
+ /**
180
+ * @notice Verify if address is allowed to mint on project `_projectId`.
181
+ * @param _projectId Project ID to be checked.
182
+ * @param _proof Merkle proof for address.
183
+ * @param _address Address to check.
184
+ * @return inAllowlist true only if address is allowed to mint and valid
185
+ * Merkle proof was provided
186
+ */
187
+ function verifyAddress(
188
+ uint256 _projectId,
189
+ bytes32[] calldata _proof,
190
+ address _address
191
+ ) public view returns (bool) {
192
+ return
193
+ _proof.verifyCalldata(
194
+ projectMerkleRoot[_projectId],
195
+ hashAddress(_address)
196
+ );
197
+ }
198
+
199
+ /**
200
+ * @notice Sets maximum allowed invocations per allowlisted address for
201
+ * project `_project` to `limit`. If `limit` is set to 0, allowlisted
202
+ * addresses will be able to mint as many times as desired, until the
203
+ * project reaches its maximum invocations.
204
+ * Default is a value of 1 if never configured by artist.
205
+ * @param _projectId Project ID to toggle the mint limit.
206
+ * @param _maxInvocationsPerAddress Maximum allowed invocations per
207
+ * allowlisted address.
208
+ * @dev default value stated above must be updated if the value of
209
+ * CONFIG_USE_MAX_INVOCATIONS_PER_ADDRESS_OVERRIDE is changed.
210
+ */
211
+ function setProjectInvocationsPerAddress(
212
+ uint256 _projectId,
213
+ uint24 _maxInvocationsPerAddress
214
+ ) external onlyArtist(_projectId) {
215
+ ProjectConfig storage _projectConfig = projectConfig[_projectId];
216
+ // use override value instead of the contract's default
217
+ // @dev this never changes from true to false; default value is only
218
+ // used if artist has never configured project invocations per address
219
+ _projectConfig.useMaxInvocationsPerAddressOverride = true;
220
+ // update the override value
221
+ _projectConfig
222
+ .maxInvocationsPerAddressOverride = _maxInvocationsPerAddress;
223
+ // generic events
224
+ emit ConfigValueSet(
225
+ _projectId,
226
+ CONFIG_USE_MAX_INVOCATIONS_PER_ADDRESS_OVERRIDE,
227
+ true
228
+ );
229
+ emit ConfigValueSet(
230
+ _projectId,
231
+ CONFIG_MAX_INVOCATIONS_OVERRIDE,
232
+ uint256(_maxInvocationsPerAddress)
233
+ );
234
+ }
235
+
236
+ /**
237
+ * @notice Syncs local maximum invocations of project `_projectId` based on
238
+ * the value currently defined in the core contract.
239
+ * @param _projectId Project ID to set the maximum invocations for.
240
+ * @dev this enables gas reduction after maxInvocations have been reached -
241
+ * core contracts shall still enforce a maxInvocation check during mint.
242
+ */
243
+ function setProjectMaxInvocations(
244
+ uint256 _projectId
245
+ ) external onlyArtist(_projectId) {
246
+ uint256 maxInvocations;
247
+ uint256 invocations;
248
+ (invocations, maxInvocations, , , , ) = genArtCoreContract
249
+ .projectStateData(_projectId);
250
+ // update storage with results
251
+ projectConfig[_projectId].maxInvocations = uint24(maxInvocations);
252
+
253
+ // We need to ensure maxHasBeenInvoked is correctly set after manually syncing the
254
+ // local maxInvocations value with the core contract's maxInvocations value.
255
+ // This synced value of maxInvocations from the core contract will always be greater
256
+ // than or equal to the previous value of maxInvocations stored locally.
257
+ projectConfig[_projectId].maxHasBeenInvoked =
258
+ invocations == maxInvocations;
259
+
260
+ emit ProjectMaxInvocationsLimitUpdated(_projectId, maxInvocations);
261
+ }
262
+
263
+ /**
264
+ * @notice Manually sets the local maximum invocations of project `_projectId`
265
+ * with the provided `_maxInvocations`, checking that `_maxInvocations` is less
266
+ * than or equal to the value of project `_project_id`'s maximum invocations that is
267
+ * set on the core contract.
268
+ * @dev Note that a `_maxInvocations` of 0 can only be set if the current `invocations`
269
+ * value is also 0 and this would also set `maxHasBeenInvoked` to true, correctly short-circuiting
270
+ * this minter's purchase function, avoiding extra gas costs from the core contract's maxInvocations check.
271
+ * @param _projectId Project ID to set the maximum invocations for.
272
+ * @param _maxInvocations Maximum invocations to set for the project.
273
+ */
274
+ function manuallyLimitProjectMaxInvocations(
275
+ uint256 _projectId,
276
+ uint256 _maxInvocations
277
+ ) external onlyArtist(_projectId) {
278
+ // CHECKS
279
+ // ensure that the manually set maxInvocations is not greater than what is set on the core contract
280
+ uint256 maxInvocations;
281
+ uint256 invocations;
282
+ (invocations, maxInvocations, , , , ) = genArtCoreContract
283
+ .projectStateData(_projectId);
284
+ require(
285
+ _maxInvocations <= maxInvocations,
286
+ "Cannot increase project max invocations above core contract set project max invocations"
287
+ );
288
+ require(
289
+ _maxInvocations >= invocations,
290
+ "Cannot set project max invocations to less than current invocations"
291
+ );
292
+
293
+ // EFFECTS
294
+ // update storage with results
295
+ projectConfig[_projectId].maxInvocations = uint24(_maxInvocations);
296
+ // We need to ensure maxHasBeenInvoked is correctly set after manually setting the
297
+ // local maxInvocations value.
298
+ projectConfig[_projectId].maxHasBeenInvoked =
299
+ invocations == _maxInvocations;
300
+
301
+ emit ProjectMaxInvocationsLimitUpdated(_projectId, _maxInvocations);
302
+ }
303
+
304
+ /**
305
+ * @notice Warning: Disabling purchaseTo is not supported on this minter.
306
+ * This method exists purely for interface-conformance purposes.
307
+ */
308
+ function togglePurchaseToDisabled(
309
+ uint256 _projectId
310
+ ) external view onlyArtist(_projectId) {
311
+ revert("Action not supported");
312
+ }
313
+
314
+ /**
315
+ * @notice projectId => has project reached its maximum number of
316
+ * invocations? Note that this returns a local cache of the core contract's
317
+ * state, and may be out of sync with the core contract. This is
318
+ * intentional, as it only enables gas optimization of mints after a
319
+ * project's maximum invocations has been reached. A false negative will
320
+ * only result in a gas cost increase, since the core contract will still
321
+ * enforce a maxInvocation check during minting. A false positive is not
322
+ * possible because the V3 core contract only allows maximum invocations
323
+ * to be reduced, not increased. Based on this rationale, we intentionally
324
+ * do not do input validation in this method as to whether or not the input
325
+ * `_projectId` is an existing project ID.
326
+ */
327
+ function projectMaxHasBeenInvoked(
328
+ uint256 _projectId
329
+ ) external view returns (bool) {
330
+ return projectConfig[_projectId].maxHasBeenInvoked;
331
+ }
332
+
333
+ /**
334
+ * @notice projectId => project's maximum number of invocations.
335
+ * Optionally synced with core contract value, for gas optimization.
336
+ * Note that this returns a local cache of the core contract's
337
+ * state, and may be out of sync with the core contract. This is
338
+ * intentional, as it only enables gas optimization of mints after a
339
+ * project's maximum invocations has been reached.
340
+ * @dev A number greater than the core contract's project max invocations
341
+ * will only result in a gas cost increase, since the core contract will
342
+ * still enforce a maxInvocation check during minting. A number less than
343
+ * the core contract's project max invocations is only possible when the
344
+ * project's max invocations have not been synced on this minter, since the
345
+ * V3 core contract only allows maximum invocations to be reduced, not
346
+ * increased. When this happens, the minter will enable minting, allowing
347
+ * the core contract to enforce the max invocations check. Based on this
348
+ * rationale, we intentionally do not do input validation in this method as
349
+ * to whether or not the input `_projectId` is an existing project ID.
350
+ */
351
+ function projectMaxInvocations(
352
+ uint256 _projectId
353
+ ) external view returns (uint256) {
354
+ return uint256(projectConfig[_projectId].maxInvocations);
355
+ }
356
+
357
+ /**
358
+ * @notice Updates this minter's price per token of project `_projectId`
359
+ * to be '_pricePerTokenInWei`, in Wei.
360
+ * This price supersedes any legacy core contract price per token value.
361
+ * @dev Note that it is intentionally supported here that the configured
362
+ * price may be explicitly set to `0`.
363
+ */
364
+ function updatePricePerTokenInWei(
365
+ uint256 _projectId,
366
+ uint256 _pricePerTokenInWei
367
+ ) external onlyArtist(_projectId) {
368
+ projectConfig[_projectId].pricePerTokenInWei = _pricePerTokenInWei;
369
+ projectConfig[_projectId].priceIsConfigured = true;
370
+ emit PricePerTokenInWeiUpdated(_projectId, _pricePerTokenInWei);
371
+ }
372
+
373
+ /**
374
+ * @notice Inactive function - requires Merkle proof to purchase.
375
+ */
376
+ function purchase(uint256) external payable returns (uint256) {
377
+ revert("Must provide Merkle proof");
378
+ }
379
+
380
+ /**
381
+ * @notice Inactive function - requires Merkle proof to purchase.
382
+ */
383
+ function purchaseTo(address, uint256) public payable returns (uint256) {
384
+ revert("Must provide Merkle proof");
385
+ }
386
+
387
+ /**
388
+ * @notice Purchases a token from project `_projectId`.
389
+ * @param _projectId Project ID to mint a token on.
390
+ * @param _proof Merkle proof.
391
+ * @return tokenId Token ID of minted token
392
+ */
393
+ function purchase(
394
+ uint256 _projectId,
395
+ bytes32[] calldata _proof
396
+ ) external payable returns (uint256 tokenId) {
397
+ tokenId = purchaseTo_kem(msg.sender, _projectId, _proof, address(0));
398
+ return tokenId;
399
+ }
400
+
401
+ /**
402
+ * @notice gas-optimized version of purchase(uint256,bytes32[]).
403
+ */
404
+ function purchase_gD5(
405
+ uint256 _projectId,
406
+ bytes32[] calldata _proof
407
+ ) external payable returns (uint256 tokenId) {
408
+ tokenId = purchaseTo_kem(msg.sender, _projectId, _proof, address(0));
409
+ return tokenId;
410
+ }
411
+
412
+ /**
413
+ * @notice Purchases a token from project `_projectId` and sets
414
+ * the token's owner to `_to`.
415
+ * @param _to Address to be the new token's owner.
416
+ * @param _projectId Project ID to mint a token on.
417
+ * @param _proof Merkle proof.
418
+ * @return tokenId Token ID of minted token
419
+ */
420
+ function purchaseTo(
421
+ address _to,
422
+ uint256 _projectId,
423
+ bytes32[] calldata _proof
424
+ ) external payable returns (uint256 tokenId) {
425
+ return purchaseTo_kem(_to, _projectId, _proof, address(0));
426
+ }
427
+
428
+ /**
429
+ * @notice Purchases a token from project `_projectId` and sets
430
+ * the token's owner to `_to`, as a delegate, (the `msg.sender`)
431
+ * on behalf of an explicitly defined vault.
432
+ * @param _to Address to be the new token's owner.
433
+ * @param _projectId Project ID to mint a token on.
434
+ * @param _proof Merkle proof.
435
+ * @param _vault Vault being purchased on behalf of.
436
+ * @return tokenId Token ID of minted token
437
+ */
438
+ function purchaseTo(
439
+ address _to,
440
+ uint256 _projectId,
441
+ bytes32[] calldata _proof,
442
+ address _vault
443
+ ) external payable returns (uint256 tokenId) {
444
+ return purchaseTo_kem(_to, _projectId, _proof, _vault);
445
+ }
446
+
447
+ /**
448
+ * @notice gas-optimized version of
449
+ * purchaseTo(address,uint256,bytes32[],address).
450
+ * @param _to Address to be the new token's owner.
451
+ * @param _projectId Project ID to mint a token on.
452
+ * @param _proof Merkle proof. Must be a valid proof of either `msg.sender`
453
+ * if `_vault` is `address(0)`, or `_vault` if `_vault` is not `address(0)`.
454
+ * @param _vault Vault being purchased on behalf of. Acceptable to be
455
+ * address(0) if no vault.
456
+ */
457
+ function purchaseTo_kem(
458
+ address _to,
459
+ uint256 _projectId,
460
+ bytes32[] calldata _proof,
461
+ address _vault // acceptable to be `address(0)` if no vault
462
+ ) public payable nonReentrant returns (uint256 tokenId) {
463
+ // CHECKS
464
+ ProjectConfig storage _projectConfig = projectConfig[_projectId];
465
+
466
+ // Note that `maxHasBeenInvoked` is only checked here to reduce gas
467
+ // consumption after a project has been fully minted.
468
+ // `_projectConfig.maxHasBeenInvoked` is locally cached to reduce
469
+ // gas consumption, but if not in sync with the core contract's value,
470
+ // the core contract also enforces its own max invocation check during
471
+ // minting.
472
+ require(
473
+ !_projectConfig.maxHasBeenInvoked,
474
+ "Maximum number of invocations reached"
475
+ );
476
+
477
+ // load price of token into memory
478
+ uint256 _pricePerTokenInWei = _projectConfig.pricePerTokenInWei;
479
+
480
+ require(
481
+ msg.value >= _pricePerTokenInWei,
482
+ "Must send minimum value to mint!"
483
+ );
484
+
485
+ // require artist to have configured price of token on this minter
486
+ require(_projectConfig.priceIsConfigured, "Price not configured");
487
+
488
+ // no contract filter since Merkle tree controls allowed addresses
489
+
490
+ // NOTE: delegate-vault handling **begins here**.
491
+
492
+ // handle that the vault may be either the `msg.sender` in the case
493
+ // that there is not a true vault, or may be `_vault` if one is
494
+ // provided explicitly (and it is valid).
495
+ address vault = msg.sender;
496
+ if (_vault != address(0)) {
497
+ // If a vault is provided, it must be valid, otherwise throw rather
498
+ // than optimistically-minting with original `msg.sender`.
499
+ // Note, we do not check `checkDelegateForAll` as well, as it is known
500
+ // to be implicitly checked by calling `checkDelegateForContract`.
501
+ bool isValidDelegee = delegationRegistryContract
502
+ .checkDelegateForContract(
503
+ msg.sender, // delegate
504
+ _vault, // vault
505
+ genArt721CoreAddress // contract
506
+ );
507
+ require(isValidDelegee, "Invalid delegate-vault pairing");
508
+ vault = _vault;
509
+ }
510
+
511
+ // require valid Merkle proof
512
+ require(
513
+ verifyAddress(_projectId, _proof, vault),
514
+ "Invalid Merkle proof"
515
+ );
516
+
517
+ // limit mints per address by project
518
+ uint256 _maxProjectInvocationsPerAddress = _projectConfig
519
+ .useMaxInvocationsPerAddressOverride
520
+ ? _projectConfig.maxInvocationsPerAddressOverride
521
+ : DEFAULT_MAX_INVOCATIONS_PER_ADDRESS;
522
+
523
+ // note that mint limits index off of the `vault` (when applicable)
524
+ require(
525
+ projectUserMintInvocations[_projectId][vault] <
526
+ _maxProjectInvocationsPerAddress ||
527
+ _maxProjectInvocationsPerAddress == 0,
528
+ "Maximum number of invocations per address reached"
529
+ );
530
+
531
+ // EFFECTS
532
+ // increment user's invocations for this project
533
+ unchecked {
534
+ // this will never overflow since user's invocations on a project
535
+ // are limited by the project's max invocations
536
+ projectUserMintInvocations[_projectId][vault]++;
537
+ }
538
+
539
+ // mint token
540
+ tokenId = minterFilter.mint(_to, _projectId, vault);
541
+
542
+ // NOTE: delegate-vault handling **ends here**.
543
+
544
+ // okay if this underflows because if statement will always eval false.
545
+ // this is only for gas optimization (core enforces maxInvocations).
546
+ unchecked {
547
+ if (tokenId % ONE_MILLION == _projectConfig.maxInvocations - 1) {
548
+ _projectConfig.maxHasBeenInvoked = true;
549
+ }
550
+ }
551
+
552
+ // INTERACTIONS
553
+ _splitFundsETH(_projectId, _pricePerTokenInWei);
554
+
555
+ return tokenId;
556
+ }
557
+
558
+ /**
559
+ * @dev splits ETH funds between sender (if refund), foundation,
560
+ * artist, and artist's additional payee for a token purchased on
561
+ * project `_projectId`.
562
+ * @dev possible DoS during splits is acknowledged, and mitigated by
563
+ * business practices, including end-to-end testing on mainnet, and
564
+ * admin-accepted artist payment addresses.
565
+ */
566
+ function _splitFundsETH(
567
+ uint256 _projectId,
568
+ uint256 _pricePerTokenInWei
569
+ ) internal {
570
+ if (msg.value > 0) {
571
+ bool success_;
572
+ // send refund to sender
573
+ uint256 refund = msg.value - _pricePerTokenInWei;
574
+ if (refund > 0) {
575
+ (success_, ) = msg.sender.call{value: refund}("");
576
+ require(success_, "Refund failed");
577
+ }
578
+ // split remaining funds between foundation, artist, and artist's
579
+ // additional payee
580
+ (
581
+ uint256 artblocksRevenue_,
582
+ address payable artblocksAddress_,
583
+ uint256 artistRevenue_,
584
+ address payable artistAddress_,
585
+ uint256 additionalPayeePrimaryRevenue_,
586
+ address payable additionalPayeePrimaryAddress_
587
+ ) = genArtCoreContract.getPrimaryRevenueSplits(
588
+ _projectId,
589
+ _pricePerTokenInWei
590
+ );
591
+ // Art Blocks payment
592
+ if (artblocksRevenue_ > 0) {
593
+ (success_, ) = artblocksAddress_.call{value: artblocksRevenue_}(
594
+ ""
595
+ );
596
+ require(success_, "Art Blocks payment failed");
597
+ }
598
+ // artist payment
599
+ if (artistRevenue_ > 0) {
600
+ (success_, ) = artistAddress_.call{value: artistRevenue_}("");
601
+ require(success_, "Artist payment failed");
602
+ }
603
+ // additional payee payment
604
+ if (additionalPayeePrimaryRevenue_ > 0) {
605
+ (success_, ) = additionalPayeePrimaryAddress_.call{
606
+ value: additionalPayeePrimaryRevenue_
607
+ }("");
608
+ require(success_, "Additional Payee payment failed");
609
+ }
610
+ }
611
+ }
612
+
613
+ /**
614
+ * @notice projectId => maximum invocations per allowlisted address. If a
615
+ * a value of 0 is returned, there is no limit on the number of mints per
616
+ * allowlisted address.
617
+ * Default behavior is limit 1 mint per address.
618
+ * This value can be changed at any time by the artist.
619
+ * @dev default value stated above must be updated if the value of
620
+ * CONFIG_USE_MAX_INVOCATIONS_PER_ADDRESS_OVERRIDE is changed.
621
+ */
622
+ function projectMaxInvocationsPerAddress(
623
+ uint256 _projectId
624
+ ) public view returns (uint256) {
625
+ ProjectConfig storage _projectConfig = projectConfig[_projectId];
626
+ if (_projectConfig.useMaxInvocationsPerAddressOverride) {
627
+ return uint256(_projectConfig.maxInvocationsPerAddressOverride);
628
+ } else {
629
+ return DEFAULT_MAX_INVOCATIONS_PER_ADDRESS;
630
+ }
631
+ }
632
+
633
+ /**
634
+ * @notice Returns remaining invocations for a given address.
635
+ * If `projectLimitsMintInvocationsPerAddress` is false, individual
636
+ * addresses are only limited by the project's maximum invocations, and a
637
+ * dummy value of zero is returned for `mintInvocationsRemaining`.
638
+ * If `projectLimitsMintInvocationsPerAddress` is true, the quantity of
639
+ * remaining mint invocations for address `_address` is returned as
640
+ * `mintInvocationsRemaining`.
641
+ * Note that mint invocations per address can be changed at any time by the
642
+ * artist of a project.
643
+ * Also note that all mint invocations are limited by a project's maximum
644
+ * invocations as defined on the core contract. This function may return
645
+ * a value greater than the project's remaining invocations.
646
+ */
647
+ function projectRemainingInvocationsForAddress(
648
+ uint256 _projectId,
649
+ address _address
650
+ )
651
+ external
652
+ view
653
+ returns (
654
+ bool projectLimitsMintInvocationsPerAddress,
655
+ uint256 mintInvocationsRemaining
656
+ )
657
+ {
658
+ uint256 maxInvocationsPerAddress = projectMaxInvocationsPerAddress(
659
+ _projectId
660
+ );
661
+ if (maxInvocationsPerAddress == 0) {
662
+ // project does not limit mint invocations per address, so leave
663
+ // `projectLimitsMintInvocationsPerAddress` at solidity initial
664
+ // value of false. Also leave `mintInvocationsRemaining` at
665
+ // solidity initial value of zero, as indicated in this function's
666
+ // documentation.
667
+ } else {
668
+ projectLimitsMintInvocationsPerAddress = true;
669
+ uint256 userMintInvocations = projectUserMintInvocations[
670
+ _projectId
671
+ ][_address];
672
+ // if user has not reached max invocations per address, return
673
+ // remaining invocations
674
+ if (maxInvocationsPerAddress > userMintInvocations) {
675
+ unchecked {
676
+ // will never underflow due to the check above
677
+ mintInvocationsRemaining =
678
+ maxInvocationsPerAddress -
679
+ userMintInvocations;
680
+ }
681
+ }
682
+ // else user has reached their maximum invocations, so leave
683
+ // `mintInvocationsRemaining` at solidity initial value of zero
684
+ }
685
+ }
686
+
687
+ /**
688
+ * @notice Process proof for an address. Returns Merkle root. Included to
689
+ * enable users to easily verify a proof's validity.
690
+ * @param _proof Merkle proof for address.
691
+ * @param _address Address to process.
692
+ * @return merkleRoot Merkle root for `_address` and `_proof`
693
+ */
694
+ function processProofForAddress(
695
+ bytes32[] calldata _proof,
696
+ address _address
697
+ ) external pure returns (bytes32) {
698
+ return _proof.processProofCalldata(hashAddress(_address));
699
+ }
700
+
701
+ /**
702
+ * @notice Gets if price of token is configured, price of minting a
703
+ * token on project `_projectId`, and currency symbol and address to be
704
+ * used as payment. Supersedes any core contract price information.
705
+ * @param _projectId Project ID to get price information for.
706
+ * @return isConfigured true only if token price has been configured on
707
+ * this minter
708
+ * @return tokenPriceInWei current price of token on this minter - invalid
709
+ * if price has not yet been configured
710
+ * @return currencySymbol currency symbol for purchases of project on this
711
+ * minter. This minter always returns "ETH"
712
+ * @return currencyAddress currency address for purchases of project on
713
+ * this minter. This minter always returns null address, reserved for ether
714
+ */
715
+ function getPriceInfo(
716
+ uint256 _projectId
717
+ )
718
+ external
719
+ view
720
+ returns (
721
+ bool isConfigured,
722
+ uint256 tokenPriceInWei,
723
+ string memory currencySymbol,
724
+ address currencyAddress
725
+ )
726
+ {
727
+ ProjectConfig storage _projectConfig = projectConfig[_projectId];
728
+ isConfigured = _projectConfig.priceIsConfigured;
729
+ tokenPriceInWei = _projectConfig.pricePerTokenInWei;
730
+ currencySymbol = "ETH";
731
+ currencyAddress = address(0);
732
+ }
733
+ }