@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
@@ -38,7 +38,7 @@ abstract contract AbstractPMPAugmentHook is IPMPAugmentHook, ERC165 {
38
38
 
39
39
  function supportsInterface(
40
40
  bytes4 interfaceId
41
- ) public view override(ERC165, IERC165) returns (bool) {
41
+ ) public view virtual override(ERC165, IERC165) returns (bool) {
42
42
  return
43
43
  interfaceId == type(IPMPAugmentHook).interfaceId ||
44
44
  super.supportsInterface(interfaceId);
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: LGPL-3.0-only
2
2
  // Created By: Art Blocks Inc.
3
3
 
4
- pragma solidity ^0.8.0;
4
+ pragma solidity 0.8.22;
5
5
 
6
6
  import {AbstractPMPAugmentHook} from "./AbstractPMPAugmentHook.sol";
7
7
 
@@ -0,0 +1,57 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ pragma solidity 0.8.22;
5
+
6
+ import {AbstractPMPAugmentHook} from "./AbstractPMPAugmentHook.sol";
7
+
8
+ import {IWeb3Call} from "../../interfaces/v0.8.x/IWeb3Call.sol";
9
+ import {Strings} from "@openzeppelin-5.0/contracts/utils/Strings.sol";
10
+
11
+ /**
12
+ * @title InjectBlockHeight
13
+ * @author Art Blocks Inc.
14
+ * @notice This hook injects the current block height into a token's PMPs.
15
+ */
16
+ contract InjectBlockHeight is AbstractPMPAugmentHook {
17
+ using Strings for uint256;
18
+
19
+ /**
20
+ * @notice Augment the token parameters for a given token.
21
+ * Appends the block height into a tokens PMPs.
22
+ * @dev This hook is called when a token's PMPs are read.
23
+ * @dev This must return all desired tokenParams, not just additional data.
24
+ * @param tokenParams The token parameters for the queried token.
25
+ * @return augmentedTokenParams The augmented token parameters.
26
+ */
27
+ function onTokenPMPReadAugmentation(
28
+ address /* coreContract */,
29
+ uint256 /* tokenId */,
30
+ IWeb3Call.TokenParam[] calldata tokenParams
31
+ )
32
+ external
33
+ view
34
+ override
35
+ returns (IWeb3Call.TokenParam[] memory augmentedTokenParams)
36
+ {
37
+ // create a new tokenParam array with one extra element
38
+ uint256 originalLength = tokenParams.length;
39
+ uint256 newLength = originalLength + 1;
40
+ augmentedTokenParams = new IWeb3Call.TokenParam[](newLength);
41
+
42
+ // copy the original tokenParams into the new array
43
+ for (uint256 i = 0; i < originalLength; i++) {
44
+ augmentedTokenParams[i] = tokenParams[i];
45
+ }
46
+
47
+ // get + inject the block height into the new array
48
+ uint256 currentBlock = block.number;
49
+ augmentedTokenParams[originalLength] = IWeb3Call.TokenParam({
50
+ key: "blockHeight",
51
+ value: currentBlock.toString()
52
+ });
53
+
54
+ // return the augmented tokenParams
55
+ return augmentedTokenParams;
56
+ }
57
+ }
@@ -0,0 +1,310 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ pragma solidity 0.8.22;
5
+
6
+ import {AbstractPMPAugmentHook} from "./AbstractPMPAugmentHook.sol";
7
+ import {ABHelpers} from "../../libs/v0.8.x/ABHelpers.sol";
8
+
9
+ import {IWeb3Call} from "../../interfaces/v0.8.x/IWeb3Call.sol";
10
+ import {IGenArt721CoreContractV3_Base} from "../../interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol";
11
+
12
+ import {Strings} from "@openzeppelin-5.0/contracts/utils/Strings.sol";
13
+ import {EnumerableMap} from "@openzeppelin-5.0/contracts/utils/structs/EnumerableMap.sol";
14
+
15
+ /**
16
+ * @title InjectBlockHeightAndArtistProjectOverrides
17
+ * @author Art Blocks Inc.
18
+ * @notice This hook appends the current block height and artist project overrides into a token's PMPs.
19
+ * If an input PMP has a key that matches an artist project override, the artist project override value will be used.
20
+ * If an override value is not in the input PMPs, it will be appended to the output, ensuring that the output always contains all override values.
21
+ * @dev This contract is developed open-source, is lightly tested, and should be used at your own risk.
22
+ * The artist can set and clear overrides for a project via the `artistSetProjectOverride` and `artistClearProjectOverride` functions.
23
+ * The artist can only set and clear overrides for their own projects.
24
+ * This contract is not owned, and intended to integrate with Art Blocks core contracts that conform to IGenArt721CoreContractV3_Base.
25
+ */
26
+ contract InjectBlockHeightAndArtistProjectOverrides is AbstractPMPAugmentHook {
27
+ using Strings for uint256;
28
+ using EnumerableMap for EnumerableMap.Bytes32ToBytes32Map;
29
+
30
+ event ArtistProjectOverrideSet(
31
+ address indexed coreContract,
32
+ uint256 indexed projectId,
33
+ string key,
34
+ string value
35
+ );
36
+
37
+ event ArtistProjectOverrideCleared(
38
+ address indexed coreContract,
39
+ uint256 indexed projectId,
40
+ string key
41
+ );
42
+
43
+ // enumerable mapping of project to artist pmp overrides
44
+ // @dev key/value pairs are stored as bytes32 values for gas efficiency and standard library compatibility
45
+ mapping(address coreContract => mapping(uint256 projectId => EnumerableMap.Bytes32ToBytes32Map enumerableOverrides))
46
+ private artistProjectOverrides;
47
+
48
+ /**
49
+ * @notice Set a project override for a given key.
50
+ * Only the artist of the project can set the project override.
51
+ * @dev intentionally does not emit events - artist overrides are intended to be not indexed.
52
+ * @param coreContract The address of the core contract.
53
+ * @param projectId The ID of the project.
54
+ * @param key The key to set.
55
+ * @param value The value to set.
56
+ */
57
+ function artistSetProjectOverride(
58
+ address coreContract,
59
+ uint256 projectId,
60
+ string memory key,
61
+ string memory value
62
+ ) external {
63
+ // CHECKS
64
+ _onlyArtist({
65
+ caller: msg.sender,
66
+ coreContract: coreContract,
67
+ projectId: projectId
68
+ });
69
+
70
+ // EFFECTS
71
+ EnumerableMap.Bytes32ToBytes32Map
72
+ storage overrides = artistProjectOverrides[coreContract][projectId];
73
+ overrides.set(_toBytes32(key), _toBytes32(value));
74
+
75
+ emit ArtistProjectOverrideSet({
76
+ coreContract: coreContract,
77
+ projectId: projectId,
78
+ key: key,
79
+ value: value
80
+ });
81
+ }
82
+
83
+ /**
84
+ * @notice Clear a project override for a given key.
85
+ * Only the artist of the project can clear the project override.
86
+ * @dev intentionally does not emit events - artist overrides are intended to be not indexed.
87
+ * @param coreContract The address of the core contract.
88
+ * @param projectId The ID of the project.
89
+ * @param key The key to clear.
90
+ */
91
+ function artistClearProjectOverride(
92
+ address coreContract,
93
+ uint256 projectId,
94
+ string memory key
95
+ ) external {
96
+ // CHECKS
97
+ _onlyArtist({
98
+ caller: msg.sender,
99
+ coreContract: coreContract,
100
+ projectId: projectId
101
+ });
102
+
103
+ // EFFECTS
104
+ EnumerableMap.Bytes32ToBytes32Map
105
+ storage overrides = artistProjectOverrides[coreContract][projectId];
106
+ require(overrides.remove(_toBytes32(key)), "Key not found");
107
+
108
+ emit ArtistProjectOverrideCleared({
109
+ coreContract: coreContract,
110
+ projectId: projectId,
111
+ key: key
112
+ });
113
+ }
114
+
115
+ /**
116
+ * @notice Get the artist project overrides for a given project.
117
+ * @dev This function is used to get the artist project overrides for a given project.
118
+ * @param coreContract The address of the core contract.
119
+ * @param projectId The ID of the project.
120
+ * @return projectOverrides The artist project overrides for the given project.
121
+ */
122
+ function getArtistProjectOverrides(
123
+ address coreContract,
124
+ uint256 projectId
125
+ ) external view returns (IWeb3Call.TokenParam[] memory projectOverrides) {
126
+ EnumerableMap.Bytes32ToBytes32Map
127
+ storage overrides = artistProjectOverrides[coreContract][projectId];
128
+ uint256 overrideCount = overrides.length();
129
+ // translate enumerable map to expected output format
130
+ projectOverrides = new IWeb3Call.TokenParam[](overrideCount);
131
+ for (uint256 i = 0; i < overrideCount; i++) {
132
+ (bytes32 key, bytes32 value) = overrides.at(i);
133
+ projectOverrides[i] = IWeb3Call.TokenParam({
134
+ key: _fromBytes32(key),
135
+ value: _fromBytes32(value)
136
+ });
137
+ }
138
+ // @dev implicitly return the projectOverrides array
139
+ }
140
+
141
+ /**
142
+ * @notice Augment the token parameters for a given token.
143
+ * Appends the block height into a tokens PMPs, and injects artist project overrides.
144
+ * If an input PMP has a key that matches an artist project override, the artist project override value will be used.
145
+ * If an input PMP has a key that does not match an artist project override, the input PMP will be unaffected in the output.
146
+ * All overrides are appended to the output, ensuring that the output always contains all override values.
147
+ * @dev This hook is called when a token's PMPs are read.
148
+ * @dev This must return all desired tokenParams, not just additional data.
149
+ * @param tokenParams The token parameters for the queried token.
150
+ * @return augmentedTokenParams The augmented token parameters.
151
+ */
152
+ function onTokenPMPReadAugmentation(
153
+ address coreContract,
154
+ uint256 tokenId,
155
+ IWeb3Call.TokenParam[] calldata tokenParams
156
+ )
157
+ external
158
+ view
159
+ override
160
+ returns (IWeb3Call.TokenParam[] memory augmentedTokenParams)
161
+ {
162
+ // get artist project overrides
163
+ EnumerableMap.Bytes32ToBytes32Map
164
+ storage overrides = artistProjectOverrides[coreContract][
165
+ ABHelpers.tokenIdToProjectId({tokenId: tokenId}) // project id
166
+ ];
167
+ uint256 overrideCount = overrides.length();
168
+
169
+ // create a new augmentedTokenParams array with maximum length of
170
+ // input tokenParams + overrideCount + one extra element for BlockHeight
171
+ uint256 originalLength = tokenParams.length;
172
+ uint256 augmentedMaxLength = originalLength + overrideCount + 1;
173
+ augmentedTokenParams = new IWeb3Call.TokenParam[](augmentedMaxLength);
174
+
175
+ // copy the original tokenParams into the new array
176
+ for (uint256 i = 0; i < originalLength; i++) {
177
+ augmentedTokenParams[i] = tokenParams[i];
178
+ }
179
+
180
+ // get + inject the block height into the new array
181
+ // @dev block scope to avoid stack too deep error
182
+ {
183
+ uint256 currentBlock = block.number;
184
+ augmentedTokenParams[originalLength] = IWeb3Call.TokenParam({
185
+ key: "blockHeight",
186
+ value: currentBlock.toString()
187
+ });
188
+ }
189
+
190
+ // get + inject the artist project overrides into the new array, overriding any existing param values
191
+ uint256 nextIndex = originalLength + 1;
192
+ // @dev O(i*n) where i is the number of overrides and n is the number of original tokenParams, okay on read function
193
+ for (uint256 i = 0; i < overrideCount; i++) {
194
+ (bytes32 key, bytes32 value) = overrides.at(i);
195
+ // check if the key exists in the original tokenParams, and if so, override the value with artist override
196
+ bool found = false;
197
+ for (uint256 j = 0; j < originalLength; j++) {
198
+ if (_equalsStringAndBytes32({s: tokenParams[j].key, b: key})) {
199
+ augmentedTokenParams[j] = IWeb3Call.TokenParam({
200
+ key: tokenParams[j].key, // @dev key is not changed
201
+ value: _fromBytes32(value) // @dev value is overridden
202
+ });
203
+ found = true;
204
+ break;
205
+ }
206
+ }
207
+ // if the key did not exist in the original tokenParams, append it to the augmentedTokenParams array
208
+ if (!found) {
209
+ augmentedTokenParams[nextIndex++] = IWeb3Call.TokenParam({
210
+ key: _fromBytes32(key),
211
+ value: _fromBytes32(value)
212
+ });
213
+ }
214
+ }
215
+
216
+ // shorten the augmentedTokenParams array to the new length (which is nextIndex)
217
+ // @dev use assembly to efficiently modify in place
218
+ if (nextIndex < augmentedMaxLength) {
219
+ assembly {
220
+ mstore(augmentedTokenParams, nextIndex)
221
+ }
222
+ }
223
+
224
+ // return the augmented tokenParams
225
+ return augmentedTokenParams;
226
+ }
227
+
228
+ /**
229
+ * @notice Only the artist of the project can call the function.
230
+ * @dev reverts if the caller is not the artist of the project.
231
+ * @param caller The address of the caller.
232
+ * @param coreContract The address of the core contract.
233
+ * @param projectId The ID of the project.
234
+ */
235
+ function _onlyArtist(
236
+ address caller,
237
+ address coreContract,
238
+ uint256 projectId
239
+ ) internal view {
240
+ if (
241
+ caller !=
242
+ IGenArt721CoreContractV3_Base(coreContract)
243
+ .projectIdToArtistAddress(projectId)
244
+ ) {
245
+ revert("Only artist of project");
246
+ }
247
+ }
248
+
249
+ /**
250
+ * @notice Convert a string to a bytes32 value.
251
+ * Reverts if the string is longer than 32 bytes.
252
+ * @dev This is a helper function to convert a string to a bytes32 value.
253
+ * @param str The string to convert.
254
+ * @return result The bytes32 value of the string.
255
+ */
256
+ function _toBytes32(
257
+ string memory str
258
+ ) internal pure returns (bytes32 result) {
259
+ bytes memory temp = bytes(str);
260
+ if (temp.length > 32) {
261
+ revert("String too long");
262
+ }
263
+ // copy the string directly to the bytes32 result, skipping the first 32 bytes (string length)
264
+ assembly {
265
+ result := mload(add(str, 32))
266
+ }
267
+ }
268
+
269
+ /**
270
+ * @notice Convert a bytes32-encoded string value to a string.
271
+ * @dev This is a helper function to convert a bytes32-encoded string value to a string.
272
+ * @param b The bytes32 value to convert.
273
+ * @return The string value of the bytes32 value.
274
+ */
275
+ function _fromBytes32(bytes32 b) internal pure returns (string memory) {
276
+ // determine the length of the string
277
+ uint256 len = 0;
278
+ for (; len < 32; ++len) {
279
+ if (b[len] == 0) break;
280
+ }
281
+ // create a new string with the length of the string
282
+ // @dev solidity reserves 32 bytes for length, rounds up to full word for data portion
283
+ string memory result = new string(len);
284
+ assembly {
285
+ let resultData := add(result, 0x20) // skip length prefix (already populated)
286
+ mstore(resultData, b) // store full 32 bytes (write-ahead optimization, okay due to solidity reserving 32 bytes for data)
287
+ }
288
+ return result;
289
+ }
290
+
291
+ /**
292
+ * @notice Compare a string and a bytes32 value, assuming the bytes32 is an encoded string.
293
+ * @dev This is a helper function to compare a string and a bytes32 value.
294
+ * @param s The string to compare.
295
+ * @param b The bytes32 value to compare.
296
+ * @return true if the string and bytes32 value are equal, false otherwise.
297
+ */
298
+ function _equalsStringAndBytes32(
299
+ string memory s,
300
+ bytes32 b
301
+ ) internal pure returns (bool) {
302
+ bytes memory strBytes = bytes(s);
303
+ if (strBytes.length > 32) return false;
304
+ bytes32 strBytes32;
305
+ assembly {
306
+ strBytes32 := mload(add(s, 32))
307
+ }
308
+ return strBytes32 == b;
309
+ }
310
+ }
@@ -0,0 +1,141 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ pragma solidity ^0.8.0;
5
+
6
+ import {AbstractPMPAugmentHook} from "./AbstractPMPAugmentHook.sol";
7
+
8
+ import {IWeb3Call} from "../../interfaces/v0.8.x/IWeb3Call.sol";
9
+ import {IERC721} from "@openzeppelin-5.0/contracts/interfaces/IERC721.sol";
10
+ import {Strings} from "@openzeppelin-5.0/contracts/utils/Strings.sol";
11
+
12
+ import {ABHelpers} from "../../libs/v0.8.x/ABHelpers.sol";
13
+
14
+ /**
15
+ * @title InjectBlockHeightAndNumOwnedProjectTokens
16
+ * @author Art Blocks Inc.
17
+ * @notice This hook injects the current block height into a token's PMPs.
18
+ * Also injects the quantity of token's owner's owned tokens from a
19
+ * reference Art Blocks project.
20
+ */
21
+ contract InjectBlockHeightAndNumOwnedProjectTokens is AbstractPMPAugmentHook {
22
+ using Strings for uint256;
23
+
24
+ /// @notice The address of the reference contract.
25
+ address public immutable referenceContract;
26
+ /// @notice The projectId of the reference project.
27
+ uint256 public immutable referenceProjectId;
28
+ /// @notice The number of project tokens.
29
+ uint256 public immutable numReferenceTokens;
30
+
31
+ event ReferenceContractSet(address referenceContract);
32
+ event ReferenceProjectIdSet(uint256 referenceProjectId);
33
+ event NumReferenceTokensSet(uint256 numReferenceTokens);
34
+
35
+ /**
36
+ * @notice Populates the referenceContract and referenceProjectId immutable variables.
37
+ * @param referenceContract_ The address of the project contract.
38
+ * @param referenceProjectId_ The projectId of the project.
39
+ * @param numReferenceTokens_ The number of project tokens.
40
+ */
41
+ constructor(
42
+ address referenceContract_,
43
+ uint256 referenceProjectId_,
44
+ uint256 numReferenceTokens_
45
+ ) {
46
+ // @dev keep iteration gas cost manageable by limiting numReferenceTokens
47
+ require(
48
+ numReferenceTokens_ <= 1000,
49
+ "numReferenceTokens must be less than or equal to 1000"
50
+ );
51
+ // assign immutable variables
52
+ referenceContract = referenceContract_;
53
+ referenceProjectId = referenceProjectId_;
54
+ numReferenceTokens = numReferenceTokens_;
55
+
56
+ // emit events
57
+ emit ReferenceContractSet(referenceContract_);
58
+ emit ReferenceProjectIdSet(referenceProjectId_);
59
+ emit NumReferenceTokensSet(numReferenceTokens_);
60
+ }
61
+
62
+ /**
63
+ * @notice Augment the token parameters for a given token.
64
+ * Appends the block height into a tokens PMPs.
65
+ * Also injects the quantity of token's owner's owned reference tokens.
66
+ * @dev This hook is called when a token's PMPs are read.
67
+ * @dev This must return all desired tokenParams, not just additional data.
68
+ * @param tokenParams The token parameters for the queried token.
69
+ * @return augmentedTokenParams The augmented token parameters.
70
+ */
71
+ function onTokenPMPReadAugmentation(
72
+ address coreContract,
73
+ uint256 tokenId,
74
+ IWeb3Call.TokenParam[] calldata tokenParams
75
+ )
76
+ external
77
+ view
78
+ override
79
+ returns (IWeb3Call.TokenParam[] memory augmentedTokenParams)
80
+ {
81
+ // create a new tokenParam array with two extra elements
82
+ uint256 originalLength = tokenParams.length;
83
+ uint256 newLength = originalLength + 2;
84
+ augmentedTokenParams = new IWeb3Call.TokenParam[](newLength);
85
+
86
+ // copy the original tokenParams into the new array
87
+ for (uint256 i = 0; i < originalLength; i++) {
88
+ augmentedTokenParams[i] = tokenParams[i];
89
+ }
90
+
91
+ // get + inject the block height and owned reference tokens into the new array
92
+ uint256 currentBlock = block.number;
93
+ augmentedTokenParams[originalLength] = IWeb3Call.TokenParam({
94
+ key: "BlockNumber",
95
+ value: currentBlock.toString()
96
+ });
97
+
98
+ // get + inject the owned reference tokens into the new array
99
+ address tokenOwner = IERC721(coreContract).ownerOf(tokenId);
100
+ uint256 ownedReferenceTokens = _getNumberOwnedReferenceTokens(
101
+ tokenOwner
102
+ );
103
+ augmentedTokenParams[originalLength + 1] = IWeb3Call.TokenParam({
104
+ key: "NumOwnedReferenceTokens",
105
+ value: ownedReferenceTokens.toString()
106
+ });
107
+
108
+ // return the augmented tokenParams
109
+ return augmentedTokenParams;
110
+ }
111
+
112
+ /**
113
+ * @notice Gets the number of owned reference tokens for a given token.
114
+ * @param tokenOwner The owner of the token.
115
+ * @return The number of owned reference tokens.
116
+ */
117
+ function _getNumberOwnedReferenceTokens(
118
+ address tokenOwner
119
+ ) internal view returns (uint256) {
120
+ uint256 ownedReferenceTokens = 0;
121
+
122
+ // iterate over the number of reference tokens
123
+ // @dev acknowledge iteration gas cost in view function - see constructor for limit of numReferenceTokens
124
+ for (uint256 i = 0; i < numReferenceTokens; i++) {
125
+ // get the reference token id
126
+ uint256 referenceTokenId = ABHelpers
127
+ .tokenIdFromProjectIdAndTokenNumber({
128
+ projectId: referenceProjectId,
129
+ tokenNumber: i
130
+ });
131
+
132
+ if (
133
+ IERC721(referenceContract).ownerOf(referenceTokenId) ==
134
+ tokenOwner
135
+ ) {
136
+ ownedReferenceTokens++;
137
+ }
138
+ }
139
+ return ownedReferenceTokens;
140
+ }
141
+ }