@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,576 @@
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/IFilteredMinterDALinV1.sol";
7
+
8
+ import "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
9
+ import "@openzeppelin-4.5/contracts/utils/math/SafeCast.sol";
10
+
11
+ pragma solidity 0.8.17;
12
+
13
+ /**
14
+ * @title Filtered Minter contract that allows tokens to be minted with ETH.
15
+ * Pricing is achieved using an automated Dutch-auction mechanism.
16
+ * This is designed to be used with IGenArt721CoreContractV3 contracts.
17
+ * @author Art Blocks Inc.
18
+ * @notice Privileged Roles and Ownership:
19
+ * This contract is designed to be managed, with limited powers.
20
+ * Privileged roles and abilities are controlled by the core contract's Admin
21
+ * ACL contract and a project's artist. Both of these roles hold extensive
22
+ * power and can modify minter details.
23
+ * Care must be taken to ensure that the admin ACL contract and artist
24
+ * addresses are secure behind a multi-sig or other access control mechanism.
25
+ * ----------------------------------------------------------------------------
26
+ * The following functions are restricted to the core contract's Admin ACL
27
+ * contract:
28
+ * - setMinimumAuctionLengthSeconds (note: this is only enforced when creating
29
+ * new auctions)
30
+ * - resetAuctionDetails (note: this will prevent minting until a new auction
31
+ * is created)
32
+ * ----------------------------------------------------------------------------
33
+ * The following functions are restricted to a project's artist:
34
+ * - setAuctionDetails (note: this may only be called when there is no active
35
+ * auction)
36
+ * - setProjectMaxInvocations
37
+ * - manuallyLimitProjectMaxInvocations
38
+ * ----------------------------------------------------------------------------
39
+ * Additional admin and artist privileged roles may be described on other
40
+ * contracts that this minter integrates with.
41
+ *
42
+ * @dev Note that while this minter makes use of `block.timestamp` and it is
43
+ * technically possible that this value is manipulated by block producers, such
44
+ * manipulation will not have material impact on the price values of this minter
45
+ * given the business practices for how pricing is congfigured for this minter
46
+ * and that variations on the order of less than a minute should not
47
+ * meaningfully impact price given the minimum allowable price decay rate that
48
+ * this minter intends to support.
49
+ */
50
+ contract MinterDALinV3 is ReentrancyGuard, IFilteredMinterDALinV1 {
51
+ using SafeCast for uint256;
52
+
53
+ /// Core contract address this minter interacts with
54
+ address public immutable genArt721CoreAddress;
55
+
56
+ /// This contract handles cores with interface IV
57
+ IGenArt721CoreContractV3 private immutable genArtCoreContract;
58
+
59
+ /// Minter filter address this minter interacts with
60
+ address public immutable minterFilterAddress;
61
+
62
+ /// Minter filter this minter may interact with.
63
+ IMinterFilterV0 private immutable minterFilter;
64
+
65
+ /// minterType for this minter
66
+ string public constant minterType = "MinterDALinV3";
67
+
68
+ uint256 constant ONE_MILLION = 1_000_000;
69
+
70
+ struct ProjectConfig {
71
+ bool maxHasBeenInvoked;
72
+ uint24 maxInvocations;
73
+ // max uint64 ~= 1.8e19 sec ~= 570 billion years
74
+ uint64 timestampStart;
75
+ uint64 timestampEnd;
76
+ uint256 startPrice;
77
+ uint256 basePrice;
78
+ }
79
+
80
+ mapping(uint256 => ProjectConfig) public projectConfig;
81
+
82
+ /// Minimum auction length in seconds
83
+ uint256 public minimumAuctionLengthSeconds = 3600;
84
+
85
+ // modifier to restrict access to only AdminACL allowed calls
86
+ // @dev defers which ACL contract is used to the core contract
87
+ modifier onlyCoreAdminACL(bytes4 _selector) {
88
+ require(
89
+ genArtCoreContract.adminACLAllowed(
90
+ msg.sender,
91
+ address(this),
92
+ _selector
93
+ ),
94
+ "Only Core AdminACL allowed"
95
+ );
96
+ _;
97
+ }
98
+
99
+ modifier onlyArtist(uint256 _projectId) {
100
+ require(
101
+ (msg.sender ==
102
+ genArtCoreContract.projectIdToArtistAddress(_projectId)),
103
+ "Only Artist"
104
+ );
105
+ _;
106
+ }
107
+
108
+ /**
109
+ * @notice Initializes contract to be a Filtered Minter for
110
+ * `_minterFilter`, integrated with Art Blocks core contract
111
+ * at address `_genArt721Address`.
112
+ * @param _genArt721Address Art Blocks core contract address for
113
+ * which this contract will be a minter.
114
+ * @param _minterFilter Minter filter for which
115
+ * this will a filtered minter.
116
+ */
117
+ constructor(
118
+ address _genArt721Address,
119
+ address _minterFilter
120
+ ) ReentrancyGuard() {
121
+ genArt721CoreAddress = _genArt721Address;
122
+ genArtCoreContract = IGenArt721CoreContractV3(_genArt721Address);
123
+ minterFilterAddress = _minterFilter;
124
+ minterFilter = IMinterFilterV0(_minterFilter);
125
+ require(
126
+ minterFilter.genArt721CoreAddress() == _genArt721Address,
127
+ "Illegal contract pairing"
128
+ );
129
+ }
130
+
131
+ /**
132
+ * @notice Syncs local maximum invocations of project `_projectId` based on
133
+ * the value currently defined in the core contract.
134
+ * @param _projectId Project ID to set the maximum invocations for.
135
+ * @dev this enables gas reduction after maxInvocations have been reached -
136
+ * core contracts shall still enforce a maxInvocation check during mint.
137
+ */
138
+ function setProjectMaxInvocations(
139
+ uint256 _projectId
140
+ ) external onlyArtist(_projectId) {
141
+ uint256 maxInvocations;
142
+ uint256 invocations;
143
+ (invocations, maxInvocations, , , , ) = genArtCoreContract
144
+ .projectStateData(_projectId);
145
+ // update storage with results
146
+ projectConfig[_projectId].maxInvocations = uint24(maxInvocations);
147
+
148
+ // We need to ensure maxHasBeenInvoked is correctly set after manually syncing the
149
+ // local maxInvocations value with the core contract's maxInvocations value.
150
+ // This synced value of maxInvocations from the core contract will always be greater
151
+ // than or equal to the previous value of maxInvocations stored locally.
152
+ projectConfig[_projectId].maxHasBeenInvoked =
153
+ invocations == maxInvocations;
154
+
155
+ emit ProjectMaxInvocationsLimitUpdated(_projectId, maxInvocations);
156
+ }
157
+
158
+ /**
159
+ * @notice Manually sets the local maximum invocations of project `_projectId`
160
+ * with the provided `_maxInvocations`, checking that `_maxInvocations` is less
161
+ * than or equal to the value of project `_project_id`'s maximum invocations that is
162
+ * set on the core contract.
163
+ * @dev Note that a `_maxInvocations` of 0 can only be set if the current `invocations`
164
+ * value is also 0 and this would also set `maxHasBeenInvoked` to true, correctly short-circuiting
165
+ * this minter's purchase function, avoiding extra gas costs from the core contract's maxInvocations check.
166
+ * @param _projectId Project ID to set the maximum invocations for.
167
+ * @param _maxInvocations Maximum invocations to set for the project.
168
+ */
169
+ function manuallyLimitProjectMaxInvocations(
170
+ uint256 _projectId,
171
+ uint256 _maxInvocations
172
+ ) external onlyArtist(_projectId) {
173
+ // CHECKS
174
+ // ensure that the manually set maxInvocations is not greater than what is set on the core contract
175
+ uint256 maxInvocations;
176
+ uint256 invocations;
177
+ (invocations, maxInvocations, , , , ) = genArtCoreContract
178
+ .projectStateData(_projectId);
179
+ require(
180
+ _maxInvocations <= maxInvocations,
181
+ "Cannot increase project max invocations above core contract set project max invocations"
182
+ );
183
+ require(
184
+ _maxInvocations >= invocations,
185
+ "Cannot set project max invocations to less than current invocations"
186
+ );
187
+
188
+ // EFFECTS
189
+ // update storage with results
190
+ projectConfig[_projectId].maxInvocations = uint24(_maxInvocations);
191
+ projectConfig[_projectId].maxHasBeenInvoked =
192
+ invocations == _maxInvocations;
193
+
194
+ emit ProjectMaxInvocationsLimitUpdated(_projectId, _maxInvocations);
195
+ }
196
+
197
+ /**
198
+ * @notice Warning: Disabling purchaseTo is not supported on this minter.
199
+ * This method exists purely for interface-conformance purposes.
200
+ */
201
+ function togglePurchaseToDisabled(
202
+ uint256 _projectId
203
+ ) external view onlyArtist(_projectId) {
204
+ revert("Action not supported");
205
+ }
206
+
207
+ /**
208
+ * @notice projectId => has project reached its maximum number of
209
+ * invocations? Note that this returns a local cache of the core contract's
210
+ * state, and may be out of sync with the core contract. This is
211
+ * intentional, as it only enables gas optimization of mints after a
212
+ * project's maximum invocations has been reached. A false negative will
213
+ * only result in a gas cost increase, since the core contract will still
214
+ * enforce a maxInvocation check during minting. A false positive is not
215
+ * possible because the V3 core contract only allows maximum invocations
216
+ * to be reduced, not increased. Based on this rationale, we intentionally
217
+ * do not do input validation in this method as to whether or not the input
218
+ * `_projectId` is an existing project ID.
219
+ */
220
+ function projectMaxHasBeenInvoked(
221
+ uint256 _projectId
222
+ ) external view returns (bool) {
223
+ return projectConfig[_projectId].maxHasBeenInvoked;
224
+ }
225
+
226
+ /**
227
+ * @notice projectId => project's maximum number of invocations.
228
+ * Optionally synced with core contract value, for gas optimization.
229
+ * Note that this returns a local cache of the core contract's
230
+ * state, and may be out of sync with the core contract. This is
231
+ * intentional, as it only enables gas optimization of mints after a
232
+ * project's maximum invocations has been reached.
233
+ * @dev A number greater than the core contract's project max invocations
234
+ * will only result in a gas cost increase, since the core contract will
235
+ * still enforce a maxInvocation check during minting. A number less than
236
+ * the core contract's project max invocations is only possible when the
237
+ * project's max invocations have not been synced on this minter, since the
238
+ * V3 core contract only allows maximum invocations to be reduced, not
239
+ * increased. When this happens, the minter will enable minting, allowing
240
+ * the core contract to enforce the max invocations check. Based on this
241
+ * rationale, we intentionally do not do input validation in this method as
242
+ * to whether or not the input `_projectId` is an existing project ID.
243
+ */
244
+ function projectMaxInvocations(
245
+ uint256 _projectId
246
+ ) external view returns (uint256) {
247
+ return uint256(projectConfig[_projectId].maxInvocations);
248
+ }
249
+
250
+ /**
251
+ * @notice projectId => auction parameters
252
+ */
253
+ function projectAuctionParameters(
254
+ uint256 _projectId
255
+ )
256
+ external
257
+ view
258
+ returns (
259
+ uint256 timestampStart,
260
+ uint256 timestampEnd,
261
+ uint256 startPrice,
262
+ uint256 basePrice
263
+ )
264
+ {
265
+ ProjectConfig storage _projectConfig = projectConfig[_projectId];
266
+ return (
267
+ _projectConfig.timestampStart,
268
+ _projectConfig.timestampEnd,
269
+ _projectConfig.startPrice,
270
+ _projectConfig.basePrice
271
+ );
272
+ }
273
+
274
+ /**
275
+ * @notice Sets minimum auction length to `_minimumAuctionLengthSeconds`
276
+ * for all projects.
277
+ * @param _minimumAuctionLengthSeconds Minimum auction length in seconds.
278
+ */
279
+ function setMinimumAuctionLengthSeconds(
280
+ uint256 _minimumAuctionLengthSeconds
281
+ ) external onlyCoreAdminACL(this.setMinimumAuctionLengthSeconds.selector) {
282
+ minimumAuctionLengthSeconds = _minimumAuctionLengthSeconds;
283
+ emit MinimumAuctionLengthSecondsUpdated(_minimumAuctionLengthSeconds);
284
+ }
285
+
286
+ ////// Auction Functions
287
+ /**
288
+ * @notice Sets auction details for project `_projectId`.
289
+ * @param _projectId Project ID to set auction details for.
290
+ * @param _auctionTimestampStart Timestamp at which to start the auction.
291
+ * @param _auctionTimestampEnd Timestamp at which to end the auction.
292
+ * @param _startPrice Price at which to start the auction, in Wei.
293
+ * @param _basePrice Resting price of the auction, in Wei.
294
+ * @dev Note that it is intentionally supported here that the configured
295
+ * price may be explicitly set to `0`.
296
+ */
297
+ function setAuctionDetails(
298
+ uint256 _projectId,
299
+ uint256 _auctionTimestampStart,
300
+ uint256 _auctionTimestampEnd,
301
+ uint256 _startPrice,
302
+ uint256 _basePrice
303
+ ) external onlyArtist(_projectId) {
304
+ // CHECKS
305
+ ProjectConfig storage _projectConfig = projectConfig[_projectId];
306
+ require(
307
+ _projectConfig.timestampStart == 0 ||
308
+ block.timestamp < _projectConfig.timestampStart,
309
+ "No modifications mid-auction"
310
+ );
311
+ require(
312
+ block.timestamp < _auctionTimestampStart,
313
+ "Only future auctions"
314
+ );
315
+ require(
316
+ _auctionTimestampEnd > _auctionTimestampStart,
317
+ "Auction end must be greater than auction start"
318
+ );
319
+ require(
320
+ _auctionTimestampEnd >=
321
+ _auctionTimestampStart + minimumAuctionLengthSeconds,
322
+ "Auction length must be at least minimumAuctionLengthSeconds"
323
+ );
324
+ require(
325
+ _startPrice > _basePrice,
326
+ "Auction start price must be greater than auction end price"
327
+ );
328
+ // EFFECTS
329
+ _projectConfig.timestampStart = _auctionTimestampStart.toUint64();
330
+ _projectConfig.timestampEnd = _auctionTimestampEnd.toUint64();
331
+ _projectConfig.startPrice = _startPrice;
332
+ _projectConfig.basePrice = _basePrice;
333
+ emit SetAuctionDetails(
334
+ _projectId,
335
+ _auctionTimestampStart,
336
+ _auctionTimestampEnd,
337
+ _startPrice,
338
+ _basePrice
339
+ );
340
+ }
341
+
342
+ /**
343
+ * @notice Resets auction details for project `_projectId`, zero-ing out all
344
+ * relevant auction fields. Not intended to be used in normal auction
345
+ * operation, but rather only in case of the need to halt an auction.
346
+ * @param _projectId Project ID to set auction details for.
347
+ */
348
+ function resetAuctionDetails(
349
+ uint256 _projectId
350
+ ) external onlyCoreAdminACL(this.resetAuctionDetails.selector) {
351
+ ProjectConfig storage _projectConfig = projectConfig[_projectId];
352
+ // reset to initial values
353
+ _projectConfig.timestampStart = 0;
354
+ _projectConfig.timestampEnd = 0;
355
+ _projectConfig.startPrice = 0;
356
+ _projectConfig.basePrice = 0;
357
+
358
+ emit ResetAuctionDetails(_projectId);
359
+ }
360
+
361
+ /**
362
+ * @notice Purchases a token from project `_projectId`.
363
+ * @param _projectId Project ID to mint a token on.
364
+ * @return tokenId Token ID of minted token
365
+ */
366
+ function purchase(
367
+ uint256 _projectId
368
+ ) external payable returns (uint256 tokenId) {
369
+ tokenId = purchaseTo_do6(msg.sender, _projectId);
370
+ return tokenId;
371
+ }
372
+
373
+ /**
374
+ * @notice gas-optimized version of purchase(uint256).
375
+ */
376
+ function purchase_H4M(
377
+ uint256 _projectId
378
+ ) external payable returns (uint256 tokenId) {
379
+ tokenId = purchaseTo_do6(msg.sender, _projectId);
380
+ return tokenId;
381
+ }
382
+
383
+ /**
384
+ * @notice Purchases a token from project `_projectId` and sets
385
+ * the token's owner to `_to`.
386
+ * @param _to Address to be the new token's owner.
387
+ * @param _projectId Project ID to mint a token on.
388
+ * @return tokenId Token ID of minted token
389
+ */
390
+ function purchaseTo(
391
+ address _to,
392
+ uint256 _projectId
393
+ ) external payable returns (uint256 tokenId) {
394
+ return purchaseTo_do6(_to, _projectId);
395
+ }
396
+
397
+ /**
398
+ * @notice gas-optimized version of purchaseTo(address, uint256).
399
+ */
400
+ function purchaseTo_do6(
401
+ address _to,
402
+ uint256 _projectId
403
+ ) public payable nonReentrant returns (uint256 tokenId) {
404
+ // CHECKS
405
+ ProjectConfig storage _projectConfig = projectConfig[_projectId];
406
+
407
+ // Note that `maxHasBeenInvoked` is only checked here to reduce gas
408
+ // consumption after a project has been fully minted.
409
+ // `_projectConfig.maxHasBeenInvoked` is locally cached to reduce
410
+ // gas consumption, but if not in sync with the core contract's value,
411
+ // the core contract also enforces its own max invocation check during
412
+ // minting.
413
+ require(
414
+ !_projectConfig.maxHasBeenInvoked,
415
+ "Maximum number of invocations reached"
416
+ );
417
+
418
+ // _getPrice reverts if auction is unconfigured or has not started
419
+ uint256 currentPriceInWei = _getPrice(_projectId);
420
+ require(
421
+ msg.value >= currentPriceInWei,
422
+ "Must send minimum value to mint!"
423
+ );
424
+
425
+ // EFFECTS
426
+ tokenId = minterFilter.mint(_to, _projectId, msg.sender);
427
+
428
+ // okay if this underflows because if statement will always eval false.
429
+ // this is only for gas optimization (core enforces maxInvocations).
430
+ unchecked {
431
+ if (tokenId % ONE_MILLION == _projectConfig.maxInvocations - 1) {
432
+ _projectConfig.maxHasBeenInvoked = true;
433
+ }
434
+ }
435
+
436
+ // INTERACTIONS
437
+ _splitFundsETHAuction(_projectId, currentPriceInWei);
438
+
439
+ return tokenId;
440
+ }
441
+
442
+ /**
443
+ * @dev splits ETH funds between sender (if refund), foundation,
444
+ * artist, and artist's additional payee for a token purchased on
445
+ * project `_projectId`.
446
+ * @dev possible DoS during splits is acknowledged, and mitigated by
447
+ * business practices, including end-to-end testing on mainnet, and
448
+ * admin-accepted artist payment addresses.
449
+ * @param _projectId Project ID for which funds shall be split.
450
+ * @param _currentPriceInWei Current price of token, in Wei.
451
+ */
452
+ function _splitFundsETHAuction(
453
+ uint256 _projectId,
454
+ uint256 _currentPriceInWei
455
+ ) internal {
456
+ if (msg.value > 0) {
457
+ bool success_;
458
+ // send refund to sender
459
+ uint256 refund = msg.value - _currentPriceInWei;
460
+ if (refund > 0) {
461
+ (success_, ) = msg.sender.call{value: refund}("");
462
+ require(success_, "Refund failed");
463
+ }
464
+ // split remaining funds between foundation, artist, and artist's
465
+ // additional payee
466
+ (
467
+ uint256 artblocksRevenue_,
468
+ address payable artblocksAddress_,
469
+ uint256 artistRevenue_,
470
+ address payable artistAddress_,
471
+ uint256 additionalPayeePrimaryRevenue_,
472
+ address payable additionalPayeePrimaryAddress_
473
+ ) = genArtCoreContract.getPrimaryRevenueSplits(
474
+ _projectId,
475
+ _currentPriceInWei
476
+ );
477
+ // Art Blocks payment
478
+ if (artblocksRevenue_ > 0) {
479
+ (success_, ) = artblocksAddress_.call{value: artblocksRevenue_}(
480
+ ""
481
+ );
482
+ require(success_, "Art Blocks payment failed");
483
+ }
484
+ // artist payment
485
+ if (artistRevenue_ > 0) {
486
+ (success_, ) = artistAddress_.call{value: artistRevenue_}("");
487
+ require(success_, "Artist payment failed");
488
+ }
489
+ // additional payee payment
490
+ if (additionalPayeePrimaryRevenue_ > 0) {
491
+ (success_, ) = additionalPayeePrimaryAddress_.call{
492
+ value: additionalPayeePrimaryRevenue_
493
+ }("");
494
+ require(success_, "Additional Payee payment failed");
495
+ }
496
+ }
497
+ }
498
+
499
+ /**
500
+ * @notice Gets price of minting a token on project `_projectId` given
501
+ * the project's AuctionParameters and current block timestamp.
502
+ * Reverts if auction has not yet started or auction is unconfigured.
503
+ * @param _projectId Project ID to get price of token for.
504
+ * @return current price of token in Wei
505
+ */
506
+ function _getPrice(uint256 _projectId) private view returns (uint256) {
507
+ ProjectConfig storage _projectConfig = projectConfig[_projectId];
508
+ // move parameters to memory if used more than once
509
+ uint256 _timestampStart = uint256(_projectConfig.timestampStart);
510
+ uint256 _timestampEnd = uint256(_projectConfig.timestampEnd);
511
+ uint256 _startPrice = _projectConfig.startPrice;
512
+ uint256 _basePrice = _projectConfig.basePrice;
513
+
514
+ require(block.timestamp > _timestampStart, "Auction not yet started");
515
+ if (block.timestamp >= _timestampEnd) {
516
+ require(_timestampEnd > 0, "Only configured auctions");
517
+ return _basePrice;
518
+ }
519
+ uint256 elapsedTime;
520
+ uint256 duration;
521
+ uint256 startToEndDiff;
522
+ unchecked {
523
+ // already checked that block.timestamp > _timestampStart
524
+ elapsedTime = block.timestamp - _timestampStart;
525
+ // _timestampEnd > _timestampStart enforced during assignment
526
+ duration = _timestampEnd - _timestampStart;
527
+ // _startPrice > _basePrice enforced during assignment
528
+ startToEndDiff = _startPrice - _basePrice;
529
+ }
530
+ return _startPrice - ((elapsedTime * startToEndDiff) / duration);
531
+ }
532
+
533
+ /**
534
+ * @notice Gets if price of token is configured, price of minting a
535
+ * token on project `_projectId`, and currency symbol and address to be
536
+ * used as payment. Supersedes any core contract price information.
537
+ * @param _projectId Project ID to get price information for.
538
+ * @return isConfigured true only if project's auction parameters have been
539
+ * configured on this minter
540
+ * @return tokenPriceInWei current price of token on this minter - invalid
541
+ * if auction has not yet been configured
542
+ * @return currencySymbol currency symbol for purchases of project on this
543
+ * minter. This minter always returns "ETH"
544
+ * @return currencyAddress currency address for purchases of project on
545
+ * this minter. This minter always returns null address, reserved for ether
546
+ */
547
+ function getPriceInfo(
548
+ uint256 _projectId
549
+ )
550
+ external
551
+ view
552
+ returns (
553
+ bool isConfigured,
554
+ uint256 tokenPriceInWei,
555
+ string memory currencySymbol,
556
+ address currencyAddress
557
+ )
558
+ {
559
+ ProjectConfig storage _projectConfig = projectConfig[_projectId];
560
+
561
+ isConfigured = (_projectConfig.startPrice > 0);
562
+ if (block.timestamp <= _projectConfig.timestampStart) {
563
+ // Provide a reasonable value for `tokenPriceInWei` when it would
564
+ // otherwise revert, using the starting price before auction starts.
565
+ tokenPriceInWei = _projectConfig.startPrice;
566
+ } else if (_projectConfig.timestampEnd == 0) {
567
+ // In the case of unconfigured auction, return price of zero when
568
+ // it would otherwise revert
569
+ tokenPriceInWei = 0;
570
+ } else {
571
+ tokenPriceInWei = _getPrice(_projectId);
572
+ }
573
+ currencySymbol = "ETH";
574
+ currencyAddress = address(0);
575
+ }
576
+ }