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