@artblocks/contracts 1.3.1 → 1.4.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 (234) hide show
  1. package/README.md +11 -10
  2. package/artifacts/contracts/AdminACLV0RoyaltyRegistry.sol/AdminACLV0RoyaltyRegistry.json +193 -0
  3. package/artifacts/contracts/AdminACLV0RoyaltyRegistry.sol/IRoyaltyRegistry.json +35 -0
  4. package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
  5. package/artifacts/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2.sol/BytecodeStorageReaderContractV2.json +2 -2
  6. package/artifacts/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2_Web3Call.sol/BytecodeStorageReaderContractV2_Web3Call.json +2 -2
  7. package/artifacts/contracts/BytecodeStorageV2Writer.sol/BytecodeStorageV2Writer.json +2 -2
  8. package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +210 -2
  9. package/artifacts/contracts/GenArt721CoreV3_Curated.sol/GenArt721CoreV3_Curated.json +235 -20
  10. package/artifacts/contracts/GenArt721CoreV3_Curated_Flex.sol/GenArt721CoreV3_Curated_Flex.json +3197 -0
  11. package/artifacts/contracts/GenArt721CoreV3_Explorations_Flex.sol/GenArt721CoreV3_Explorations_Flex.json +3192 -0
  12. package/artifacts/contracts/OwnedCreate2FactoryV0.sol/OwnedCreate2FactoryV0.json +2 -2
  13. package/artifacts/contracts/archive/GenArt721CoreV3.sol/GenArt721CoreV3.json +27 -2
  14. package/artifacts/contracts/archive/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +27 -2
  15. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol/MinterDAExpV2.json +2 -2
  16. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol/MinterDAExpV3.json +2 -2
  17. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV4.sol/MinterDAExpV4.json +2 -2
  18. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol/MinterDAExpSettlementV0.json +2 -2
  19. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV1.sol/MinterDAExpSettlementV1.json +2 -2
  20. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +2 -2
  21. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV2.sol/MinterDALinV2.json +2 -2
  22. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV3.sol/MinterDALinV3.json +2 -2
  23. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV4.sol/MinterDALinV4.json +2 -2
  24. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV1.sol/MinterHolderV1.json +2 -2
  25. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +2 -2
  26. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV3.sol/MinterHolderV3.json +2 -2
  27. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV4.sol/MinterHolderV4.json +2 -2
  28. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV1.sol/MinterMerkleV1.json +2 -2
  29. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV2.sol/MinterMerkleV2.json +2 -2
  30. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol/MinterMerkleV3.json +2 -2
  31. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol/MinterMerkleV4.json +2 -2
  32. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV5.sol/MinterMerkleV5.json +2 -2
  33. package/artifacts/contracts/archive/minter-suite/Minters/MinterPolyptych/MinterPolyptychV0.sol/IGenArt721CoreContractV3WithRandomizer.json +25 -0
  34. package/artifacts/contracts/archive/minter-suite/Minters/MinterPolyptych/MinterPolyptychV0.sol/MinterPolyptychV0.json +2 -2
  35. package/artifacts/contracts/archive/minter-suite/Minters/MinterSEA/MinterSEAV0.sol/MinterSEAV0.json +2 -2
  36. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol/MinterSetPriceV2.json +2 -2
  37. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol/MinterSetPriceV3.json +2 -2
  38. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV4.sol/MinterSetPriceV4.json +2 -2
  39. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol/MinterSetPriceERC20V2.json +2 -2
  40. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol/MinterSetPriceERC20V3.json +2 -2
  41. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V4.sol/MinterSetPriceERC20V4.json +2 -2
  42. package/artifacts/contracts/engine/V3/EngineFactoryV0.sol/EngineFactoryV0.json +28 -2
  43. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +239 -20
  44. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +267 -48
  45. package/artifacts/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol/GenArt721CoreV3_Engine_Flex_PROOF.json +27 -2
  46. package/artifacts/contracts/engine/V3/forks/PROHIBITION/AdminACLV0_PROHIBITION.sol/AdminACLV0_PROHIBITION.json +2 -2
  47. package/artifacts/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol/GenArt721CoreV3_Engine_Flex_PROHIBITION.json +27 -2
  48. package/artifacts/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.json +25 -0
  49. package/artifacts/contracts/engine/V3/transfer-hooks/AbstractTransferHook.sol/AbstractTransferHook.json +79 -0
  50. package/artifacts/contracts/engine/V3/transfer-hooks/OwnerHistoryTransferHook.sol/OwnerHistoryTransferHook.json +315 -0
  51. package/artifacts/contracts/generator/GenArt721GeneratorV0.sol/GenArt721GeneratorV0.json +2 -2
  52. package/artifacts/contracts/interfaces/v0.8.x/IClaimMinter.sol/IClaimMinter.json +189 -0
  53. package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +149 -0
  54. package/artifacts/contracts/interfaces/v0.8.x/IEngineFactoryV0.sol/IEngineFactoryV0.json +26 -0
  55. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3.sol/IGenArt721CoreContractV3.json +25 -0
  56. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol/IGenArt721CoreContractV3_Base.json +25 -0
  57. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol/IGenArt721CoreContractV3_Engine.json +123 -0
  58. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol/IGenArt721CoreContractV3_Engine_Flex.json +123 -0
  59. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.sol/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.json +25 -0
  60. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_PreV3p2.sol/IGenArt721CoreContractV3_Engine_PreV3p2.json +25 -0
  61. package/artifacts/contracts/interfaces/v0.8.x/IOwnerHistoryTransferHook.sol/IOwnerHistoryTransferHook.json +299 -0
  62. package/artifacts/contracts/interfaces/v0.8.x/IPMPV0.sol/IPMPV0.json +7 -1
  63. package/artifacts/contracts/interfaces/v0.8.x/ISRHooks.sol/ISRHooks.json +432 -0
  64. package/artifacts/contracts/interfaces/v0.8.x/ISeaDropShimForContract.sol/ISeaDropShimForContract.json +0 -13
  65. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterTieredAllowV0.sol/ISharedMinterTieredAllowV0.json +94 -0
  66. package/artifacts/contracts/interfaces/v0.8.x/ITransferHook.sol/ITransferHook.json +63 -0
  67. package/artifacts/contracts/libs/v0.8.x/AuthLib.sol/AuthLib.json +2 -2
  68. package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV2.sol/BytecodeStorageReader.json +2 -2
  69. package/artifacts/contracts/libs/v0.8.x/BytecodeStorageV2.sol/BytecodeStorageWriter.json +2 -2
  70. package/artifacts/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol/DependencyRegistryStorageLib.json +2 -2
  71. package/artifacts/contracts/libs/v0.8.x/ENSLib.sol/ENSLib.json +10 -0
  72. package/artifacts/contracts/libs/v0.8.x/ENSLib.sol/IUniversalResolver.json +45 -0
  73. package/artifacts/contracts/libs/v0.8.x/EnumerableSetUint16.sol/EnumerableSetUint16.json +10 -0
  74. package/artifacts/contracts/libs/v0.8.x/FeistelWalkLib.sol/FeistelWalkLib.json +10 -0
  75. package/artifacts/contracts/libs/v0.8.x/ImmutableUint16Array.sol/ImmutableUint16Array.json +10 -0
  76. package/artifacts/contracts/libs/v0.8.x/V3EngineLib.sol/V3EngineLib.json +163 -0
  77. package/artifacts/contracts/libs/v0.8.x/V3FlexLib.sol/V3FlexLib.json +2 -2
  78. package/artifacts/contracts/libs/v0.8.x/V3TransferHookLib.sol/V3TransferHookLib.json +79 -0
  79. package/artifacts/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol/MaxInvocationsLib.json +2 -2
  80. package/artifacts/contracts/libs/v0.8.x/minter-libs/OnChainAllowlistLib.sol/OnChainAllowlistLib.json +10 -0
  81. package/artifacts/contracts/libs/v0.8.x/minter-libs/PolyptychLib.sol/PolyptychLib.json +2 -2
  82. package/artifacts/contracts/libs/v0.8.x/minter-libs/RAMLib.sol/RAMLib.json +2 -2
  83. package/artifacts/contracts/libs/v0.8.x/minter-libs/SEALib.sol/SEALib.json +2 -2
  84. package/artifacts/contracts/libs/v0.8.x/minter-libs/SettlementExpLib.sol/SettlementExpLib.json +2 -2
  85. package/artifacts/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol/SplitFundsLib.json +2 -2
  86. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV1.sol/MinterFilterV1.json +2 -2
  87. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV2.sol/MinterFilterV2.json +2 -2
  88. package/artifacts/contracts/minter-suite/Minters/MinterDAExpHolderV5.sol/MinterDAExpHolderV5.json +2 -2
  89. package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV3.sol/MinterDAExpSettlementV3.json +2 -2
  90. package/artifacts/contracts/minter-suite/Minters/MinterDAExpV5.sol/MinterDAExpV5.json +2 -2
  91. package/artifacts/contracts/minter-suite/Minters/MinterDALinHolderV5.sol/MinterDALinHolderV5.json +2 -2
  92. package/artifacts/contracts/minter-suite/Minters/MinterDALinV5.sol/MinterDALinV5.json +2 -2
  93. package/artifacts/contracts/minter-suite/Minters/MinterMinPriceMerkleV0.sol/MinterMinPriceMerkleV0.json +2 -2
  94. package/artifacts/contracts/minter-suite/Minters/MinterMinPriceV0.sol/MinterMinPriceV0.json +2 -2
  95. package/artifacts/contracts/minter-suite/Minters/MinterRAMV0.sol/MinterRAMV0.json +2 -2
  96. package/artifacts/contracts/minter-suite/Minters/MinterSEAV1.sol/MinterSEAV1.json +2 -2
  97. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V5.sol/MinterSetPriceERC20V5.json +2 -2
  98. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceHolderV5.sol/MinterSetPriceHolderV5.json +2 -2
  99. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceMerkleV5.sol/MinterSetPriceMerkleV5.json +2 -2
  100. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceOnChainAllowV0.sol/MinterSetPriceOnChainAllowV0.json +522 -0
  101. package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychERC20V5.sol/MinterSetPricePolyptychERC20V5.json +2 -2
  102. package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol/MinterSetPricePolyptychV5.json +2 -2
  103. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceTieredAllowV1.sol/MinterSetPriceTieredAllowV1.json +715 -0
  104. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV5.sol/MinterSetPriceV5.json +2 -2
  105. package/artifacts/contracts/minter-suite/Minters/MinterSlidingScaleV0.sol/MinterSlidingScaleV0.json +431 -0
  106. package/artifacts/contracts/minter-suite/Minters/one-off/ClaimMinter.sol/ClaimMinter.json +502 -0
  107. package/artifacts/contracts/minter-suite/Minters/one-off/MinterSetPriceTieredOnChainAllowV0.sol/MinterSetPriceTieredOnChainAllowV0.json +673 -0
  108. package/artifacts/contracts/minter-suite/Minters/one-off/MinterSetPriceV5_SingleCore.sol/MinterSetPriceV5_SingleCore.json +2 -2
  109. package/artifacts/contracts/minter-suite/Minters/one-off/SeaDropXArtBlocksShim.sol/SeaDropXArtBlocksShim.json +6 -19
  110. package/artifacts/contracts/mock/BytecodeV2TextCR_DMock.sol/BytecodeV2TextCR_DMock.json +2 -2
  111. package/artifacts/contracts/mock/DummySharedMinter.sol/DummySharedMinter.json +2 -2
  112. package/artifacts/contracts/mock/ENSLibMock.sol/ENSLibMock.json +30 -0
  113. package/artifacts/contracts/mock/EnumerableSetUint16Mock.sol/EnumerableSetUint16Mock.json +146 -0
  114. package/artifacts/contracts/mock/FeistelWalkLibMock.sol/FeistelWalkLibMock.json +142 -0
  115. package/artifacts/contracts/mock/ForceSendMock.sol/ForceSendMock.json +2 -2
  116. package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +2 -2
  117. package/artifacts/contracts/mock/ImmutableUint16ArrayMock.sol/ImmutableUint16ArrayMock.json +89 -0
  118. package/artifacts/contracts/mock/MockAdminACLV0_PROHIBITION.sol/MockAdminACLV0Events_PROHIBITION.json +2 -2
  119. package/artifacts/contracts/mock/MockGenArt721V3Core.sol/MockGenArt721V3Core.json +490 -0
  120. package/artifacts/contracts/mock/MockPMP.sol/MockPMP.json +523 -0
  121. package/artifacts/contracts/mock/MockPMPAugmentHook.sol/MockPMPAugmentHook.json +2 -2
  122. package/artifacts/contracts/mock/MockPMPConfigureHook.sol/MockPMPConfigureHook.json +2 -2
  123. package/artifacts/contracts/mock/MockTransferHook.sol/MockTransferHook.json +453 -0
  124. package/artifacts/contracts/mock/MockTransferHookTestHelpers.sol/MockBatchTransferrer.json +39 -0
  125. package/artifacts/contracts/mock/MockTransferHookTestHelpers.sol/MockForwardingERC721Receiver.json +71 -0
  126. package/artifacts/contracts/mock/MockTransferHookTestHelpers.sol/MockSpoofingCore.json +94 -0
  127. package/artifacts/contracts/mock/RandomizerV2_NoAssignMock.sol/RandomizerV2_NoAssignMock.json +2 -2
  128. package/artifacts/contracts/mock/ReentrancyBatchMockShared.sol/IBatchMinter.json +64 -0
  129. package/artifacts/contracts/mock/ReentrancyBatchMockShared.sol/ReentrancyBatchMockShared.json +113 -0
  130. package/artifacts/contracts/mock/RelayExecutorTestHelper.sol/MockTarget.json +74 -0
  131. package/artifacts/contracts/mock/RelayExecutorTestHelper.sol/RelayExecutorPartialRevertsTestHelper.json +138 -0
  132. package/artifacts/contracts/mock/RelayExecutorTestHelper.sol/RelayExecutorTestHelper.json +119 -0
  133. package/artifacts/contracts/randomizer/deprecated/PolyptychRandomizerV0.sol/BasicPolyptychRandomizerV0.json +2 -2
  134. package/artifacts/contracts/randomizer/deprecated/RandomizerV2.sol/BasicRandomizerV2.json +2 -2
  135. package/artifacts/contracts/randomizer/shared/SharedRandomizerV0.sol/SharedRandomizerV0.json +2 -2
  136. package/artifacts/contracts/relay/RelayExecutor.sol/RelayExecutor.json +101 -0
  137. package/artifacts/contracts/relay/RelayExecutorPartialReverts.sol/RelayExecutorPartialReverts.json +120 -0
  138. package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverrideSplits.sol/GenArt721RoyaltyOverrideSplits.json +263 -0
  139. package/artifacts/contracts/utils/MintMulticallUtil.sol/IMinterSetPriceV5.json +40 -0
  140. package/artifacts/contracts/utils/MintMulticallUtil.sol/MintMulticallUtil.json +163 -0
  141. package/artifacts/contracts/web3call/PMPV0.sol/PMPV0.json +9 -3
  142. package/artifacts/contracts/web3call/PMPV1.sol/PMPV1.json +648 -0
  143. package/artifacts/contracts/web3call/augment-hooks/InjectBaseGasFee.sol/InjectBaseGasFee.json +2 -2
  144. package/artifacts/contracts/web3call/augment-hooks/InjectBlockHeight.sol/InjectBlockHeight.json +83 -0
  145. package/artifacts/contracts/web3call/augment-hooks/InjectBlockHeightAndArtistProjectOverrides.sol/InjectBlockHeightAndArtistProjectOverrides.json +226 -0
  146. package/artifacts/contracts/web3call/augment-hooks/InjectBlockHeightAndNumOwnedProjectTokens.sol/InjectBlockHeightAndNumOwnedProjectTokens.json +182 -0
  147. package/artifacts/contracts/web3call/augment-hooks/InjectBlockHeightProjectInvocationsAndArtistProjectOverrides.sol/InjectBlockHeightProjectInvocationsAndArtistProjectOverrides.json +226 -0
  148. package/artifacts/contracts/web3call/augment-hooks/InjectBlockTimestamp.sol/InjectBlockTimestamp.json +83 -0
  149. package/artifacts/contracts/web3call/augment-hooks/InjectBytesPerToken.sol/InjectBytesPerToken.json +358 -0
  150. package/artifacts/contracts/web3call/augment-hooks/InjectChromieSquiggleFloorPrice.sol/InjectChromieSquiggleFloorPrice.json +2 -2
  151. package/artifacts/contracts/web3call/augment-hooks/InjectIsNounsDaoMember.sol/InjectIsNounsDaoMember.json +2 -2
  152. package/artifacts/contracts/web3call/augment-hooks/InjectIsProjectFullyMinted.sol/InjectIsProjectFullyMinted.json +2 -2
  153. package/artifacts/contracts/web3call/augment-hooks/InjectPolyptychTokenHash.sol/InjectPolyptychTokenHash.json +2 -2
  154. package/artifacts/contracts/web3call/augment-hooks/InjectTokenHashSeed.sol/InjectTokenHashSeed.json +2 -2
  155. package/artifacts/contracts/web3call/augment-hooks/InjectTokenOwner.sol/InjectTokenOwner.json +2 -2
  156. package/artifacts/contracts/web3call/augment-hooks/InjectTokenOwnerEthBalance.sol/InjectTokenOwnerEthBalance.json +2 -2
  157. package/artifacts/contracts/web3call/augment-hooks/InjectUSDCTotalSupply.sol/InjectUSDCTotalSupply.json +2 -2
  158. package/artifacts/contracts/web3call/augment-hooks/SRHooks.sol/SRHooks.json +899 -0
  159. package/artifacts/contracts/web3call/combined-hooks/LiftHooks.sol/IGenArt721V0_Minimal.json +30 -0
  160. package/artifacts/contracts/web3call/combined-hooks/LiftHooks.sol/IRelic.json +35 -0
  161. package/artifacts/contracts/web3call/combined-hooks/LiftHooks.sol/LiftHooks.json +256 -0
  162. package/artifacts/contracts/web3call/configure-hooks/{abstractPMPConfigureHook.sol → AbstractPMPConfigureHook.sol}/AbstractPMPConfigureHook.json +1 -1
  163. package/artifacts/contracts/web3call/configure-hooks/PMPConfigureLockHook.sol/PMPConfigureLockHook.json +195 -0
  164. package/contracts/AdminACLV0RoyaltyRegistry.sol +142 -0
  165. package/contracts/DependencyRegistryV0.sol +143 -13
  166. package/contracts/GenArt721CoreV3_Curated.sol +1 -1
  167. package/contracts/GenArt721CoreV3_Curated_Flex.sol +173 -0
  168. package/contracts/GenArt721CoreV3_Explorations_Flex.sol +159 -0
  169. package/contracts/engine/V3/EngineFactoryV0.sol +20 -1
  170. package/contracts/engine/V3/GenArt721CoreV3_Engine.sol +286 -299
  171. package/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol +292 -301
  172. package/contracts/engine/V3/transfer-hooks/AbstractTransferHook.sol +101 -0
  173. package/contracts/engine/V3/transfer-hooks/OwnerHistoryTransferHook.sol +291 -0
  174. package/contracts/generator/GenArt721GeneratorV0.sol +145 -47
  175. package/contracts/helpers/ERC1967ProxyImport.sol +5 -0
  176. package/contracts/interfaces/v0.8.x/IArtblocksRoyaltyOverride.sol +1 -1
  177. package/contracts/interfaces/v0.8.x/IClaimMinter.sol +70 -0
  178. package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +95 -0
  179. package/contracts/interfaces/v0.8.x/IEngineFactoryV0.sol +15 -0
  180. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol +21 -2
  181. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol +72 -0
  182. package/contracts/interfaces/v0.8.x/IOwnerHistoryTransferHook.sol +119 -0
  183. package/contracts/interfaces/v0.8.x/IPMPV0.sol +5 -3
  184. package/contracts/interfaces/v0.8.x/ISRHooks.sol +229 -0
  185. package/contracts/interfaces/v0.8.x/ISeaDropShimForContract.sol +0 -6
  186. package/contracts/interfaces/v0.8.x/ISharedMinterTieredAllowV0.sol +69 -0
  187. package/contracts/interfaces/v0.8.x/ITransferHook.sol +48 -0
  188. package/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol +12 -0
  189. package/contracts/libs/v0.8.x/ENSLib.sol +85 -0
  190. package/contracts/libs/v0.8.x/EnumerableSetUint16.sol +429 -0
  191. package/contracts/libs/v0.8.x/FeistelWalkLib.sol +221 -0
  192. package/contracts/libs/v0.8.x/ImmutableUint16Array.sol +201 -0
  193. package/contracts/libs/v0.8.x/V3EngineLib.sol +490 -0
  194. package/contracts/libs/v0.8.x/V3TransferHookLib.sol +251 -0
  195. package/contracts/libs/v0.8.x/minter-libs/OnChainAllowlistLib.sol +165 -0
  196. package/contracts/minter-suite/Minters/MinterSetPriceOnChainAllowV0.sol +632 -0
  197. package/contracts/minter-suite/Minters/MinterSetPriceTieredAllowV1.sol +871 -0
  198. package/contracts/minter-suite/Minters/MinterSlidingScaleV0.sol +493 -0
  199. package/contracts/minter-suite/Minters/one-off/ClaimMinter.sol +595 -0
  200. package/contracts/minter-suite/Minters/one-off/MinterSetPriceTieredOnChainAllowV0.sol +894 -0
  201. package/contracts/minter-suite/Minters/one-off/SeaDropXArtBlocksShim.sol +59 -41
  202. package/contracts/mock/ENSLibMock.sol +25 -0
  203. package/contracts/mock/EnumerableSetUint16Mock.sol +88 -0
  204. package/contracts/mock/FeistelWalkLibMock.sol +81 -0
  205. package/contracts/mock/ImmutableUint16ArrayMock.sol +62 -0
  206. package/contracts/mock/MockGenArt721V3Core.sol +416 -0
  207. package/contracts/mock/MockPMP.sol +287 -0
  208. package/contracts/mock/MockTransferHook.sol +160 -0
  209. package/contracts/mock/MockTransferHookTestHelpers.sol +96 -0
  210. package/contracts/mock/ReentrancyBatchMockShared.sol +53 -0
  211. package/contracts/mock/RelayExecutorTestHelper.sol +44 -0
  212. package/contracts/relay/RelayExecutor.sol +61 -0
  213. package/contracts/relay/RelayExecutorPartialReverts.sol +79 -0
  214. package/contracts/royalty-registry/GenArt721RoyaltyOverrideSplits.sol +130 -0
  215. package/contracts/utils/MintMulticallUtil.sol +103 -0
  216. package/contracts/web3call/PMPV0.sol +92 -98
  217. package/contracts/web3call/PMPV1.sol +1204 -0
  218. package/contracts/web3call/augment-hooks/AbstractPMPAugmentHook.sol +1 -1
  219. package/contracts/web3call/augment-hooks/InjectBaseGasFee.sol +1 -1
  220. package/contracts/web3call/augment-hooks/InjectBlockHeight.sol +57 -0
  221. package/contracts/web3call/augment-hooks/InjectBlockHeightAndArtistProjectOverrides.sol +310 -0
  222. package/contracts/web3call/augment-hooks/InjectBlockHeightAndNumOwnedProjectTokens.sol +141 -0
  223. package/contracts/web3call/augment-hooks/InjectBlockHeightProjectInvocationsAndArtistProjectOverrides.sol +326 -0
  224. package/contracts/web3call/augment-hooks/InjectBlockTimestamp.sol +57 -0
  225. package/contracts/web3call/augment-hooks/InjectBytesPerToken.sol +279 -0
  226. package/contracts/web3call/augment-hooks/InjectIsProjectFullyMinted.sol +1 -1
  227. package/contracts/web3call/augment-hooks/InjectTokenHashSeed.sol +1 -1
  228. package/contracts/web3call/augment-hooks/InjectTokenOwner.sol +1 -1
  229. package/contracts/web3call/augment-hooks/InjectTokenOwnerEthBalance.sol +1 -1
  230. package/contracts/web3call/augment-hooks/SRHooks.sol +1722 -0
  231. package/contracts/web3call/combined-hooks/LiftHooks.sol +304 -0
  232. package/contracts/web3call/configure-hooks/{abstractPMPConfigureHook.sol → AbstractPMPConfigureHook.sol} +1 -1
  233. package/contracts/web3call/configure-hooks/PMPConfigureLockHook.sol +107 -0
  234. package/package.json +40 -25
@@ -0,0 +1,201 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ pragma solidity ^0.8.0;
5
+
6
+ import {SSTORE2} from "./SSTORE2.sol"; // Import SSTORE2 library
7
+
8
+ /**
9
+ * @title ImmutableUint16Array
10
+ * @author Art Blocks Inc.
11
+ * @notice This library is optimized to store immutable arrays of uint16 values much more efficiently than using native Solidity storage arrays.
12
+ * It uses a single SSTORE2 contract to store the length + packed uint16 values
13
+ * Allows overwriting the pointer to point to a new immutable array.
14
+ */
15
+ library ImmutableUint16Array {
16
+ /**
17
+ * @notice Struct to store the SSTORE2 pointer to the packed uint16 array.
18
+ * @dev dataPointer is the SSTORE2 pointer to the packed uint16 array. Assigned to address(0) if the array is empty.
19
+ */
20
+ struct Uint16Array {
21
+ address dataPointer; // SSTORE2 pointer storing length + packed uint16 values
22
+ }
23
+
24
+ /**
25
+ * @notice Stores a packed immutable uint16 array using a single SSTORE2 contract.
26
+ * Allows overwriting the pointer to point to a new immutable array.
27
+ * @dev Optimized for the case where the array is empty by assigning the dataPointer to address(0).
28
+ * @param storageArray The storage reference to store the packed array.
29
+ * @param values The array of strings to pack.
30
+ */
31
+ function store(
32
+ Uint16Array storage storageArray,
33
+ uint16[] memory values
34
+ ) internal {
35
+ uint256 arrayLength = values.length;
36
+ // edge case - empty array
37
+ if (arrayLength == 0) {
38
+ storageArray.dataPointer = address(0);
39
+ return;
40
+ }
41
+ // realistically will not overflow uint16, but check for security guarantees
42
+ // @dev no coverage on else (difficulty of triggering)
43
+ require(
44
+ arrayLength <= type(uint16).max,
45
+ "Total bytes length exceeds uint16 limit"
46
+ );
47
+
48
+ // compute total bytes length
49
+ // @dev this is deterministic and can be pre-computed since it is a fixed size array
50
+ uint256 totalBytesLength = arrayLength * 2; // 2 bytes per uint16
51
+
52
+ // prepare the combined storage structure (length + packed uint16 values)
53
+ // @dev 8 bytes for length, totalBytesLength bytes for uint16 values
54
+ // over-allocate 32 bytes for memory safety
55
+ // note: shorten length by 32 bytes at end of function before returning
56
+ uint256 packedDataLength = 8 + totalBytesLength;
57
+ bytes memory packedData = new bytes(packedDataLength + 0x20);
58
+ uint256 ptr;
59
+
60
+ // store the length of the values array in the first 8 bytes of the packedData
61
+ assembly ("memory-safe") {
62
+ ptr := add(packedData, 0x20) // pointer to first byte of packedData
63
+ mstore(ptr, shl(192, arrayLength)) // left-align only 8 bytes in the 32-byte slot
64
+ ptr := add(ptr, 8) // move pointer forward by 8 bytes
65
+ }
66
+
67
+ // pack the values efficiently, using assembly to compile 32 bytes at a time
68
+ for (uint i = 0; i < arrayLength; i += 16) {
69
+ // 16 indices per loop, 2 bytes per index, 32 bytes per loop
70
+ // build the 32 bytes of the current value, 16 uint16 values per loop, left to right
71
+ // handle end of array case
72
+ uint256 maxIndex = i + 16 < arrayLength ? i + 16 : arrayLength;
73
+ bytes32 chunk;
74
+ for (uint j = 0; j < (maxIndex - i); j++) {
75
+ chunk |= bytes32(uint256(values[i + j])) << (240 - (j * 16));
76
+ }
77
+ // store the 32 bytes into the result
78
+ assembly ("memory-safe") {
79
+ // safe to write past end of final array - 32 bytes of buffer at end of array
80
+ mstore(ptr, chunk) // store the 32 bytes into the result
81
+ ptr := add(ptr, 0x20) // move the result pointer forward by 32 bytes
82
+ }
83
+ }
84
+
85
+ // remove the buffer from the packedData bytes array length
86
+ assembly ("memory-safe") {
87
+ ptr := packedData
88
+ mstore(ptr, packedDataLength)
89
+ }
90
+
91
+ // store the packed data in the SSTORE2 contract
92
+ storageArray.dataPointer = SSTORE2.write(packedData);
93
+ }
94
+
95
+ /**
96
+ * @notice Clears the storage array by setting the dataPointer to address(0).
97
+ * @param storageArray The storage reference to clear.
98
+ */
99
+ function clear(Uint16Array storage storageArray) internal {
100
+ storageArray.dataPointer = address(0);
101
+ }
102
+
103
+ function isEmpty(
104
+ Uint16Array storage storageArray
105
+ ) internal view returns (bool) {
106
+ return storageArray.dataPointer == address(0);
107
+ }
108
+
109
+ /**
110
+ * @notice Retrieves the total number of stored uint16 values from SSTORE2.
111
+ * @param storageArray The storage reference containing packed values.
112
+ * @return count The count of stored values.
113
+ */
114
+ function length(
115
+ Uint16Array storage storageArray
116
+ ) internal view returns (uint256 count) {
117
+ // edge case - unassigned dataPointer or empty array
118
+ if (storageArray.dataPointer == address(0)) {
119
+ return 0;
120
+ }
121
+
122
+ // load the packed data from the SSTORE2 contract
123
+ bytes memory allData = SSTORE2.read(storageArray.dataPointer);
124
+ // load the total length of the values array from the first 8 bytes of the SSTORE2 contract
125
+ assembly ("memory-safe") {
126
+ count := shr(192, mload(add(allData, 32))) // skip first 8 bytes (length of the actual bytes array we stored)
127
+ }
128
+ }
129
+
130
+ /**
131
+ * @notice Retrieves a single uint16 value from storage by index.
132
+ * @param storageArray The storage reference containing packed values.
133
+ * @param index The index of the value to retrieve.
134
+ * @return result The retrieved value.
135
+ */
136
+ function get(
137
+ Uint16Array storage storageArray,
138
+ uint256 index
139
+ ) internal view returns (uint16 result) {
140
+ // edge case - unassigned dataPointer or empty array
141
+ if (storageArray.dataPointer == address(0)) {
142
+ revert("Index out of bounds");
143
+ }
144
+ // load the packed data from the SSTORE2 contract
145
+ bytes memory allData = SSTORE2.read(storageArray.dataPointer);
146
+ // load the total length of the values array from the first 8 bytes of the SSTORE2 contract
147
+ uint256 arrayLength;
148
+ assembly ("memory-safe") {
149
+ arrayLength := shr(192, mload(add(allData, 32))) // skip first 8 bytes (length of the actual bytes array we stored)
150
+ }
151
+ require(index < arrayLength, "Index out of bounds");
152
+
153
+ // the location is deterministic and can be pre-computed since it is a fixed size array
154
+ uint256 location = 32 + 8 + (index * 2); // 32 bytes for bytes array length, 8 bytes for overall array length, 2 bytes per index
155
+ // load the value from the packed data
156
+ assembly ("memory-safe") {
157
+ result := shr(240, mload(add(allData, location))) // load the 2 bytes of the value from the packed data
158
+ }
159
+ }
160
+
161
+ /**
162
+ * @notice Retrieves all stored uint16 values in a single batch call.
163
+ * @param storageArray The storage reference containing packed values.
164
+ * @return results An array of all stored values.
165
+ */
166
+ function getAll(
167
+ Uint16Array storage storageArray
168
+ ) internal view returns (uint16[] memory results) {
169
+ // edge case - unassigned dataPointer or empty array
170
+ if (storageArray.dataPointer == address(0)) {
171
+ return new uint16[](0);
172
+ }
173
+ // load the packed data from the SSTORE2 contract
174
+ bytes memory allData = SSTORE2.read(storageArray.dataPointer);
175
+ // load the total length of the values array from the first 8 bytes of the SSTORE2 contract
176
+ uint256 arrayLength;
177
+ assembly ("memory-safe") {
178
+ arrayLength := shr(192, mload(add(allData, 32))) // skip first 8 bytes (length of the actual bytes array we stored)
179
+ }
180
+
181
+ // for each value in the array, populate results
182
+ results = new uint16[](arrayLength);
183
+
184
+ // loop in assembly to access the packed data directly
185
+ assembly ("memory-safe") {
186
+ let ptr := add(allData, 40) // skip first 8 bytes + 32 bytes for bytes array length (length of the actual bytes array we stored)
187
+ for {
188
+ let i := 0
189
+ } lt(i, arrayLength) {
190
+ i := add(i, 1)
191
+ } {
192
+ // @dev in memory, uint16 values are not packed, but are abi-encoded, so we add mul i * 0x20 to get the offset of the value in the results array
193
+ mstore(
194
+ add(results, add(mul(i, 0x20), 0x20)),
195
+ shr(240, mload(ptr))
196
+ ) // store the 2 bytes of the value from the packed data into the results array
197
+ ptr := add(ptr, 2) // move the pointer forward by 2 bytes for next iteration
198
+ }
199
+ }
200
+ }
201
+ }
@@ -0,0 +1,490 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ pragma solidity ^0.8.0;
5
+
6
+ import {IGenArt721CoreContractV3_Base} from "../../interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol";
7
+ import {IGenArt721CoreContractV3_ProjectFinance} from "../../interfaces/v0.8.x/IGenArt721CoreContractV3_ProjectFinance.sol";
8
+ import {ISplitProviderV0} from "../../interfaces/v0.8.x/ISplitProviderV0.sol";
9
+
10
+ import {Strings} from "@openzeppelin-5.0/contracts/utils/Strings.sol";
11
+ import {Bytes32Strings} from "./Bytes32Strings.sol";
12
+
13
+ /**
14
+ * @title Shared helper library for V3 Engine and Engine Flex cores.
15
+ * @author Art Blocks Inc.
16
+ * @notice External library (DELEGATECALL) used by both `GenArt721CoreV3_Engine`
17
+ * and `GenArt721CoreV3_Engine_Flex`. Offloading this logic keeps both cores
18
+ * under the 24KB bytecode size limit while guaranteeing there is exactly one
19
+ * implementation of it, rather than one copy per core.
20
+ * @dev Hosts project-finance logic (ERC-2981 royalty info, primary revenue
21
+ * splits, royalty splitter assignment, artist payment proposals), input
22
+ * validation shared by both cores, and default base URI construction.
23
+ * @dev Events are emitted under the calling core's address because all
24
+ * functions here are reached via DELEGATECALL. Event ordering within each
25
+ * function intentionally matches the ordering of the pre-offload core
26
+ * implementations, so off-chain indexing is unaffected by the refactor.
27
+ */
28
+ library V3EngineLib {
29
+ using Strings for address;
30
+ using Bytes32Strings for bytes32;
31
+
32
+ /// @dev max percentage value for artist/additional payee splits
33
+ uint256 private constant ONE_HUNDRED = 100;
34
+
35
+ /**
36
+ * @notice Payee fields for an artist split proposal or admin acceptance.
37
+ * @dev Grouped into a struct to avoid stack-too-deep in the cores.
38
+ */
39
+ struct ArtistSplitProposal {
40
+ uint256 projectId;
41
+ address payable artistAddress;
42
+ address payable additionalPayeePrimarySales;
43
+ uint256 additionalPayeePrimarySalesPercentage;
44
+ address payable additionalPayeeSecondarySales;
45
+ uint256 additionalPayeeSecondarySalesPercentage;
46
+ }
47
+
48
+ /**
49
+ * @notice ERC-2981 royalty info for a project's finance struct.
50
+ * @param projectFinance Project finance storage for the queried project.
51
+ * @param salePrice Sale price to calculate the royalty amount from.
52
+ * @return receiver Address that should be sent the royalty payment.
53
+ * @return royaltyAmount Royalty payment amount for `salePrice`.
54
+ */
55
+ function royaltyInfo(
56
+ IGenArt721CoreContractV3_ProjectFinance.ProjectFinance
57
+ storage projectFinance,
58
+ uint256 salePrice
59
+ ) external view returns (address receiver, uint256 royaltyAmount) {
60
+ // @dev royalty splitter created upon project creation, so will always
61
+ // exist for a valid token ID
62
+ receiver = projectFinance.royaltySplitter;
63
+ // @dev important to cast to uint256 before multiplying to avoid overflow
64
+ uint256 totalRoyaltyBPS = (100 *
65
+ uint256(projectFinance.secondaryMarketRoyaltyPercentage)) +
66
+ projectFinance.platformProviderSecondarySalesBPS +
67
+ projectFinance.renderProviderSecondarySalesBPS;
68
+ // @dev totalRoyaltyBPS guaranteed to be <= 10,000
69
+ if (totalRoyaltyBPS > 10_000) {
70
+ revert IGenArt721CoreContractV3_Base.GenArt721Error(
71
+ IGenArt721CoreContractV3_Base.ErrorCodes.OverMaxSumOfBPS
72
+ );
73
+ }
74
+ // @dev overflow automatically checked in solidity 0.8
75
+ // @dev totalRoyaltyBPS guaranteed to be <= 10_000, so overflow only
76
+ // possible with unreasonably high salePrice values near uint256 max
77
+ royaltyAmount = (salePrice * totalRoyaltyBPS) / 10_000;
78
+ }
79
+
80
+ /**
81
+ * @notice Primary revenue split view.
82
+ * @dev Three-way split between the render provider, the platform provider,
83
+ * and the artist. Safe to perform given that in the case of loss of
84
+ * precision Solidity will round down.
85
+ */
86
+ function getPrimaryRevenueSplits(
87
+ IGenArt721CoreContractV3_ProjectFinance.ProjectFinance
88
+ storage projectFinance,
89
+ uint256 price,
90
+ uint256 renderProviderPrimarySalesPercentage,
91
+ uint256 platformProviderPrimarySalesPercentage,
92
+ address payable renderProviderPrimarySalesAddress,
93
+ address payable platformProviderPrimarySalesAddress
94
+ )
95
+ external
96
+ view
97
+ returns (
98
+ uint256 renderProviderRevenue_,
99
+ address payable renderProviderAddress_,
100
+ uint256 platformProviderRevenue_,
101
+ address payable platformProviderAddress_,
102
+ uint256 artistRevenue_,
103
+ address payable artistAddress_,
104
+ uint256 additionalPayeePrimaryRevenue_,
105
+ address payable additionalPayeePrimaryAddress_
106
+ )
107
+ {
108
+ uint256 projectFunds = price;
109
+ renderProviderRevenue_ =
110
+ (price * renderProviderPrimarySalesPercentage) /
111
+ ONE_HUNDRED;
112
+ // renderProviderRevenue_ percentage is always <=100, so guaranteed to never underflow
113
+ projectFunds -= renderProviderRevenue_;
114
+ platformProviderRevenue_ =
115
+ (price * platformProviderPrimarySalesPercentage) /
116
+ ONE_HUNDRED;
117
+ // platformProviderRevenue_ percentage is always <=100, so guaranteed to never underflow
118
+ projectFunds -= platformProviderRevenue_;
119
+ additionalPayeePrimaryRevenue_ =
120
+ (projectFunds *
121
+ projectFinance.additionalPayeePrimarySalesPercentage) /
122
+ ONE_HUNDRED;
123
+ // additionalPayeePrimarySalesPercentage is always <=100, so guaranteed
124
+ // to never underflow
125
+ artistRevenue_ = projectFunds - additionalPayeePrimaryRevenue_;
126
+ // set addresses from storage
127
+ renderProviderAddress_ = renderProviderPrimarySalesAddress;
128
+ platformProviderAddress_ = platformProviderPrimarySalesAddress;
129
+ if (artistRevenue_ > 0) {
130
+ artistAddress_ = projectFinance.artistAddress;
131
+ }
132
+ if (additionalPayeePrimaryRevenue_ > 0) {
133
+ additionalPayeePrimaryAddress_ = projectFinance
134
+ .additionalPayeePrimarySales;
135
+ }
136
+ }
137
+
138
+ /**
139
+ * @notice Assign a project's royalty splitter.
140
+ * @dev Loads values from `projectFinance`, so storage must be updated
141
+ * before calling. Includes a trusted splitter-provider interaction that is
142
+ * entrusted not to reenter the core.
143
+ */
144
+ function assignSplitter(
145
+ IGenArt721CoreContractV3_ProjectFinance.ProjectFinance
146
+ storage projectFinance,
147
+ ISplitProviderV0 splitProvider,
148
+ uint256 projectId
149
+ ) external {
150
+ _assignSplitter({
151
+ projectFinance: projectFinance,
152
+ splitProvider: splitProvider,
153
+ projectId: projectId
154
+ });
155
+ }
156
+
157
+ /**
158
+ * @notice Artist proposal of updated payment addresses and splits.
159
+ * Automatically accepts the proposal if no payee addresses are being
160
+ * modified, if the proposal only removes payee addresses, or if
161
+ * `autoApprove` is true.
162
+ * @dev Emits, in order, `ProposedArtistAddressesAndSplits` and — only on
163
+ * automatic acceptance — `ProjectRoyaltySplitterUpdated` followed by
164
+ * `AcceptedArtistAddressesAndSplits`. This ordering matches the
165
+ * pre-offload core implementation and must be preserved.
166
+ * @param proposal Proposed payee addresses and percentages.
167
+ * @param projectFinance Project finance storage for the project.
168
+ * @param proposedHashes Core's `proposedArtistAddressesAndSplitsHash`.
169
+ * @param autoApprove Core's `autoApproveArtistSplitProposals`.
170
+ * @param splitProvider Core's split provider, used on automatic accept.
171
+ */
172
+ function proposeArtistPaymentAddressesAndSplits(
173
+ ArtistSplitProposal memory proposal,
174
+ IGenArt721CoreContractV3_ProjectFinance.ProjectFinance
175
+ storage projectFinance,
176
+ mapping(uint256 => bytes32) storage proposedHashes,
177
+ bool autoApprove,
178
+ ISplitProviderV0 splitProvider
179
+ ) external {
180
+ // checks
181
+ if (
182
+ proposal.additionalPayeePrimarySalesPercentage > ONE_HUNDRED ||
183
+ proposal.additionalPayeeSecondarySalesPercentage > ONE_HUNDRED
184
+ ) {
185
+ revert IGenArt721CoreContractV3_Base.GenArt721Error(
186
+ IGenArt721CoreContractV3_Base.ErrorCodes.MaxOf100Percent
187
+ );
188
+ }
189
+ if (
190
+ proposal.additionalPayeePrimarySalesPercentage > 0 &&
191
+ proposal.additionalPayeePrimarySales == address(0)
192
+ ) {
193
+ revert IGenArt721CoreContractV3_Base.GenArt721Error(
194
+ IGenArt721CoreContractV3_Base
195
+ .ErrorCodes
196
+ .PrimaryPayeeIsZeroAddress
197
+ );
198
+ }
199
+ if (
200
+ proposal.additionalPayeeSecondarySalesPercentage > 0 &&
201
+ proposal.additionalPayeeSecondarySales == address(0)
202
+ ) {
203
+ revert IGenArt721CoreContractV3_Base.GenArt721Error(
204
+ IGenArt721CoreContractV3_Base
205
+ .ErrorCodes
206
+ .SecondaryPayeeIsZeroAddress
207
+ );
208
+ }
209
+ // effects
210
+ // emit event for off-chain indexing
211
+ // note: always emit a proposal event, even in the pathway of
212
+ // automatic approval, to simplify indexing expectations
213
+ emit IGenArt721CoreContractV3_Base.ProposedArtistAddressesAndSplits(
214
+ proposal.projectId,
215
+ proposal.artistAddress,
216
+ proposal.additionalPayeePrimarySales,
217
+ proposal.additionalPayeePrimarySalesPercentage,
218
+ proposal.additionalPayeeSecondarySales,
219
+ proposal.additionalPayeeSecondarySalesPercentage
220
+ );
221
+ // automatically accept if no proposed addresses modifications, or if
222
+ // the proposal only removes payee addresses, or if contract is set to
223
+ // always auto-approve.
224
+ // store proposal hash on-chain, only if not automatic accept
225
+ bool automaticAccept = autoApprove;
226
+ if (!automaticAccept) {
227
+ // block scope to avoid stack too deep error
228
+ bool artistUnchanged = proposal.artistAddress ==
229
+ projectFinance.artistAddress;
230
+ bool additionalPrimaryUnchangedOrRemoved = (proposal
231
+ .additionalPayeePrimarySales ==
232
+ projectFinance.additionalPayeePrimarySales) ||
233
+ (proposal.additionalPayeePrimarySales == address(0));
234
+ bool additionalSecondaryUnchangedOrRemoved = (proposal
235
+ .additionalPayeeSecondarySales ==
236
+ projectFinance.additionalPayeeSecondarySales) ||
237
+ (proposal.additionalPayeeSecondarySales == address(0));
238
+ automaticAccept =
239
+ artistUnchanged &&
240
+ additionalPrimaryUnchangedOrRemoved &&
241
+ additionalSecondaryUnchangedOrRemoved;
242
+ }
243
+ if (automaticAccept) {
244
+ // clear any previously proposed values
245
+ proposedHashes[proposal.projectId] = bytes32(0);
246
+
247
+ // update storage
248
+ // artist address can change during automatic accept if
249
+ // autoApproveArtistSplitProposals is true
250
+ _updateProjectFinancePayees({
251
+ projectFinance: projectFinance,
252
+ proposal: proposal
253
+ });
254
+
255
+ // assign project's splitter
256
+ // @dev only call after all previous storage updates
257
+ _assignSplitter({
258
+ projectFinance: projectFinance,
259
+ splitProvider: splitProvider,
260
+ projectId: proposal.projectId
261
+ });
262
+
263
+ // emit event for off-chain indexing
264
+ emit IGenArt721CoreContractV3_Base.AcceptedArtistAddressesAndSplits(
265
+ proposal.projectId
266
+ );
267
+ } else {
268
+ proposedHashes[proposal.projectId] = _hashProposal(proposal);
269
+ }
270
+ }
271
+
272
+ /**
273
+ * @notice Admin acceptance of a proposed set of payment addresses and
274
+ * splits. Reverts unless `proposal` matches the stored proposal hash.
275
+ * @dev Emits, in order, `ProjectRoyaltySplitterUpdated` followed by
276
+ * `AcceptedArtistAddressesAndSplits`. This ordering matches the
277
+ * pre-offload core implementation and must be preserved.
278
+ * @param proposal Payee addresses and percentages being accepted.
279
+ * @param projectFinance Project finance storage for the project.
280
+ * @param proposedHashes Core's `proposedArtistAddressesAndSplitsHash`.
281
+ * @param splitProvider Core's split provider.
282
+ */
283
+ function adminAcceptArtistAddressesAndSplits(
284
+ ArtistSplitProposal memory proposal,
285
+ IGenArt721CoreContractV3_ProjectFinance.ProjectFinance
286
+ storage projectFinance,
287
+ mapping(uint256 => bytes32) storage proposedHashes,
288
+ ISplitProviderV0 splitProvider
289
+ ) external {
290
+ // checks
291
+ if (proposedHashes[proposal.projectId] != _hashProposal(proposal)) {
292
+ revert IGenArt721CoreContractV3_Base.GenArt721Error(
293
+ IGenArt721CoreContractV3_Base.ErrorCodes.MustMatchArtistProposal
294
+ );
295
+ }
296
+ // effects
297
+ _updateProjectFinancePayees({
298
+ projectFinance: projectFinance,
299
+ proposal: proposal
300
+ });
301
+ // clear proposed values
302
+ proposedHashes[proposal.projectId] = bytes32(0);
303
+
304
+ // assign project's splitter
305
+ // @dev only call after all previous storage updates
306
+ _assignSplitter({
307
+ projectFinance: projectFinance,
308
+ splitProvider: splitProvider,
309
+ projectId: proposal.projectId
310
+ });
311
+
312
+ // emit event for off-chain indexing
313
+ emit IGenArt721CoreContractV3_Base.AcceptedArtistAddressesAndSplits(
314
+ proposal.projectId
315
+ );
316
+ }
317
+
318
+ /**
319
+ * @notice Detailed input validation for a project's aspect ratio string.
320
+ * Reverts unless `aspectRatio` is at most 11 characters, contains at least
321
+ * one digit, and contains no characters other than digits and at most one
322
+ * decimal separator.
323
+ */
324
+ function validateAspectRatio(string memory aspectRatio) external pure {
325
+ bytes memory aspectRatioBytes = bytes(aspectRatio);
326
+ uint256 bytesLength = aspectRatioBytes.length;
327
+ if (bytesLength > 11) {
328
+ revert IGenArt721CoreContractV3_Base.GenArt721Error(
329
+ IGenArt721CoreContractV3_Base.ErrorCodes.AspectRatioTooLong
330
+ );
331
+ }
332
+ bool hasSeenDecimalSeparator = false;
333
+ bool hasSeenNumber = false;
334
+ for (uint256 i; i < bytesLength; i++) {
335
+ bytes1 character = aspectRatioBytes[i];
336
+ // Allow as many #s as desired.
337
+ if (character >= 0x30 && character <= 0x39) {
338
+ // 9-0
339
+ // We need to ensure there is at least 1 `9-0` occurrence.
340
+ hasSeenNumber = true;
341
+ continue;
342
+ }
343
+ if (character == 0x2E) {
344
+ // .
345
+ // Allow no more than 1 `.` occurrence.
346
+ if (!hasSeenDecimalSeparator) {
347
+ hasSeenDecimalSeparator = true;
348
+ continue;
349
+ }
350
+ }
351
+ revert IGenArt721CoreContractV3_Base.GenArt721Error(
352
+ IGenArt721CoreContractV3_Base
353
+ .ErrorCodes
354
+ .AspectRatioImproperFormat
355
+ );
356
+ }
357
+ if (!hasSeenNumber) {
358
+ revert IGenArt721CoreContractV3_Base.GenArt721Error(
359
+ IGenArt721CoreContractV3_Base.ErrorCodes.AspectRatioNoNumbers
360
+ );
361
+ }
362
+ }
363
+
364
+ /**
365
+ * @notice Script type/version format check. Reverts unless
366
+ * `scriptTypeAndVersion` contains exactly one at-sign (0x40) character.
367
+ */
368
+ function validateScriptTypeAndVersion(
369
+ bytes32 scriptTypeAndVersion
370
+ ) external pure {
371
+ if (
372
+ !scriptTypeAndVersion.containsExactCharacterQty({
373
+ utf8CharCode: uint8(bytes1("@")), // 0x40
374
+ targetQty: uint8(1)
375
+ })
376
+ ) {
377
+ revert IGenArt721CoreContractV3_Base.GenArt721Error(
378
+ IGenArt721CoreContractV3_Base
379
+ .ErrorCodes
380
+ .ScriptTypeAndVersionFormat
381
+ );
382
+ }
383
+ }
384
+
385
+ /**
386
+ * @notice Build a core's initial default base URI, of the form
387
+ * `{host}{coreContract}/`.
388
+ * @dev Offloaded from the cores because `Strings.toHexString` is otherwise
389
+ * only reachable from contract initialization, and is a meaningful share
390
+ * of the size-constrained Engine Flex core's bytecode.
391
+ * @param host Base URI prefix, e.g. "https://token.artblocks.io/".
392
+ * @param coreContract Core contract address to embed in the URI.
393
+ */
394
+ function buildDefaultBaseURI(
395
+ string memory host,
396
+ address coreContract
397
+ ) external pure returns (string memory) {
398
+ return string.concat(host, coreContract.toHexString(), "/");
399
+ }
400
+
401
+ /**
402
+ * @notice Write a proposal's payee addresses and percentages to a
403
+ * project's finance storage.
404
+ * @dev Percentages are validated to be <= 100 by the calling function, or
405
+ * by the proposal hash matching a previously validated proposal, so the
406
+ * uint8 casts below cannot truncate.
407
+ */
408
+ function _updateProjectFinancePayees(
409
+ IGenArt721CoreContractV3_ProjectFinance.ProjectFinance
410
+ storage projectFinance,
411
+ ArtistSplitProposal memory proposal
412
+ ) private {
413
+ projectFinance.artistAddress = proposal.artistAddress;
414
+ projectFinance.additionalPayeePrimarySales = proposal
415
+ .additionalPayeePrimarySales;
416
+ // safe to cast as uint8 as max is 100%, max uint8 is 255
417
+ projectFinance.additionalPayeePrimarySalesPercentage = uint8(
418
+ proposal.additionalPayeePrimarySalesPercentage
419
+ );
420
+ projectFinance.additionalPayeeSecondarySales = proposal
421
+ .additionalPayeeSecondarySales;
422
+ // safe to cast as uint8 as max is 100%, max uint8 is 255
423
+ projectFinance.additionalPayeeSecondarySalesPercentage = uint8(
424
+ proposal.additionalPayeeSecondarySalesPercentage
425
+ );
426
+ }
427
+
428
+ /**
429
+ * @notice Hash of a proposal's payee fields, as stored in the core's
430
+ * `proposedArtistAddressesAndSplitsHash` mapping.
431
+ * @dev Encoding must exactly match the pre-offload core implementation, so
432
+ * that proposals made against prior core versions hash identically.
433
+ * `projectId` is intentionally excluded, matching prior behavior.
434
+ */
435
+ function _hashProposal(
436
+ ArtistSplitProposal memory proposal
437
+ ) private pure returns (bytes32) {
438
+ return
439
+ keccak256(
440
+ abi.encode(
441
+ proposal.artistAddress,
442
+ proposal.additionalPayeePrimarySales,
443
+ proposal.additionalPayeePrimarySalesPercentage,
444
+ proposal.additionalPayeeSecondarySales,
445
+ proposal.additionalPayeeSecondarySalesPercentage
446
+ )
447
+ );
448
+ }
449
+
450
+ /**
451
+ * @notice Assign a project's royalty splitter and emit
452
+ * `ProjectRoyaltySplitterUpdated`.
453
+ * @dev Private so that this library's external entry points share a single
454
+ * copy, rather than the logic being inlined into each calling core.
455
+ */
456
+ function _assignSplitter(
457
+ IGenArt721CoreContractV3_ProjectFinance.ProjectFinance
458
+ storage projectFinance,
459
+ ISplitProviderV0 splitProvider,
460
+ uint256 projectId
461
+ ) private {
462
+ // assign project's royalty splitter
463
+ // @dev loads values from storage, so need to ensure storage has been updated
464
+ address royaltySplitter = splitProvider.getOrCreateSplitter(
465
+ ISplitProviderV0.SplitInputs({
466
+ platformProviderSecondarySalesAddress: projectFinance
467
+ .platformProviderSecondarySalesAddress,
468
+ platformProviderSecondarySalesBPS: projectFinance
469
+ .platformProviderSecondarySalesBPS,
470
+ renderProviderSecondarySalesAddress: projectFinance
471
+ .renderProviderSecondarySalesAddress,
472
+ renderProviderSecondarySalesBPS: projectFinance
473
+ .renderProviderSecondarySalesBPS,
474
+ artistTotalRoyaltyPercentage: projectFinance
475
+ .secondaryMarketRoyaltyPercentage,
476
+ artist: projectFinance.artistAddress,
477
+ additionalPayee: projectFinance.additionalPayeeSecondarySales,
478
+ additionalPayeePercentage: projectFinance
479
+ .additionalPayeeSecondarySalesPercentage
480
+ })
481
+ );
482
+
483
+ projectFinance.royaltySplitter = royaltySplitter;
484
+
485
+ emit IGenArt721CoreContractV3_Base.ProjectRoyaltySplitterUpdated({
486
+ projectId: projectId,
487
+ royaltySplitter: royaltySplitter
488
+ });
489
+ }
490
+ }