@artblocks/contracts 1.0.4 → 1.2.0

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 (289) hide show
  1. package/README.md +75 -7
  2. package/artifacts/contracts/AdminACLV0.sol/AdminACLV0.json +2 -2
  3. package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
  4. package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +336 -131
  5. package/artifacts/contracts/archive/GenArt721CoreV3.sol/GenArt721CoreV3.json +2047 -0
  6. package/artifacts/contracts/archive/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +2021 -0
  7. package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterBase_v0_1_1.sol/MinterBase.json +1 -1
  8. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol/MinterDAExpV2.json +2 -2
  9. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol/MinterDAExpV3.json +2 -2
  10. package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterDAExp}/MinterDAExpV4.sol/MinterDAExpV4.json +3 -3
  11. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol/MinterDAExpSettlementV0.json +2 -2
  12. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV1.sol/MinterDAExpSettlementV1.json +2 -2
  13. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +1109 -0
  14. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV2.sol/MinterDALinV2.json +2 -2
  15. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV3.sol/MinterDALinV3.json +2 -2
  16. package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterDALin}/MinterDALinV4.sol/MinterDALinV4.json +3 -3
  17. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV1.sol/MinterHolderV1.json +2 -2
  18. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +2 -2
  19. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV3.sol/MinterHolderV3.json +2 -2
  20. package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterHolder}/MinterHolderV4.sol/MinterHolderV4.json +3 -3
  21. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV1.sol/MinterMerkleV1.json +2 -2
  22. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV2.sol/MinterMerkleV2.json +2 -2
  23. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol/MinterMerkleV3.json +2 -2
  24. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol/MinterMerkleV4.json +2 -2
  25. package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterMerkle}/MinterMerkleV5.sol/MinterMerkleV5.json +3 -3
  26. package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterPolyptych}/MinterPolyptychV0.sol/IGenArt721CoreContractV3WithRandomizer.json +31 -63
  27. package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterPolyptych}/MinterPolyptychV0.sol/MinterPolyptychV0.json +3 -3
  28. package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterSEA}/MinterSEAV0.sol/MinterSEAV0.json +3 -3
  29. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol/MinterSetPriceV2.json +2 -2
  30. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol/MinterSetPriceV3.json +2 -2
  31. package/artifacts/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterSetPrice}/MinterSetPriceV4.sol/MinterSetPriceV4.json +3 -3
  32. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V0.sol/MinterSetPriceERC20V0.json +65 -2
  33. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V1.sol/MinterSetPriceERC20V1.json +65 -2
  34. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol/MinterSetPriceERC20V2.json +2 -2
  35. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol/MinterSetPriceERC20V3.json +2 -2
  36. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V4.sol/MinterSetPriceERC20V4.json +807 -0
  37. package/artifacts/contracts/engine/V2/GenArt721MinterBurner_PBAB.sol/GenArt721MinterBurner_PBAB.json +65 -2
  38. package/artifacts/contracts/engine/V2/GenArt721Minter_PBAB.sol/GenArt721Minter_PBAB.json +65 -2
  39. package/artifacts/contracts/engine/V3/EngineFactoryV0.sol/EngineFactoryV0.json +606 -0
  40. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +565 -209
  41. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +785 -227
  42. package/artifacts/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol/GenArt721CoreV3_Engine_Flex_PROOF.json +40 -15
  43. package/artifacts/contracts/engine/V3/forks/PROHIBITION/AdminACLV0_PROHIBITION.sol/AdminACLV0_PROHIBITION.json +2 -2
  44. package/artifacts/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol/GenArt721CoreV3_Engine_Flex_PROHIBITION.json +40 -15
  45. package/artifacts/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.json +36 -68
  46. package/artifacts/contracts/engine-registry/CoreRegistryV1.sol/CoreRegistryV1.json +12 -12
  47. package/artifacts/contracts/interfaces/v0.8.x/IAdminACLV0_Extended.sol/IAdminACLV0_Extended.json +140 -0
  48. package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReaderV2.sol/IBytecodeStorageReaderV2.json +130 -0
  49. package/artifacts/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol/ICoreRegistryV1.json +6 -6
  50. package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +71 -39
  51. package/artifacts/contracts/interfaces/v0.8.x/IEngineFactoryV0.sol/IEngineFactoryV0.json +283 -0
  52. package/artifacts/contracts/interfaces/v0.8.x/IFilteredMinterDAExpSettlementV0.sol/IFilteredMinterDAExpSettlementV0.json +12 -12
  53. package/artifacts/contracts/interfaces/v0.8.x/IFilteredMinterDAExpSettlementV1.sol/IFilteredMinterDAExpSettlementV1.json +12 -12
  54. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3.sol/IGenArt721CoreContractV3.json +30 -62
  55. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol/IGenArt721CoreContractV3_Base.json +30 -62
  56. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol/IGenArt721CoreContractV3_Engine.json +170 -104
  57. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol/IGenArt721CoreContractV3_Engine_Flex.json +170 -104
  58. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.sol/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.json +1028 -0
  59. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_PreV3p2.sol/IGenArt721CoreContractV3_Engine_PreV3p2.json +741 -0
  60. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_ProjectFinance.sol/IGenArt721CoreContractV3_ProjectFinance.json +87 -0
  61. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721Minter_PBAB.sol/IGenArt721Minter_PBAB.json +279 -0
  62. package/artifacts/contracts/interfaces/v0.8.x/IMinterFilterV1.sol/IMinterFilterV1.json +22 -22
  63. package/artifacts/contracts/interfaces/v0.8.x/IPseudorandomAtomic.sol/IPseudorandomAtomic.json +1 -1
  64. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAExpSettlementV0.sol/ISharedMinterDAExpSettlementV0.json +26 -101
  65. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAExpV0.sol/ISharedMinterDAExpV0.json +1 -57
  66. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDALinV0.sol/ISharedMinterDALinV0.json +1 -57
  67. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAV0.sol/ISharedMinterDAV0.json +2 -21
  68. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterHolderERC20V0.sol/ISharedMinterHolderERC20V0.json +158 -0
  69. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterHolderV0.sol/ISharedMinterHolderV0.json +15 -90
  70. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterMerkleV0.sol/ISharedMinterMerkleV0.json +10 -36
  71. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterRAMV0.sol/ISharedMinterRAMV0.json +62 -0
  72. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterRequired.sol/ISharedMinterRequired.json +37 -0
  73. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterSEAV0.sol/ISharedMinterSEAV0.json +4 -236
  74. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterSimplePurchaseV0.sol/ISharedMinterSimplePurchaseV0.json +5 -5
  75. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterV0.sol/ISharedMinterV0.json +7 -423
  76. package/artifacts/contracts/interfaces/v0.8.x/ISharedRandomizerV0.sol/ISharedRandomizerV0.json +17 -17
  77. package/artifacts/contracts/interfaces/v0.8.x/ISplitAtomicFactoryV0.sol/ISplitAtomicFactoryV0.json +170 -0
  78. package/artifacts/contracts/interfaces/v0.8.x/ISplitAtomicV0.sol/ISplitAtomicV0.json +126 -0
  79. package/artifacts/contracts/interfaces/v0.8.x/ISplitProviderV0.sol/ISplitProviderV0.json +98 -0
  80. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/splits-0x-v2/ISplitFactoryV2.sol/ISplitFactoryV2.json +123 -0
  81. package/artifacts/contracts/libs/integration-refs/delegation-registry/DelegationRegistry.sol/DelegationRegistry.json +2 -2
  82. package/artifacts/contracts/libs/integration-refs/gnosis-safe/GnosisSafeMock.sol/GnosisSafeMock.json +2 -2
  83. package/artifacts/contracts/libs/integration-refs/gnosis-safe/GnosisSafeProxyFactoryMock.sol/GnosisSafeProxyFactoryMock.json +2 -2
  84. package/artifacts/contracts/libs/integration-refs/gnosis-safe/MultiSendMock.sol/MultiSendMock.json +2 -2
  85. package/artifacts/contracts/libs/integration-refs/weth9/weth9.sol/WETH9_.json +2 -2
  86. package/artifacts/contracts/libs/v0.8.x/ABHelpers.sol/ABHelpers.json +2 -2
  87. package/artifacts/contracts/libs/v0.8.x/AuthLib.sol/AuthLib.json +2 -2
  88. package/artifacts/contracts/libs/v0.8.x/BitMap.sol/BitMaps256.json +10 -0
  89. package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV0.sol/BytecodeStorage.json +2 -2
  90. package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV1.sol/BytecodeStorageReader.json +2 -2
  91. package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV1.sol/BytecodeStorageWriter.json +2 -2
  92. package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV2.sol/BytecodeStorageReader.json +214 -0
  93. package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV2.sol/BytecodeStorageWriter.json +10 -0
  94. package/artifacts/contracts/libs/v0.8.x/Bytes32Strings.sol/Bytes32Strings.json +2 -2
  95. package/artifacts/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol/DependencyRegistryStorageLib.json +10 -0
  96. package/artifacts/contracts/libs/v0.8.x/ERC721_PackedHashSeed.sol/ERC721_PackedHashSeed.json +2 -2
  97. package/artifacts/contracts/libs/v0.8.x/ERC721_PackedHashSeedV1.sol/ERC721_PackedHashSeedV1.json +444 -0
  98. package/artifacts/contracts/libs/v0.8.x/PackedBools.sol/PackedBools.json +10 -0
  99. package/artifacts/contracts/libs/v0.8.x/SSTORE2.sol/SSTORE2.json +2 -2
  100. package/artifacts/contracts/libs/v0.8.x/V3FlexLib.sol/V3FlexLib.json +208 -0
  101. package/artifacts/contracts/libs/v0.8.x/minter-libs/DAExpLib.sol/DAExpLib.json +60 -3
  102. package/artifacts/contracts/libs/v0.8.x/minter-libs/DALib.sol/DALib.json +30 -0
  103. package/artifacts/contracts/libs/v0.8.x/minter-libs/DALinLib.sol/DALinLib.json +60 -3
  104. package/artifacts/contracts/libs/v0.8.x/minter-libs/GenericMinterEventsLib.sol/GenericMinterEventsLib.json +346 -0
  105. package/artifacts/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol/MaxInvocationsLib.json +29 -3
  106. package/artifacts/contracts/libs/v0.8.x/minter-libs/MerkleLib.sol/MerkleLib.json +30 -3
  107. package/artifacts/contracts/libs/v0.8.x/minter-libs/PolyptychLib.sol/PolyptychLib.json +2 -2
  108. package/artifacts/contracts/libs/v0.8.x/minter-libs/RAMLib.sol/RAMLib.json +398 -0
  109. package/artifacts/contracts/libs/v0.8.x/minter-libs/SEALib.sol/SEALib.json +254 -3
  110. package/artifacts/contracts/libs/v0.8.x/minter-libs/SetPriceLib.sol/SetPriceLib.json +48 -3
  111. package/artifacts/contracts/libs/v0.8.x/minter-libs/SettlementExpLib.sol/SettlementExpLib.json +41 -3
  112. package/artifacts/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol/SplitFundsLib.json +35 -3
  113. package/artifacts/contracts/libs/v0.8.x/minter-libs/TokenHolderLib.sol/TokenHolderLib.json +79 -3
  114. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV1.sol/MinterFilterV1.json +2 -2
  115. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV2.sol/MinterFilterV2.json +41 -41
  116. package/artifacts/contracts/minter-suite/Minters/MinterDAExpHolderV5.sol/MinterDAExpHolderV5.json +66 -632
  117. package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV3.sol/MinterDAExpSettlementV3.json +67 -594
  118. package/artifacts/contracts/minter-suite/Minters/MinterDAExpV5.sol/MinterDAExpV5.json +33 -524
  119. package/artifacts/contracts/minter-suite/Minters/MinterDALinHolderV5.sol/MinterDALinHolderV5.json +66 -632
  120. package/artifacts/contracts/minter-suite/Minters/MinterDALinV5.sol/MinterDALinV5.json +33 -524
  121. package/artifacts/contracts/minter-suite/Minters/MinterRAMV0.sol/MinterRAMV0.json +1374 -0
  122. package/artifacts/contracts/minter-suite/Minters/MinterSEAV1.sol/MinterSEAV1.json +56 -722
  123. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V5.sol/MinterSetPriceERC20V5.json +58 -454
  124. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceHolderV5.sol/MinterSetPriceHolderV5.json +61 -552
  125. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceMerkleV5.sol/MinterSetPriceMerkleV5.json +55 -497
  126. package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychERC20V5.sol/MinterSetPricePolyptychERC20V5.json +110 -571
  127. package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol/MinterSetPricePolyptychV5.json +69 -560
  128. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV5.sol/MinterSetPriceV5.json +28 -444
  129. package/artifacts/contracts/minter-suite/Minters/one-off/MinterSetPriceV5_SingleCore.sol/MinterSetPriceV5_SingleCore.json +417 -0
  130. package/artifacts/contracts/mock/BytecodeV2LibCallsMock.sol/BytecodeV2LibCallsMock.json +154 -0
  131. package/artifacts/contracts/mock/BytecodeV2TextCR_DMock.sol/BytecodeV2TextCR_DMock.json +428 -0
  132. package/artifacts/contracts/mock/DummySharedMinter.sol/DummySharedMinter.json +2 -2
  133. package/artifacts/contracts/mock/ERC20Mock.sol/ERC20Mock.json +2 -2
  134. package/artifacts/contracts/mock/ForceSendMock.sol/ForceSendMock.json +24 -0
  135. package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +4 -9
  136. package/artifacts/contracts/mock/Mock0xSplitsV2PullFactory.sol/Mock0xSplitsV2PullFactory.json +149 -0
  137. package/artifacts/contracts/mock/Mock0xSplitsV2Splitter.sol/Mock0xSplitsV2Splitter.json +99 -0
  138. package/artifacts/contracts/mock/MockAdminACLV0.sol/MockAdminACLV0Events.json +20 -2
  139. package/artifacts/contracts/mock/MockAdminACLV0_PROHIBITION.sol/MockAdminACLV0Events_PROHIBITION.json +20 -2
  140. package/artifacts/contracts/mock/OriginRegisterMock.sol/OriginRegisterMock.json +2 -2
  141. package/artifacts/contracts/mock/RandomizerV2_NoAssignMock.sol/RandomizerV2_NoAssignMock.json +2 -2
  142. package/artifacts/contracts/mock/ReentrancyGenArt721MinterMock.sol/ReentrancyGenArt721MinterMock.json +100 -0
  143. package/artifacts/contracts/mock/ReentrancyHolderMock.sol/ReentrancyHolderMock.json +2 -2
  144. package/artifacts/contracts/mock/ReentrancyHolderMockShared.sol/ReentrancyHolderMockShared.json +136 -0
  145. package/artifacts/contracts/mock/ReentrancyMerkleMock.sol/ReentrancyMerkleMock.json +2 -2
  146. package/artifacts/contracts/mock/ReentrancyMerkleMockShared.sol/ReentrancyMerkleMockShared.json +105 -0
  147. package/artifacts/contracts/mock/ReentrancyMock.sol/ReentrancyMock.json +2 -2
  148. package/artifacts/contracts/mock/ReentrancyMockShared.sol/ReentrancyMockShared.json +100 -0
  149. package/artifacts/contracts/mock/ReentrancySEAMock.sol/ReentrancySEAAutoBidderMock.json +2 -2
  150. package/artifacts/contracts/mock/ReentrancySEAMockShared.sol/ReentrancySEAAutoBidderMockShared.json +69 -0
  151. package/artifacts/contracts/mock/ReentrancySplitterMocks.sol/ReentrancySplitterDrainETHMock.json +54 -0
  152. package/artifacts/contracts/mock/ReentrancySplitterMocks.sol/ReentrancySplitterSendETHMock.json +54 -0
  153. package/artifacts/contracts/randomizer/deprecated/PolyptychRandomizerV0.sol/BasicPolyptychRandomizerV0.json +2 -2
  154. package/artifacts/contracts/randomizer/deprecated/RandomizerV2.sol/BasicRandomizerV2.json +2 -2
  155. package/artifacts/contracts/randomizer/primitive/PseudorandomAtomicBasic.sol/PseudorandomAtomic.json +2 -2
  156. package/artifacts/contracts/randomizer/shared/SharedRandomizerV0.sol/SharedRandomizerV0.json +19 -19
  157. package/artifacts/contracts/split/SplitAtomicFactoryV0.sol/SplitAtomicFactoryV0.json +203 -0
  158. package/artifacts/contracts/split/SplitAtomicV0.sol/SplitAtomicV0.json +168 -0
  159. package/artifacts/contracts/split/split-provider/SplitProviderV0.sol/SplitProviderV0.json +141 -0
  160. package/contracts/AdminACLV0.sol +6 -2
  161. package/contracts/AdminACLV1.sol +2 -2
  162. package/contracts/DependencyRegistryV0.sol +737 -390
  163. package/contracts/{GenArt721CoreV3.sol → archive/GenArt721CoreV3.sol} +56 -20
  164. package/contracts/{explorations → archive}/GenArt721CoreV3_Explorations.sol +49 -13
  165. package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterBase_v0_1_1.sol +4 -4
  166. package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterDAExp}/MinterDAExpV4.sol +4 -4
  167. package/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol +4 -4
  168. package/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV1.sol +5 -5
  169. package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterDAExpSettlement}/MinterDAExpSettlementV2.sol +9 -62
  170. package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterDALin}/MinterDALinV4.sol +4 -4
  171. package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterHolder}/MinterHolderV4.sol +5 -5
  172. package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterMerkle}/MinterMerkleV5.sol +5 -5
  173. package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterPolyptych}/MinterPolyptychV0.sol +7 -7
  174. package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterSEA}/MinterSEAV0.sol +13 -13
  175. package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterSetPrice}/MinterSetPriceV4.sol +4 -4
  176. package/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V0.sol +82 -10
  177. package/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V1.sol +82 -10
  178. package/contracts/{minter-suite/Minters → archive/minter-suite/Minters/MinterSetPriceERC20}/MinterSetPriceERC20V4.sol +88 -21
  179. package/contracts/engine/V2/GenArt721MinterBurner_PBAB.sol +81 -22
  180. package/contracts/engine/V2/GenArt721Minter_PBAB.sol +80 -22
  181. package/contracts/engine/V3/EngineFactoryV0.sol +419 -0
  182. package/contracts/engine/V3/GenArt721CoreV3_Engine.sol +893 -493
  183. package/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol +1053 -655
  184. package/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol +7 -13
  185. package/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol +5 -11
  186. package/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol +2 -2
  187. package/contracts/engine-registry/CoreRegistryV1.sol +58 -65
  188. package/contracts/interfaces/v0.8.x/IAdminACLV0_Extended.sol +20 -0
  189. package/contracts/interfaces/v0.8.x/IBytecodeStorageReaderV2.sol +23 -0
  190. package/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol +6 -8
  191. package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +48 -43
  192. package/contracts/interfaces/v0.8.x/IEngineFactoryV0.sol +124 -0
  193. package/contracts/interfaces/v0.8.x/IFilteredMinterDAExpSettlementV0.sol +1 -3
  194. package/contracts/interfaces/v0.8.x/IFilteredMinterDAExpSettlementV1.sol +1 -3
  195. package/contracts/interfaces/v0.8.x/IFilteredMinterDAExpV1.sol +1 -3
  196. package/contracts/interfaces/v0.8.x/IFilteredMinterDALinV1.sol +1 -3
  197. package/contracts/interfaces/v0.8.x/IFilteredMinterHolderV2.sol +1 -3
  198. package/contracts/interfaces/v0.8.x/IFilteredMinterMerkleV2.sol +1 -3
  199. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol +115 -11
  200. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol +84 -8
  201. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol +26 -8
  202. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.sol +141 -0
  203. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_PreV3p2.sol +78 -0
  204. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_ProjectFinance.sol +47 -0
  205. package/contracts/interfaces/v0.8.x/IGenArt721Minter_PBAB.sol +91 -0
  206. package/contracts/interfaces/v0.8.x/IMinterFilterV1.sol +25 -25
  207. package/contracts/interfaces/v0.8.x/IPseudorandomAtomic.sol +1 -3
  208. package/contracts/interfaces/v0.8.x/ISharedMinterDAExpSettlementV0.sol +30 -20
  209. package/contracts/interfaces/v0.8.x/ISharedMinterDAExpV0.sol +1 -14
  210. package/contracts/interfaces/v0.8.x/ISharedMinterDALinV0.sol +1 -15
  211. package/contracts/interfaces/v0.8.x/ISharedMinterDAV0.sol +2 -8
  212. package/contracts/interfaces/v0.8.x/ISharedMinterHolderERC20V0.sol +47 -0
  213. package/contracts/interfaces/v0.8.x/ISharedMinterHolderV0.sol +15 -43
  214. package/contracts/interfaces/v0.8.x/ISharedMinterMerkleV0.sol +10 -20
  215. package/contracts/interfaces/v0.8.x/ISharedMinterRAMV0.sol +23 -0
  216. package/contracts/interfaces/v0.8.x/ISharedMinterRequired.sol +20 -0
  217. package/contracts/interfaces/v0.8.x/ISharedMinterSEAV0.sol +1 -67
  218. package/contracts/interfaces/v0.8.x/ISharedMinterSimplePurchaseV0.sol +5 -5
  219. package/contracts/interfaces/v0.8.x/ISharedMinterV0.sol +18 -160
  220. package/contracts/interfaces/v0.8.x/ISharedRandomizerV0.sol +37 -37
  221. package/contracts/interfaces/v0.8.x/ISplitAtomicFactoryV0.sol +81 -0
  222. package/contracts/interfaces/v0.8.x/ISplitAtomicV0.sol +72 -0
  223. package/contracts/interfaces/v0.8.x/ISplitProviderV0.sol +49 -0
  224. package/contracts/interfaces/v0.8.x/integration-refs/splits-0x-v2/ISplitFactoryV2.sol +62 -0
  225. package/contracts/libs/v0.8.x/ABHelpers.sol +31 -17
  226. package/contracts/libs/v0.8.x/AuthLib.sol +101 -102
  227. package/contracts/libs/v0.8.x/BitMap.sol +112 -0
  228. package/contracts/libs/v0.8.x/BytecodeStorageV2.sol +593 -0
  229. package/contracts/libs/v0.8.x/Bytes32Strings.sol +5 -5
  230. package/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol +90 -0
  231. package/contracts/libs/v0.8.x/ERC721_PackedHashSeedV1.sol +591 -0
  232. package/contracts/libs/v0.8.x/PackedBools.sol +42 -0
  233. package/contracts/libs/v0.8.x/V3FlexLib.sol +591 -0
  234. package/contracts/libs/v0.8.x/minter-libs/DAExpLib.sol +162 -39
  235. package/contracts/libs/v0.8.x/minter-libs/DALib.sol +26 -0
  236. package/contracts/libs/v0.8.x/minter-libs/DALinLib.sol +139 -37
  237. package/contracts/libs/v0.8.x/minter-libs/GenericMinterEventsLib.sol +171 -0
  238. package/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol +299 -158
  239. package/contracts/libs/v0.8.x/minter-libs/MerkleLib.sol +268 -55
  240. package/contracts/libs/v0.8.x/minter-libs/PolyptychLib.sol +138 -58
  241. package/contracts/libs/v0.8.x/minter-libs/RAMLib.sol +2927 -0
  242. package/contracts/libs/v0.8.x/minter-libs/SEALib.sol +796 -123
  243. package/contracts/libs/v0.8.x/minter-libs/SetPriceLib.sol +131 -13
  244. package/contracts/libs/v0.8.x/minter-libs/SettlementExpLib.sol +607 -224
  245. package/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol +494 -330
  246. package/contracts/libs/v0.8.x/minter-libs/TokenHolderLib.sol +217 -78
  247. package/contracts/minter-suite/MinterFilter/MinterFilterV2.sol +358 -309
  248. package/contracts/minter-suite/Minters/MinterDAExpHolderV5.sol +391 -491
  249. package/contracts/minter-suite/Minters/MinterDAExpSettlementV3.sol +396 -632
  250. package/contracts/minter-suite/Minters/MinterDAExpV5.sol +212 -273
  251. package/contracts/minter-suite/Minters/MinterDALinHolderV5.sol +393 -488
  252. package/contracts/minter-suite/Minters/MinterDALinV5.sol +220 -277
  253. package/contracts/minter-suite/Minters/MinterRAMV0.sol +1205 -0
  254. package/contracts/minter-suite/Minters/MinterSEAV1.sol +329 -677
  255. package/contracts/minter-suite/Minters/MinterSetPriceERC20V5.sol +287 -303
  256. package/contracts/minter-suite/Minters/MinterSetPriceHolderV5.sol +355 -446
  257. package/contracts/minter-suite/Minters/MinterSetPriceMerkleV5.sol +328 -416
  258. package/contracts/minter-suite/Minters/MinterSetPricePolyptychERC20V5.sol +552 -622
  259. package/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol +429 -553
  260. package/contracts/minter-suite/Minters/MinterSetPriceV5.sol +180 -227
  261. package/contracts/minter-suite/Minters/one-off/MinterSetPriceV5_SingleCore.sol +446 -0
  262. package/contracts/mock/BytecodeV2LibCallsMock.sol +128 -0
  263. package/contracts/mock/BytecodeV2TextCR_DMock.sol +316 -0
  264. package/contracts/mock/ForceSendMock.sol +22 -0
  265. package/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol +3 -10
  266. package/contracts/mock/Mock0xSplitsV2PullFactory.sol +75 -0
  267. package/contracts/mock/Mock0xSplitsV2Splitter.sol +47 -0
  268. package/contracts/mock/MockAdminACLV0.sol +21 -0
  269. package/contracts/mock/MockAdminACLV0_PROHIBITION.sol +21 -0
  270. package/contracts/mock/ReentrancyGenArt721MinterMock.sol +47 -0
  271. package/contracts/mock/ReentrancyHolderMockShared.sol +59 -0
  272. package/contracts/mock/ReentrancyMerkleMockShared.sol +58 -0
  273. package/contracts/mock/ReentrancyMockShared.sol +48 -0
  274. package/contracts/mock/ReentrancySEAMockShared.sol +40 -0
  275. package/contracts/mock/ReentrancySplitterMocks.sol +67 -0
  276. package/contracts/randomizer/primitive/PseudorandomAtomicBasic.sol +1 -1
  277. package/contracts/randomizer/shared/SharedRandomizerV0.sol +79 -71
  278. package/contracts/split/SplitAtomicFactoryV0.sol +121 -0
  279. package/contracts/split/SplitAtomicV0.sol +265 -0
  280. package/contracts/split/split-provider/SplitProviderV0.sol +201 -0
  281. package/package.json +79 -45
  282. package/artifacts/contracts/GenArt721CoreV3.sol/GenArt721CoreV3.json +0 -1965
  283. package/artifacts/contracts/explorations/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +0 -1939
  284. package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +0 -1127
  285. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V4.sol/MinterSetPriceERC20V4.json +0 -768
  286. package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverride.sol/GenArt721RoyaltyOverride.json +0 -208
  287. package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverride_PBAB.sol/GenArt721RoyaltyOverride_PBAB.json +0 -301
  288. package/contracts/royalty-registry/GenArt721RoyaltyOverride.sol +0 -168
  289. package/contracts/royalty-registry/GenArt721RoyaltyOverride_PBAB.sol +0 -221
@@ -1,11 +1,14 @@
1
1
  // SPDX-License-Identifier: LGPL-3.0-only
2
2
  // Created By: Art Blocks Inc.
3
3
 
4
- import "../../../interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol";
4
+ pragma solidity ^0.8.0;
5
5
 
6
- import "@openzeppelin-4.7/contracts/utils/math/Math.sol";
6
+ import {IGenArt721CoreContractV3_Base} from "../../../interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol";
7
7
 
8
- pragma solidity ^0.8.0;
8
+ import {ABHelpers} from "../ABHelpers.sol";
9
+
10
+ import {Math} from "@openzeppelin-4.7/contracts/utils/math/Math.sol";
11
+ import {SafeCast} from "@openzeppelin-4.7/contracts/utils/math/SafeCast.sol";
9
12
 
10
13
  /**
11
14
  * @title Art Blocks Max Invocations Library
@@ -19,6 +22,26 @@ pragma solidity ^0.8.0;
19
22
  */
20
23
 
21
24
  library MaxInvocationsLib {
25
+ using SafeCast for uint256;
26
+
27
+ /**
28
+ * @notice Local max invocations for project `projectId`, tied to core contract `coreContractAddress`,
29
+ * updated to `maxInvocations`.
30
+ * @param projectId The id of the project.
31
+ * @param coreContract The address of the core contract.
32
+ * @param maxInvocations The new max invocations limit.
33
+ */
34
+ event ProjectMaxInvocationsLimitUpdated(
35
+ uint256 indexed projectId,
36
+ address indexed coreContract,
37
+ uint256 maxInvocations
38
+ );
39
+
40
+ // position of Max Invocations Lib storage, using a diamond storage pattern
41
+ // for this library
42
+ bytes32 constant MAX_INVOCATIONS_LIB_STORAGE_POSITION =
43
+ keccak256("maxinvocationslib.storage");
44
+
22
45
  uint256 internal constant ONE_MILLION = 1_000_000;
23
46
 
24
47
  /**
@@ -29,66 +52,93 @@ library MaxInvocationsLib {
29
52
  uint24 maxInvocations;
30
53
  }
31
54
 
55
+ // Diamond storage pattern is used in this library
56
+ struct MaxInvocationsLibStorage {
57
+ mapping(address coreContract => mapping(uint256 projectId => MaxInvocationsProjectConfig)) maxInvocationsProjectConfigs;
58
+ }
59
+
32
60
  /**
33
61
  * @notice Syncs project's max invocations to core contract value.
34
- * @param _projectId The id of the project.
35
- * @param _coreContract The address of the core contract.
36
- * @param maxInvocationsProjectConfig Data structure that holds max invocations project configuration.
37
- * @return uint256 the updated max invocations.
62
+ * @param projectId The id of the project.
63
+ * @param coreContract The address of the core contract.
38
64
  */
39
65
  function syncProjectMaxInvocationsToCore(
40
- uint256 _projectId,
41
- address _coreContract,
42
- MaxInvocationsProjectConfig storage maxInvocationsProjectConfig
43
- ) internal returns (uint256) {
44
- uint256 maxInvocations;
45
- uint256 invocations;
46
- (invocations, maxInvocations, , , , ) = IGenArt721CoreContractV3_Base(
47
- _coreContract
48
- ).projectStateData(_projectId);
66
+ uint256 projectId,
67
+ address coreContract
68
+ ) internal {
69
+ (
70
+ uint256 coreInvocations,
71
+ uint256 coreMaxInvocations
72
+ ) = coreContractInvocationData({
73
+ projectId: projectId,
74
+ coreContract: coreContract
75
+ });
49
76
  // update storage with results
50
- maxInvocationsProjectConfig.maxInvocations = uint24(maxInvocations);
77
+ MaxInvocationsProjectConfig
78
+ storage maxInvocationsProjectConfig = getMaxInvocationsProjectConfig({
79
+ projectId: projectId,
80
+ coreContract: coreContract
81
+ });
82
+ // @dev only bugged core would return > 1e6 invocations, but safe-cast
83
+ // for additional overflow safety
84
+ maxInvocationsProjectConfig.maxInvocations = coreMaxInvocations
85
+ .toUint24();
51
86
 
52
87
  // We need to ensure maxHasBeenInvoked is correctly set after manually syncing the
53
88
  // local maxInvocations value with the core contract's maxInvocations value.
54
- // This synced value of maxInvocations from the core contract will always be greater
55
- // than or equal to the previous value of maxInvocations stored locally.
56
89
  maxInvocationsProjectConfig.maxHasBeenInvoked =
57
- invocations == maxInvocations;
58
- return maxInvocations;
90
+ coreInvocations == coreMaxInvocations;
91
+
92
+ emit ProjectMaxInvocationsLimitUpdated({
93
+ projectId: projectId,
94
+ coreContract: coreContract,
95
+ maxInvocations: coreMaxInvocations
96
+ });
59
97
  }
60
98
 
61
99
  /**
62
100
  * @notice Manually limits project's max invocations.
63
- * @param _projectId The id of the project.
64
- * @param _coreContract The address of the core contract.
65
- * @param _maxInvocations The new max invocations limit.
66
- * @param maxInvocationsProjectConfig Data structure that holds max invocations project configuration.
101
+ * @param projectId The id of the project.
102
+ * @param coreContract The address of the core contract.
103
+ * @param maxInvocations The new max invocations limit.
67
104
  */
68
105
  function manuallyLimitProjectMaxInvocations(
69
- uint256 _projectId,
70
- address _coreContract,
71
- uint24 _maxInvocations,
72
- MaxInvocationsProjectConfig storage maxInvocationsProjectConfig
106
+ uint256 projectId,
107
+ address coreContract,
108
+ uint24 maxInvocations
73
109
  ) internal {
74
110
  // CHECKS
75
111
  (
76
112
  uint256 coreInvocations,
77
113
  uint256 coreMaxInvocations
78
- ) = coreContractInvocationData(_projectId, _coreContract);
114
+ ) = coreContractInvocationData({
115
+ projectId: projectId,
116
+ coreContract: coreContract
117
+ });
79
118
  require(
80
- _maxInvocations <= coreMaxInvocations,
119
+ maxInvocations <= coreMaxInvocations,
81
120
  "Invalid max invocations"
82
121
  );
83
- require(_maxInvocations >= coreInvocations, "Invalid max invocations");
122
+ require(maxInvocations >= coreInvocations, "Invalid max invocations");
84
123
 
85
124
  // EFFECTS
125
+ MaxInvocationsProjectConfig
126
+ storage maxInvocationsProjectConfig = getMaxInvocationsProjectConfig({
127
+ projectId: projectId,
128
+ coreContract: coreContract
129
+ });
86
130
  // update storage with results
87
- maxInvocationsProjectConfig.maxInvocations = uint24(_maxInvocations);
131
+ maxInvocationsProjectConfig.maxInvocations = uint24(maxInvocations);
88
132
  // We need to ensure maxHasBeenInvoked is correctly set after manually setting the
89
133
  // local maxInvocations value.
90
134
  maxInvocationsProjectConfig.maxHasBeenInvoked =
91
- coreInvocations == _maxInvocations;
135
+ coreInvocations == maxInvocations;
136
+
137
+ emit ProjectMaxInvocationsLimitUpdated({
138
+ projectId: projectId,
139
+ coreContract: coreContract,
140
+ maxInvocations: maxInvocations
141
+ });
92
142
  }
93
143
 
94
144
  /**
@@ -98,107 +148,122 @@ library MaxInvocationsLib {
98
148
  * @dev This function checks that the token invocation is less than or
99
149
  * equal to the local max invocations, and also updates the local
100
150
  * maxHasBeenInvoked value.
101
- * @param _tokenId The id of the token.
102
- * @param maxInvocationsProjectConfig Data structure that holds max
103
- * invocations project configuration.
151
+ * @param tokenId The id of the token.
152
+ * @param coreContract The address of the core contract.
104
153
  */
105
- function validatePurchaseEffectsInvocations(
106
- uint256 _tokenId,
107
- MaxInvocationsProjectConfig storage maxInvocationsProjectConfig
154
+ function validateMintEffectsInvocations(
155
+ uint256 tokenId,
156
+ address coreContract
108
157
  ) internal {
158
+ uint256 projectId = ABHelpers.tokenIdToProjectId(tokenId);
159
+ MaxInvocationsProjectConfig
160
+ storage maxInvocationsProjectConfig = getMaxInvocationsProjectConfig({
161
+ projectId: projectId,
162
+ coreContract: coreContract
163
+ });
109
164
  // invocation is token number plus one, and will never overflow due to
110
- // limit of 1e6 invocations per project. block scope for gas efficiency
111
- // (i.e. avoid an unnecessary var initialization to 0).
112
- unchecked {
113
- uint256 tokenInvocation = (_tokenId % ONE_MILLION) + 1;
114
- uint256 localMaxInvocations = maxInvocationsProjectConfig
115
- .maxInvocations;
116
- // handle the case where the token invocation == minter local max
117
- // invocations occurred on a different minter, and we have a stale
118
- // local maxHasBeenInvoked value returning a false negative.
119
- // @dev this is a CHECK after EFFECTS, so security was considered
120
- // in detail here.
121
- require(
122
- tokenInvocation <= localMaxInvocations,
123
- "Max invocations reached"
124
- );
125
- // in typical case, update the local maxHasBeenInvoked value
126
- // to true if the token invocation == minter local max invocations
127
- // (enables gas efficient reverts after sellout)
128
- if (tokenInvocation == localMaxInvocations) {
129
- maxInvocationsProjectConfig.maxHasBeenInvoked = true;
130
- }
165
+ // limit of 1e6 invocations per project.
166
+ uint256 tokenInvocation = ABHelpers.tokenIdToTokenInvocation(tokenId);
167
+ uint256 localMaxInvocations = maxInvocationsProjectConfig
168
+ .maxInvocations;
169
+ // handle the case where the token invocation == minter local max
170
+ // invocations occurred on a different minter, and we have a stale
171
+ // local maxHasBeenInvoked value returning a false negative.
172
+ // @dev this is a CHECK after EFFECTS, so security was considered
173
+ // in detail here.
174
+ require(
175
+ tokenInvocation <= localMaxInvocations,
176
+ "Max invocations reached"
177
+ );
178
+ // in typical case, update the local maxHasBeenInvoked value
179
+ // to true if the token invocation == minter local max invocations
180
+ // (enables gas efficient reverts after sellout)
181
+ if (tokenInvocation == localMaxInvocations) {
182
+ maxInvocationsProjectConfig.maxHasBeenInvoked = true;
131
183
  }
132
184
  }
133
185
 
134
186
  /**
135
- * Helper function to check if max invocations has not been initialized.
187
+ * @notice Checks that the max invocations have not been reached for a
188
+ * given project. This only checks the minter's local max invocations, and
189
+ * does not consider the core contract's max invocations.
190
+ * The function reverts if the max invocations have been reached.
191
+ * @param projectId The id of the project.
192
+ * @param coreContract The address of the core contract.
193
+ */
194
+ function preMintChecks(
195
+ uint256 projectId,
196
+ address coreContract
197
+ ) internal view {
198
+ // check that max invocations have not been reached
199
+ MaxInvocationsProjectConfig
200
+ storage maxInvocationsProjectConfig = getMaxInvocationsProjectConfig({
201
+ projectId: projectId,
202
+ coreContract: coreContract
203
+ });
204
+ require(
205
+ !maxInvocationsProjectConfig.maxHasBeenInvoked,
206
+ "Max invocations reached"
207
+ );
208
+ }
209
+
210
+ /**
211
+ * @notice Helper function to check if max invocations has not been initialized.
136
212
  * Returns true if not initialized, false if initialized.
137
- * @param _maxInvocationsProjectConfig Struct that holds max invocations
138
- * project configuration.
139
- * @return bool
213
+ * @param projectId The id of the project.
214
+ * @param coreContract The address of the core contract.
140
215
  * @dev We know a project's max invocations have never been initialized if
141
216
  * both max invocations and maxHasBeenInvoked are still initial values.
142
217
  * This is because if maxInvocations were ever set to zero,
143
218
  * maxHasBeenInvoked would be set to true.
144
219
  */
145
220
  function maxInvocationsIsUnconfigured(
146
- MaxInvocationsProjectConfig storage _maxInvocationsProjectConfig
221
+ uint256 projectId,
222
+ address coreContract
147
223
  ) internal view returns (bool) {
224
+ MaxInvocationsProjectConfig
225
+ storage maxInvocationsProjectConfig = getMaxInvocationsProjectConfig({
226
+ projectId: projectId,
227
+ coreContract: coreContract
228
+ });
148
229
  return
149
- _maxInvocationsProjectConfig.maxInvocations == 0 &&
150
- !_maxInvocationsProjectConfig.maxHasBeenInvoked;
230
+ maxInvocationsProjectConfig.maxInvocations == 0 &&
231
+ !maxInvocationsProjectConfig.maxHasBeenInvoked;
151
232
  }
152
233
 
153
234
  /**
154
- * Returns if invocations remain available for a given project.
235
+ * @notice Function returns if invocations remain available for a given project.
155
236
  * This function calls the core contract to get the most up-to-date
156
237
  * invocation data (which may be useful to avoid reverts during mint).
157
238
  * This function considers core contract max invocations, and minter local
158
239
  * max invocations, and returns a response based on the most limiting
159
240
  * max invocations value.
160
- * @param _maxInvocationsProjectConfig Struct that holds minter-level max
161
- * invocations
162
- * @param _projectId The id of the project.
163
- * @param _coreContract The address of the core contract.
241
+ * @param projectId The id of the project.
242
+ * @param coreContract The address of the core contract.
164
243
  */
165
- function invocationsRemain(
166
- MaxInvocationsProjectConfig storage _maxInvocationsProjectConfig,
167
- uint256 _projectId,
168
- address _coreContract
244
+ function invocationsRemainOnCore(
245
+ uint256 projectId,
246
+ address coreContract
169
247
  ) internal view returns (bool) {
170
- // get up-to-data invocation data from core contract
171
- (
172
- uint256 coreInvocations,
173
- uint256 coreMaxInvocations
174
- ) = MaxInvocationsLib.coreContractInvocationData(
175
- _projectId,
176
- _coreContract
177
- );
178
- // load minter-local max invocations into memory
179
- uint256 localMaxInvocations = _maxInvocationsProjectConfig
180
- .maxInvocations;
181
- // invocations remain available if the core contract has not reached
182
- // the most limiting max invocations, either on minter or core contract
183
- uint256 limitingMaxInvocations = Math.min(
184
- coreMaxInvocations,
185
- localMaxInvocations
186
- );
187
- return coreInvocations < limitingMaxInvocations;
248
+ return
249
+ getInvocationsAvailable({
250
+ projectId: projectId,
251
+ coreContract: coreContract
252
+ }) != 0;
188
253
  }
189
254
 
190
255
  /**
191
- * Pulls core contract invocation data for a given project.
256
+ * @notice Pulls core contract invocation data for a given project.
192
257
  * @dev This function calls the core contract to get the invocation data
193
- * @param _projectId The id of the project.
194
- * @param _coreContract The address of the core contract.
258
+ * @param projectId The id of the project.
259
+ * @param coreContract The address of the core contract.
195
260
  * @return coreInvocations The number of invocations for the project.
196
261
  * @return coreMaxInvocations The max invocations for the project, as
197
262
  * defined on the core contract.
198
263
  */
199
264
  function coreContractInvocationData(
200
- uint256 _projectId,
201
- address _coreContract
265
+ uint256 projectId,
266
+ address coreContract
202
267
  )
203
268
  internal
204
269
  view
@@ -211,67 +276,105 @@ library MaxInvocationsLib {
211
276
  ,
212
277
  ,
213
278
 
214
- ) = IGenArt721CoreContractV3_Base(_coreContract).projectStateData(
215
- _projectId
279
+ ) = IGenArt721CoreContractV3_Base(coreContract).projectStateData(
280
+ projectId
216
281
  );
217
282
  }
218
283
 
219
284
  /**
220
- * Returns the max invocations for a given MaxInvocationsProjectConfig.
221
- * @param _maxInvocationsProjectConfig MaxInvocationsProjectConfig struct
285
+ * @notice Function returns the max invocations for a given project.
286
+ * @param projectId The id of the project.
287
+ * @param coreContract The address of the core contract.
222
288
  * to be queried.
223
289
  */
224
290
  function getMaxInvocations(
225
- MaxInvocationsProjectConfig storage _maxInvocationsProjectConfig
291
+ uint256 projectId,
292
+ address coreContract
226
293
  ) internal view returns (uint256) {
227
- return _maxInvocationsProjectConfig.maxInvocations;
294
+ MaxInvocationsProjectConfig
295
+ storage maxInvocationsProjectConfig = getMaxInvocationsProjectConfig({
296
+ projectId: projectId,
297
+ coreContract: coreContract
298
+ });
299
+ return maxInvocationsProjectConfig.maxInvocations;
228
300
  }
229
301
 
230
302
  /**
231
- * Returns if max has been invoked for a given MaxInvocationsProjectConfig.
232
- * @param _maxInvocationsProjectConfig MaxInvocationsProjectConfig struct
303
+ * @notice Function returns if max has been invoked for a given project.
304
+ * @param projectId The id of the project.
305
+ * @param coreContract The address of the core contract.
233
306
  * to be queried.
234
307
  */
235
308
  function getMaxHasBeenInvoked(
236
- MaxInvocationsProjectConfig storage _maxInvocationsProjectConfig
309
+ uint256 projectId,
310
+ address coreContract
237
311
  ) internal view returns (bool) {
238
- return _maxInvocationsProjectConfig.maxHasBeenInvoked;
312
+ MaxInvocationsProjectConfig
313
+ storage maxInvocationsProjectConfig = getMaxInvocationsProjectConfig({
314
+ projectId: projectId,
315
+ coreContract: coreContract
316
+ });
317
+ return maxInvocationsProjectConfig.maxHasBeenInvoked;
239
318
  }
240
319
 
241
320
  /**
242
- * Get if a project has reached its max invocations.
243
- * Function is labaled as "safe" because it checks the core contract's
321
+ * @notice Function returns if a project has reached its max invocations.
322
+ * Function is labelled as "safe" because it checks the core contract's
244
323
  * invocations and max invocations. If the local max invocations is greater
245
324
  * than the core contract's max invocations, it will defer to the core
246
325
  * contract's max invocations (since those are the limiting factor).
247
- * @param _projectId The id of the project.
248
- * @param _coreContract The address of the core contract.
249
- * @param _maxInvocationsProjectConfig MaxInvocationsProjectConfig struct
326
+ * @param projectId The id of the project.
327
+ * @param coreContract The address of the core contract.
250
328
  */
251
329
  function projectMaxHasBeenInvokedSafe(
252
- uint256 _projectId,
253
- address _coreContract,
254
- MaxInvocationsProjectConfig storage _maxInvocationsProjectConfig
330
+ uint256 projectId,
331
+ address coreContract
255
332
  ) internal view returns (bool) {
333
+ return
334
+ getInvocationsAvailable({
335
+ projectId: projectId,
336
+ coreContract: coreContract
337
+ }) == 0;
338
+ }
339
+
340
+ /**
341
+ * @notice Function returns the number of invocations available for a given
342
+ * project. Function checks the core contract's invocations and minter's max
343
+ * invocations, ensuring that the most limiting value is used, even if the
344
+ * local minter max invocations is stale.
345
+ * @param projectId The id of the project.
346
+ * @param coreContract The address of the core contract.
347
+ * @return Number of invocations available for the project.
348
+ */
349
+ function getInvocationsAvailable(
350
+ uint256 projectId,
351
+ address coreContract
352
+ ) internal view returns (uint256) {
256
353
  // get max invocations from core contract
257
- uint256 coreInvocations;
258
- uint256 coreMaxInvocations;
259
- (coreInvocations, coreMaxInvocations) = MaxInvocationsLib
260
- .coreContractInvocationData(_projectId, _coreContract);
261
- uint256 localMaxInvocations = _maxInvocationsProjectConfig
262
- .maxInvocations;
263
- // value is locally defined, and could be out of date.
264
- // only possible illogical state is if local max invocations is
265
- // greater than core contract's max invocations, in which case
266
- // we should use the core contract's max invocations
267
- if (localMaxInvocations > coreMaxInvocations) {
268
- // local max invocations is stale and illogical, defer to core
269
- // contract's max invocations since it is the limiting factor
270
- return (coreMaxInvocations == coreInvocations);
354
+ (
355
+ uint256 coreInvocations,
356
+ uint256 coreMaxInvocations
357
+ ) = coreContractInvocationData({
358
+ projectId: projectId,
359
+ coreContract: coreContract
360
+ });
361
+ MaxInvocationsProjectConfig
362
+ storage maxInvocationsProjectConfig = getMaxInvocationsProjectConfig({
363
+ projectId: projectId,
364
+ coreContract: coreContract
365
+ });
366
+ uint256 limitingMaxInvocations = Math.min(
367
+ coreMaxInvocations,
368
+ maxInvocationsProjectConfig.maxInvocations // local max invocations
369
+ );
370
+ // if core invocations are greater than the limiting max invocations,
371
+ // return 0 since no invocations remain
372
+ if (coreInvocations >= limitingMaxInvocations) {
373
+ return 0;
271
374
  }
272
- // local max invocations is limiting, so check core invocations against
273
- // local max invocations
274
- return (coreInvocations >= localMaxInvocations);
375
+ // otherwise, return the number of invocations remaining
376
+ // @dev will not undeflow due to previous check
377
+ return limitingMaxInvocations - coreInvocations;
275
378
  }
276
379
 
277
380
  /**
@@ -292,30 +395,36 @@ library MaxInvocationsLib {
292
395
  * be more restrictive than the core contract.
293
396
  * @dev assumes core contract's max invocations may only be reduced, which
294
397
  * is the case for all V3 core contracts
398
+ * @param projectId The id of the project.
399
+ * @param coreContract The address of the core contract.
295
400
  */
296
401
  function refreshMaxInvocations(
297
- uint256 _projectId,
298
- address _coreContract,
299
- MaxInvocationsProjectConfig storage _maxInvocationsProjectConfig
300
- ) internal returns (bool maxInvocationsUpdated) {
301
- if (maxInvocationsIsUnconfigured(_maxInvocationsProjectConfig)) {
402
+ uint256 projectId,
403
+ address coreContract
404
+ ) internal {
405
+ MaxInvocationsProjectConfig
406
+ storage maxInvocationsProjectConfig = getMaxInvocationsProjectConfig({
407
+ projectId: projectId,
408
+ coreContract: coreContract
409
+ });
410
+ if (maxInvocationsIsUnconfigured(projectId, coreContract)) {
302
411
  // populate the minter max invocation state to equal the values on
303
412
  // the core contract (least restrictive state)
304
- MaxInvocationsLib.syncProjectMaxInvocationsToCore(
305
- _projectId,
306
- _coreContract,
307
- _maxInvocationsProjectConfig
308
- );
309
- // return true to indicate max invocation state update
310
- maxInvocationsUpdated = true;
413
+ syncProjectMaxInvocationsToCore({
414
+ projectId: projectId,
415
+ coreContract: coreContract
416
+ });
311
417
  } else {
312
418
  // if local max invocations were already populated, validate the local state
313
- uint256 coreMaxInvocations;
314
- uint256 coreInvocations;
315
- (coreInvocations, coreMaxInvocations) = MaxInvocationsLib
316
- .coreContractInvocationData(_projectId, _coreContract);
419
+ (
420
+ uint256 coreInvocations,
421
+ uint256 coreMaxInvocations
422
+ ) = coreContractInvocationData({
423
+ projectId: projectId,
424
+ coreContract: coreContract
425
+ });
317
426
 
318
- uint256 localMaxInvocations = _maxInvocationsProjectConfig
427
+ uint256 localMaxInvocations = maxInvocationsProjectConfig
319
428
  .maxInvocations;
320
429
  if (localMaxInvocations > coreMaxInvocations) {
321
430
  // if local max invocations are greater than core max invocations, make
@@ -324,25 +433,57 @@ library MaxInvocationsLib {
324
433
  // have been reduced since the minter's max invocations were last
325
434
  // updated
326
435
  // set local max invocations to core contract's max invocations
327
- _maxInvocationsProjectConfig.maxInvocations = uint24(
436
+ maxInvocationsProjectConfig.maxInvocations = uint24(
328
437
  coreMaxInvocations
329
438
  );
330
439
  // update the minter's `maxHasBeenInvoked` state
331
- _maxInvocationsProjectConfig
440
+ maxInvocationsProjectConfig
332
441
  .maxHasBeenInvoked = (coreMaxInvocations ==
333
442
  coreInvocations);
334
- // return true to indicate max invocation state update
335
- maxInvocationsUpdated = true;
443
+ emit ProjectMaxInvocationsLimitUpdated({
444
+ projectId: projectId,
445
+ coreContract: coreContract,
446
+ maxInvocations: coreMaxInvocations
447
+ });
336
448
  } else if (coreInvocations >= localMaxInvocations) {
337
449
  // core invocations are greater than this minter's max
338
450
  // invocations, indicating that minting must have occurred on
339
451
  // another minter. update the minter's `maxHasBeenInvoked` to
340
452
  // true to prevent any false negatives on
341
453
  // `getMaxHasBeenInvoked'
342
- _maxInvocationsProjectConfig.maxHasBeenInvoked = true;
343
- // @dev do not return true, because we did not change the value
454
+ maxInvocationsProjectConfig.maxHasBeenInvoked = true;
455
+ // @dev do not emit event, because we did not change the value
344
456
  // of minter-local max invocations
345
457
  }
346
458
  }
347
459
  }
460
+
461
+ /**
462
+ * @notice Loads the MaxInvocationsProjectConfig for a given project and core
463
+ * contract.
464
+ * @param projectId Project Id to get config for
465
+ * @param coreContract Core contract address to get config for
466
+ */
467
+ function getMaxInvocationsProjectConfig(
468
+ uint256 projectId,
469
+ address coreContract
470
+ ) internal view returns (MaxInvocationsProjectConfig storage) {
471
+ return s().maxInvocationsProjectConfigs[coreContract][projectId];
472
+ }
473
+
474
+ /**
475
+ * @notice Return the storage struct for reading and writing. This library
476
+ * uses a diamond storage pattern when managing storage.
477
+ * @return storageStruct The MaxInvocationsLibStorage struct.
478
+ */
479
+ function s()
480
+ internal
481
+ pure
482
+ returns (MaxInvocationsLibStorage storage storageStruct)
483
+ {
484
+ bytes32 position = MAX_INVOCATIONS_LIB_STORAGE_POSITION;
485
+ assembly ("memory-safe") {
486
+ storageStruct.slot := position
487
+ }
488
+ }
348
489
  }