@artblocks/contracts 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/README.md +22 -38
  2. package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
  3. package/artifacts/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2.sol/BytecodeStorageReaderContractV2.json +201 -0
  4. package/artifacts/contracts/BytecodeStorageReaders/UniversalBytecodeStorageReader.sol/UniversalBytecodeStorageReader.json +154 -0
  5. package/artifacts/contracts/BytecodeStorageV2Writer.sol/BytecodeStorageV2Writer.json +87 -0
  6. package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +144 -14
  7. package/artifacts/contracts/GenArt721CoreV3_Curated.sol/GenArt721CoreV3_Curated.json +2493 -0
  8. package/artifacts/contracts/OwnedCreate2FactoryV0.sol/OwnedCreate2FactoryV0.json +311 -0
  9. package/artifacts/contracts/archive/GenArt721CoreV3.sol/GenArt721CoreV3.json +15 -2
  10. package/artifacts/contracts/archive/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +15 -2
  11. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol/MinterDAExpV2.json +2 -2
  12. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol/MinterDAExpV3.json +2 -2
  13. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV4.sol/MinterDAExpV4.json +2 -2
  14. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol/MinterDAExpSettlementV0.json +2 -2
  15. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV1.sol/MinterDAExpSettlementV1.json +2 -2
  16. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +2 -2
  17. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV2.sol/MinterDALinV2.json +2 -2
  18. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV3.sol/MinterDALinV3.json +2 -2
  19. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV4.sol/MinterDALinV4.json +2 -2
  20. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV1.sol/MinterHolderV1.json +2 -2
  21. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +2 -2
  22. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV3.sol/MinterHolderV3.json +2 -2
  23. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV4.sol/MinterHolderV4.json +2 -2
  24. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV1.sol/MinterMerkleV1.json +2 -2
  25. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV2.sol/MinterMerkleV2.json +2 -2
  26. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol/MinterMerkleV3.json +2 -2
  27. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol/MinterMerkleV4.json +2 -2
  28. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV5.sol/MinterMerkleV5.json +2 -2
  29. package/artifacts/contracts/archive/minter-suite/Minters/MinterPolyptych/MinterPolyptychV0.sol/IGenArt721CoreContractV3WithRandomizer.json +37 -0
  30. package/artifacts/contracts/archive/minter-suite/Minters/MinterPolyptych/MinterPolyptychV0.sol/MinterPolyptychV0.json +2 -2
  31. package/artifacts/contracts/archive/minter-suite/Minters/MinterSEA/MinterSEAV0.sol/MinterSEAV0.json +2 -2
  32. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol/MinterSetPriceV2.json +2 -2
  33. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol/MinterSetPriceV3.json +2 -2
  34. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV4.sol/MinterSetPriceV4.json +2 -2
  35. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol/MinterSetPriceERC20V2.json +2 -2
  36. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol/MinterSetPriceERC20V3.json +2 -2
  37. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V4.sol/MinterSetPriceERC20V4.json +2 -2
  38. package/artifacts/contracts/engine/V3/EngineFactoryV0.sol/EngineFactoryV0.json +20 -2
  39. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +48 -12
  40. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +76 -40
  41. package/artifacts/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol/GenArt721CoreV3_Engine_Flex_PROOF.json +15 -2
  42. package/artifacts/contracts/engine/V3/forks/PROHIBITION/AdminACLV0_PROHIBITION.sol/AdminACLV0_PROHIBITION.json +2 -2
  43. package/artifacts/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol/GenArt721CoreV3_Engine_Flex_PROHIBITION.json +15 -2
  44. package/artifacts/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.json +37 -0
  45. package/artifacts/contracts/engine-registry/CoreRegistryV1.sol/CoreRegistryV1.json +2 -2
  46. package/artifacts/contracts/generator/AddressChunks.sol/AddressChunks.json +10 -0
  47. package/artifacts/contracts/generator/GenArt721GeneratorV0.sol/GenArt721GeneratorV0.json +333 -0
  48. package/artifacts/contracts/generator/GenArt721GeneratorV0.sol/ILegacyGenArt721CoreV2_PBAB_Flex.json +47 -0
  49. package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReader.sol/IBytecodeStorageReader.json +7 -7
  50. package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReaderV2.sol/IBytecodeStorageReaderV2.json +7 -7
  51. package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReader_Base.sol/IBytecodeStorageReader_Base.json +30 -0
  52. package/artifacts/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol/ICoreRegistryV1.json +13 -0
  53. package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +170 -0
  54. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3.sol/IGenArt721CoreContractV3.json +37 -0
  55. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol/IGenArt721CoreContractV3_Base.json +37 -0
  56. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol/IGenArt721CoreContractV3_Engine.json +42 -0
  57. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol/IGenArt721CoreContractV3_Engine_Flex.json +42 -0
  58. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.sol/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.json +37 -0
  59. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_PreV3p2.sol/IGenArt721CoreContractV3_Engine_PreV3p2.json +37 -0
  60. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV0.sol/IGenArt721CoreProjectScriptV0.json +59 -0
  61. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV1.sol/IGenArt721CoreProjectScriptV1.json +64 -0
  62. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV0.sol/IGenArt721CoreTokenHashProviderV0.json +30 -0
  63. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV1.sol/IGenArt721CoreTokenHashProviderV1.json +30 -0
  64. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721GeneratorV0.sol/IGenArt721GeneratorV0.json +63 -0
  65. package/artifacts/contracts/interfaces/v0.8.x/IOwnedCreate2FactoryV0.sol/IOwnedCreate2FactoryV0.json +74 -0
  66. package/artifacts/contracts/interfaces/v0.8.x/ISeaDropShimForContract.sol/ISeaDropShimForContract.json +37 -0
  67. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterMinPriceV0.sol/ISharedMinterMinPriceV0.json +37 -0
  68. package/artifacts/contracts/interfaces/v0.8.x/IUniversalBytecodeStorageReader.sol/IUniversalBytecodeStorageReader.json +56 -0
  69. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ERC721SeaDropStructsErrorsAndEvents.sol/ERC721SeaDropStructsErrorsAndEvents.json +43 -0
  70. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/INonFungibleSeaDropToken.sol/INonFungibleSeaDropToken.json +715 -0
  71. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDrop.sol/ISeaDrop.json +1571 -0
  72. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDropTokenContractMetadata.sol/ISeaDropTokenContractMetadata.json +345 -0
  73. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/SeaDropErrorsAndEvents.sol/SeaDropErrorsAndEvents.json +717 -0
  74. package/artifacts/contracts/libs/v0.8.x/AuthLib.sol/AuthLib.json +2 -2
  75. package/artifacts/contracts/libs/v0.8.x/Bytes32Strings.sol/Bytes32Strings.json +2 -2
  76. package/artifacts/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol/DependencyRegistryStorageLib.json +2 -2
  77. package/artifacts/contracts/libs/v0.8.x/JsonStatic.sol/JsonStatic.json +10 -0
  78. package/artifacts/contracts/libs/v0.8.x/V3FlexLib.sol/V3FlexLib.json +9 -22
  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/MinPriceLib.sol/MinPriceLib.json +24 -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 +664 -0
  94. package/artifacts/contracts/minter-suite/Minters/MinterMinPriceV0.sol/MinterMinPriceV0.json +387 -0
  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/MinterSetPricePolyptychERC20V5.sol/MinterSetPricePolyptychERC20V5.json +2 -2
  101. package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol/MinterSetPricePolyptychV5.json +2 -2
  102. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV5.sol/MinterSetPriceV5.json +2 -2
  103. package/artifacts/contracts/minter-suite/Minters/one-off/MinterSetPriceV5_SingleCore.sol/MinterSetPriceV5_SingleCore.json +2 -2
  104. package/artifacts/contracts/minter-suite/Minters/one-off/SeaDropXArtBlocksShim.sol/SeaDropXArtBlocksShim.json +1206 -0
  105. package/artifacts/contracts/mock/BytecodeV1LibCallsMock.sol/BytecodeV1LibCallsMock.json +2 -2
  106. package/artifacts/contracts/mock/BytecodeV2LibCallsMock.sol/BytecodeV2LibCallsMock.json +2 -2
  107. package/artifacts/contracts/mock/DummySharedMinter.sol/DummySharedMinter.json +2 -2
  108. package/artifacts/contracts/mock/ERC20MockAltDecimals.sol/ERC20MockAltDecimals.json +318 -0
  109. package/artifacts/contracts/mock/ForceSendMock.sol/ForceSendMock.json +2 -2
  110. package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +2 -2
  111. package/artifacts/contracts/mock/MockAdminACLV0_PROHIBITION.sol/MockAdminACLV0Events_PROHIBITION.json +2 -2
  112. package/artifacts/contracts/mock/MockFileStore.sol/MockFileStore.json +35 -0
  113. package/artifacts/contracts/mock/OriginRegisterMock.sol/OriginRegisterMock.json +2 -2
  114. package/artifacts/contracts/mock/RandomizerV2_NoAssignMock.sol/RandomizerV2_NoAssignMock.json +2 -2
  115. package/artifacts/contracts/randomizer/deprecated/PolyptychRandomizerV0.sol/BasicPolyptychRandomizerV0.json +2 -2
  116. package/artifacts/contracts/randomizer/deprecated/RandomizerV2.sol/BasicRandomizerV2.json +2 -2
  117. package/artifacts/contracts/randomizer/shared/SharedRandomizerV0.sol/SharedRandomizerV0.json +2 -2
  118. package/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2.sol +103 -0
  119. package/contracts/BytecodeStorageReaders/UniversalBytecodeStorageReader.sol +70 -0
  120. package/contracts/BytecodeStorageV2Writer.sol +69 -0
  121. package/contracts/DependencyRegistryV0.sol +229 -60
  122. package/contracts/GenArt721CoreV3_Curated.sol +133 -0
  123. package/contracts/OwnedCreate2FactoryV0.sol +173 -0
  124. package/contracts/engine/V3/EngineFactoryV0.sol +10 -2
  125. package/contracts/engine/V3/GenArt721CoreV3_Engine.sol +139 -70
  126. package/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol +141 -71
  127. package/contracts/generator/AddressChunks.sol +106 -0
  128. package/contracts/generator/GenArt721GeneratorV0.sol +1094 -0
  129. package/contracts/generator/scripty-support/Scripty.sol +5 -0
  130. package/contracts/interfaces/v0.8.x/IBytecodeStorageReader.sol +34 -36
  131. package/contracts/interfaces/v0.8.x/IBytecodeStorageReaderV2.sol +5 -3
  132. package/contracts/interfaces/v0.8.x/IBytecodeStorageReader_Base.sol +20 -0
  133. package/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol +5 -0
  134. package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +94 -0
  135. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol +13 -2
  136. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol +3 -1
  137. package/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV0.sol +22 -0
  138. package/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV1.sol +23 -0
  139. package/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV0.sol +11 -0
  140. package/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV1.sol +9 -0
  141. package/contracts/interfaces/v0.8.x/IGenArt721GeneratorV0.sol +14 -0
  142. package/contracts/interfaces/v0.8.x/IOwnedCreate2FactoryV0.sol +40 -0
  143. package/contracts/interfaces/v0.8.x/ISeaDropShimForContract.sol +19 -0
  144. package/contracts/interfaces/v0.8.x/ISharedMinterMinPriceV0.sol +22 -0
  145. package/contracts/interfaces/v0.8.x/ISharedMinterRequired.sol +10 -4
  146. package/contracts/interfaces/v0.8.x/IUniversalBytecodeStorageReader.sol +28 -0
  147. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ERC721SeaDropStructsErrorsAndEvents.sol +58 -0
  148. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/INonFungibleSeaDropToken.sol +186 -0
  149. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDrop.sol +337 -0
  150. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDropTokenContractMetadata.sol +152 -0
  151. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/SeaDropErrorsAndEvents.sol +320 -0
  152. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/SeaDropStructs.sol +146 -0
  153. package/contracts/libs/v0.8.x/Bytes32Strings.sol +20 -0
  154. package/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol +11 -3
  155. package/contracts/libs/v0.8.x/JsonStatic.sol +373 -0
  156. package/contracts/libs/v0.8.x/V3FlexLib.sol +9 -3
  157. package/contracts/libs/v0.8.x/minter-libs/MinPriceLib.sol +64 -0
  158. package/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol +107 -0
  159. package/contracts/minter-suite/Minters/MinterMinPriceMerkleV0.sol +765 -0
  160. package/contracts/minter-suite/Minters/MinterMinPriceV0.sol +462 -0
  161. package/contracts/minter-suite/Minters/one-off/SeaDropXArtBlocksShim.sol +869 -0
  162. package/contracts/mock/ERC20MockAltDecimals.sol +31 -0
  163. package/contracts/mock/MockFileStore.sol +22 -0
  164. package/package.json +20 -18
@@ -0,0 +1,765 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ // @dev fixed to specific solidity version for clarity and for more clear
5
+ // source code verification purposes.
6
+ pragma solidity 0.8.19;
7
+
8
+ import {ISharedMinterMinPriceV0} from "../../interfaces/v0.8.x/ISharedMinterMinPriceV0.sol";
9
+ import {IDelegationRegistry} from "../../interfaces/v0.8.x/IDelegationRegistry.sol";
10
+ import {ISharedMinterV0} from "../../interfaces/v0.8.x/ISharedMinterV0.sol";
11
+ import {IMinterFilterV1} from "../../interfaces/v0.8.x/IMinterFilterV1.sol";
12
+ import {ISharedMinterMerkleV0} from "../../interfaces/v0.8.x/ISharedMinterMerkleV0.sol";
13
+
14
+ import {AuthLib} from "../../libs/v0.8.x/AuthLib.sol";
15
+ import {MerkleLib} from "../../libs/v0.8.x/minter-libs/MerkleLib.sol";
16
+ import {SplitFundsLib} from "../../libs/v0.8.x/minter-libs/SplitFundsLib.sol";
17
+ import {MaxInvocationsLib} from "../../libs/v0.8.x/minter-libs/MaxInvocationsLib.sol";
18
+ import {SetPriceLib} from "../../libs/v0.8.x/minter-libs/SetPriceLib.sol";
19
+ import {MinPriceLib} from "../../libs/v0.8.x/minter-libs/MinPriceLib.sol";
20
+
21
+ import {ReentrancyGuard} from "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
22
+
23
+ /**
24
+ * @title Shared, filtered Minter contract that allows tokens to be minted with
25
+ * a minimum fee in ETH for addresses in a Merkle allowlist.
26
+ * This is designed to be used with GenArt721CoreContractV3 flagship or
27
+ * engine contracts.
28
+ * @author Art Blocks Inc.
29
+ * @notice Privileged Roles and Ownership:
30
+ * This contract is designed to be managed, with limited powers.
31
+ * Privileged roles and abilities are controlled by the project's artist, which
32
+ * can be modified by the core contract's Admin ACL contract. Both of these
33
+ * roles hold extensive power and can modify minter details.
34
+ * Care must be taken to ensure that the admin ACL contract and artist
35
+ * addresses are secure behind a multi-sig or other access control mechanism.
36
+ * ----------------------------------------------------------------------------
37
+ * The following functions are restricted to the minter filter's admin ACL:
38
+ * - updateMinMintFee
39
+ * ----------------------------------------------------------------------------
40
+ * The following functions are restricted to a project's artist:
41
+ * - updateMerkleRoot
42
+ * - updatePricePerTokenInWei
43
+ * - setProjectInvocationsPerAddress
44
+ * - syncProjectMaxInvocationsToCore
45
+ * - manuallyLimitProjectMaxInvocations
46
+ * ----------------------------------------------------------------------------
47
+ * Additional admin and artist privileged roles may be described on other
48
+ * contracts that this minter integrates with.
49
+ * ----------------------------------------------------------------------------
50
+ * This contract allows vaults to configure token-level or wallet-level
51
+ * delegation of minting privileges. This allows a vault on an allowlist to
52
+ * delegate minting privileges to a wallet that is not on the allowlist,
53
+ * enabling the vault to remain air-gapped while still allowing minting. The
54
+ * delegation registry contract is responsible for managing these delegations,
55
+ * and is available at the address returned by the public immutable
56
+ * `delegationRegistryAddress`. At the time of writing, the delegation
57
+ * registry enables easy delegation configuring at https://delegate.cash/.
58
+ * Art Blocks does not guarentee the security of the delegation registry, and
59
+ * users should take care to ensure that the delegation registry is secure.
60
+ * Token-level delegations are configured by the vault owner, and contract-
61
+ * level delegations must be configured for the core token contract as returned
62
+ * by the public immutable variable `genArt721CoreAddress`.
63
+ * ----------------------------------------------------------------------------
64
+ * @notice Caution: While Engine projects must be registered on the Art Blocks
65
+ * Core Registry to assign this minter, this minter does not enforce that a
66
+ * project is registered when configured or queried. This is primarily for gas
67
+ * optimization purposes. It is, therefore, possible that fake projects may be
68
+ * configured on this minter, but they will not be able to mint tokens due to
69
+ * checks performed by this minter's Minter Filter.
70
+ */
71
+ contract MinterMinPriceMerkleV0 is
72
+ ReentrancyGuard,
73
+ ISharedMinterV0,
74
+ ISharedMinterMerkleV0
75
+ {
76
+ /// Minter filter address this minter interacts with
77
+ address public immutable minterFilterAddress;
78
+
79
+ /// Minter filter this minter may interact with.
80
+ IMinterFilterV1 private immutable _minterFilter;
81
+
82
+ /// minterType for this minter
83
+ string public constant minterType = "MinterMinPriceMerkleV0";
84
+
85
+ /// minter version for this minter
86
+ string public constant minterVersion = "v0.0.0";
87
+
88
+ /// Delegation registry address
89
+ address public immutable delegationRegistryAddress;
90
+ /// Delegation registry address
91
+ IDelegationRegistry private immutable _delegationRegistryContract;
92
+
93
+ // MODIFIERS
94
+ // @dev contract uses modifier-like internal functions instead of modifiers
95
+ // to reduce contract bytecode size
96
+ // @dev contract uses AuthLib for some modifier-like functions
97
+
98
+ /**
99
+ * @notice Initializes contract to be a Filtered Minter for
100
+ * `minterFilter` minter filter.
101
+ * @param minterFilter Minter filter for which this will be a
102
+ * filtered minter.
103
+ * @param delegationRegistryAddress_ Delegation registry contract address.
104
+ * @param minMintFee_ Min mint fee for this minter, applied to all
105
+ * and-on projects that use this minter.
106
+ */
107
+ constructor(
108
+ address minterFilter,
109
+ address delegationRegistryAddress_,
110
+ uint256 minMintFee_
111
+ ) ReentrancyGuard() {
112
+ minterFilterAddress = minterFilter;
113
+ _minterFilter = IMinterFilterV1(minterFilter);
114
+
115
+ delegationRegistryAddress = delegationRegistryAddress_;
116
+ _delegationRegistryContract = IDelegationRegistry(
117
+ delegationRegistryAddress_
118
+ );
119
+
120
+ MinPriceLib.updateMinMintFee({newMinMintFee: minMintFee_});
121
+
122
+ emit MerkleLib.DelegationRegistryUpdated(delegationRegistryAddress_);
123
+ // broadcast default max invocations per address for this minter
124
+ emit MerkleLib.DefaultMaxInvocationsPerAddress(
125
+ MerkleLib.DEFAULT_MAX_INVOCATIONS_PER_ADDRESS
126
+ );
127
+ }
128
+
129
+ /**
130
+ * @notice Updates the min mint fee for this minter.
131
+ * This function is restricted to the minter filter's admin.
132
+ * This function is intended to be used to update the min mint fee
133
+ * for this minter, which is applied to all and-on projects that use this
134
+ * minter. This function does not update the price per token for existing
135
+ * projects that have already been initialized.
136
+ * @param newMinMintFee New min mint fee for this minter.
137
+ */
138
+ function updateMinMintFee(uint256 newMinMintFee) external {
139
+ // CHECKS
140
+ AuthLib.onlyMinterFilterAdminACL({
141
+ minterFilterAddress: minterFilterAddress,
142
+ sender: msg.sender,
143
+ contract_: address(this),
144
+ selector: this.updateMinMintFee.selector
145
+ });
146
+ // EFFECTS
147
+ MinPriceLib.updateMinMintFee({newMinMintFee: newMinMintFee});
148
+ // @dev this update applies to an-on projects to call `updatePricePerTokenInWei`
149
+ // on this minter. There is no need to sync this value to existing projects.
150
+ }
151
+
152
+ /**
153
+ * @notice Manually sets the local maximum invocations of project `projectId`
154
+ * with the provided `maxInvocations`, checking that `maxInvocations` is less
155
+ * than or equal to the value of project `project_id`'s maximum invocations that is
156
+ * set on the core contract.
157
+ * @dev Note that a `maxInvocations` of 0 can only be set if the current `invocations`
158
+ * value is also 0 and this would also set `maxHasBeenInvoked` to true, correctly short-circuiting
159
+ * this minter's purchase function, avoiding extra gas costs from the core contract's maxInvocations check.
160
+ * @param projectId Project ID to set the maximum invocations for.
161
+ * @param coreContract Core contract address for the given project.
162
+ * @param maxInvocations Maximum invocations to set for the project.
163
+ */
164
+ function manuallyLimitProjectMaxInvocations(
165
+ uint256 projectId,
166
+ address coreContract,
167
+ uint24 maxInvocations
168
+ ) external {
169
+ AuthLib.onlyArtist({
170
+ projectId: projectId,
171
+ coreContract: coreContract,
172
+ sender: msg.sender
173
+ });
174
+ MaxInvocationsLib.manuallyLimitProjectMaxInvocations({
175
+ projectId: projectId,
176
+ coreContract: coreContract,
177
+ maxInvocations: maxInvocations
178
+ });
179
+ }
180
+
181
+ /**
182
+ * @notice Updates this minter's price per token of project `projectId`
183
+ * to be '_pricePerTokenInWei`, in Wei.
184
+ * Reverts if price per token is less than the min mint fee.
185
+ * @param projectId Project ID to set the price per token for.
186
+ * @param coreContract Core contract address for the given project.
187
+ * @param pricePerTokenInWei Price per token to set for the project, in Wei.
188
+ * Must be greater than or equal to the min mint fee.
189
+ */
190
+ function updatePricePerTokenInWei(
191
+ uint256 projectId,
192
+ address coreContract,
193
+ uint248 pricePerTokenInWei
194
+ ) external {
195
+ AuthLib.onlyArtist({
196
+ projectId: projectId,
197
+ coreContract: coreContract,
198
+ sender: msg.sender
199
+ });
200
+ // require configured price gte min mint fee
201
+ // @dev intentionally support price > min mint fee, to handle cases
202
+ // such as opt-in premium off-chain services
203
+ require(
204
+ pricePerTokenInWei >= MinPriceLib.getMinMintFee(),
205
+ "Only gte min mint fee"
206
+ );
207
+ // price per token is the input pricePerTokenInWei
208
+ SetPriceLib.updatePricePerToken({
209
+ projectId: projectId,
210
+ coreContract: coreContract,
211
+ pricePerToken: pricePerTokenInWei
212
+ });
213
+
214
+ // for convenience, sync local max invocations to the core contract if
215
+ // and only if max invocations have not already been synced.
216
+ // @dev do not sync if max invocations have already been synced, as
217
+ // local max invocations could have been manually set to be
218
+ // intentionally less than the core contract's max invocations.
219
+ // @dev if local maxInvocations and maxHasBeenInvoked are both
220
+ // initial values, we know they have not been populated on this minter
221
+ if (
222
+ MaxInvocationsLib.maxInvocationsIsUnconfigured({
223
+ projectId: projectId,
224
+ coreContract: coreContract
225
+ })
226
+ ) {
227
+ MaxInvocationsLib.syncProjectMaxInvocationsToCore({
228
+ projectId: projectId,
229
+ coreContract: coreContract
230
+ });
231
+ }
232
+ }
233
+
234
+ /**
235
+ * @notice Update the Merkle root for project `projectId` on core contract `coreContract`.
236
+ * @param projectId Project ID to be updated.
237
+ * @param coreContract Core contract address for the given project.
238
+ * @param root root of Merkle tree defining addresses allowed to mint
239
+ * on project `projectId`.
240
+ */
241
+ function updateMerkleRoot(
242
+ uint256 projectId,
243
+ address coreContract,
244
+ bytes32 root
245
+ ) external {
246
+ AuthLib.onlyArtist({
247
+ projectId: projectId,
248
+ coreContract: coreContract,
249
+ sender: msg.sender
250
+ });
251
+ MerkleLib.updateMerkleRoot({
252
+ projectId: projectId,
253
+ coreContract: coreContract,
254
+ root: root
255
+ });
256
+ }
257
+
258
+ /**
259
+ * @notice Sets maximum allowed invocations per allowlisted address for
260
+ * project `project` to `limit`. If `limit` is set to 0, allowlisted
261
+ * addresses will be able to mint as many times as desired, until the
262
+ * project reaches its maximum invocations.
263
+ * Default is a value of 1 if never configured by artist.
264
+ * @param projectId Project ID to toggle the mint limit.
265
+ * @param coreContract Core contract address for the given project.
266
+ * @param maxInvocationsPerAddress Maximum allowed invocations per
267
+ * allowlisted address.
268
+ * @dev default value stated above must be updated if the value of
269
+ * CONFIG_USE_MAX_INVOCATIONS_PER_ADDRESS_OVERRIDE is changed.
270
+ */
271
+ function setProjectInvocationsPerAddress(
272
+ uint256 projectId,
273
+ address coreContract,
274
+ uint24 maxInvocationsPerAddress
275
+ ) external {
276
+ AuthLib.onlyArtist({
277
+ projectId: projectId,
278
+ coreContract: coreContract,
279
+ sender: msg.sender
280
+ });
281
+ MerkleLib.setProjectInvocationsPerAddress({
282
+ projectId: projectId,
283
+ coreContract: coreContract,
284
+ maxInvocationsPerAddress: maxInvocationsPerAddress
285
+ });
286
+ }
287
+
288
+ /**
289
+ * @notice Purchases a token from project `projectId`.
290
+ * @param projectId Project ID to mint a token on.
291
+ * @param coreContract Core contract address for the given project.
292
+ * @param proof Merkle proof for the given project.
293
+ * @return tokenId Token ID of minted token
294
+ */
295
+ function purchase(
296
+ uint256 projectId,
297
+ address coreContract,
298
+ bytes32[] calldata proof
299
+ ) external payable returns (uint256 tokenId) {
300
+ tokenId = purchaseTo({
301
+ to: msg.sender,
302
+ projectId: projectId,
303
+ coreContract: coreContract,
304
+ proof: proof,
305
+ vault: address(0)
306
+ });
307
+ return tokenId;
308
+ }
309
+
310
+ /**
311
+ * @notice Purchases a token from project `projectId` and sets
312
+ * the token's owner to `to`.
313
+ * @param to Address to be the new token's owner.
314
+ * @param projectId Project ID to mint a token on.
315
+ * @param coreContract Contract address of the core contract.
316
+ * @param proof Merkle proof for the given project.
317
+ * @return tokenId Token ID of minted token
318
+ */
319
+ function purchaseTo(
320
+ address to,
321
+ uint256 projectId,
322
+ address coreContract,
323
+ bytes32[] calldata proof
324
+ ) external payable returns (uint256 tokenId) {
325
+ return
326
+ purchaseTo({
327
+ to: to,
328
+ projectId: projectId,
329
+ coreContract: coreContract,
330
+ proof: proof,
331
+ vault: address(0)
332
+ });
333
+ }
334
+
335
+ // public getter functions
336
+ /**
337
+ * @notice Gets the maximum invocations project configuration.
338
+ * @param projectId The ID of the project whose data needs to be fetched.
339
+ * @param coreContract The address of the core contract.
340
+ * @return MaxInvocationsLib.MaxInvocationsProjectConfig instance with the
341
+ * configuration data.
342
+ */
343
+ function maxInvocationsProjectConfig(
344
+ uint256 projectId,
345
+ address coreContract
346
+ )
347
+ external
348
+ view
349
+ returns (MaxInvocationsLib.MaxInvocationsProjectConfig memory)
350
+ {
351
+ return
352
+ MaxInvocationsLib.getMaxInvocationsProjectConfig({
353
+ projectId: projectId,
354
+ coreContract: coreContract
355
+ });
356
+ }
357
+
358
+ /**
359
+ * @notice Gets the set price project configuration.
360
+ * @param projectId The ID of the project whose data needs to be fetched.
361
+ * @param coreContract The address of the core contract.
362
+ * @return SetPriceProjectConfig struct with the fixed price project
363
+ * configuration data.
364
+ */
365
+ function setPriceProjectConfig(
366
+ uint256 projectId,
367
+ address coreContract
368
+ ) external view returns (SetPriceLib.SetPriceProjectConfig memory) {
369
+ return
370
+ SetPriceLib.getSetPriceProjectConfig({
371
+ projectId: projectId,
372
+ coreContract: coreContract
373
+ });
374
+ }
375
+
376
+ /**
377
+ * @notice Retrieves the Merkle project configuration for a given contract and project.
378
+ * @dev This function fetches the Merkle project configuration from the
379
+ * merkleProjectConfigMapping using the provided core contract address and project ID.
380
+ * @param projectId The ID of the project.
381
+ * @param coreContract The address of the core contract.
382
+ * @return MerkleLib.MerkleProjectConfig The Merkle project configuration.
383
+ */
384
+ function merkleProjectConfig(
385
+ uint256 projectId,
386
+ address coreContract
387
+ ) external view returns (bool, uint24, bytes32) {
388
+ MerkleLib.MerkleProjectConfig storage merkleProjectConfig_ = MerkleLib
389
+ .getMerkleProjectConfig({
390
+ projectId: projectId,
391
+ coreContract: coreContract
392
+ });
393
+ return (
394
+ merkleProjectConfig_.useMaxInvocationsPerAddressOverride,
395
+ merkleProjectConfig_.maxInvocationsPerAddressOverride,
396
+ merkleProjectConfig_.merkleRoot
397
+ );
398
+ }
399
+
400
+ /**
401
+ * @notice Retrieves the mint invocation count for a specific project and purchaser.
402
+ * @dev This function retrieves the number of times a purchaser has minted
403
+ * in a specific project from the projectUserMintInvocationsMapping.
404
+ * @param projectId The ID of the project.
405
+ * @param coreContract The address of the core contract.
406
+ * @param purchaser The address of the purchaser.
407
+ * @return uint256 The number of times the purchaser has minted in the given project.
408
+ */
409
+ function projectUserMintInvocations(
410
+ uint256 projectId,
411
+ address coreContract,
412
+ address purchaser
413
+ ) external view returns (uint256) {
414
+ return
415
+ MerkleLib.projectUserMintInvocations({
416
+ projectId: projectId,
417
+ coreContract: coreContract,
418
+ purchaser: purchaser
419
+ });
420
+ }
421
+
422
+ /**
423
+ * @notice Checks if the specified `coreContract` is a valid engine contract.
424
+ * @dev This function retrieves the cached value of `isEngine` from
425
+ * the `isEngineCache` mapping. If the cached value is already set, it
426
+ * returns the cached value. Otherwise, it calls the `getV3CoreIsEngineView`
427
+ * function from the `SplitFundsLib` library to check if `coreContract`
428
+ * is a valid engine contract.
429
+ * @dev This function will revert if the provided `coreContract` is not
430
+ * a valid Engine or V3 Flagship contract.
431
+ * @param coreContract The address of the contract to check.
432
+ * @return bool indicating if `coreContract` is a valid engine contract.
433
+ */
434
+ function isEngineView(address coreContract) external view returns (bool) {
435
+ SplitFundsLib.IsEngineCache storage isEngineCache = SplitFundsLib
436
+ .getIsEngineCacheConfig(coreContract);
437
+ if (isEngineCache.isCached) {
438
+ return isEngineCache.isEngine;
439
+ } else {
440
+ // @dev this calls the non-state-modifying variant of isEngine
441
+ return SplitFundsLib.getV3CoreIsEngineView(coreContract);
442
+ }
443
+ }
444
+
445
+ /**
446
+ * @notice projectId => has project reached its maximum number of
447
+ * invocations? Note that this returns a local cache of the core contract's
448
+ * state, and may be out of sync with the core contract. This is
449
+ * intentional, as it only enables gas optimization of mints after a
450
+ * project's maximum invocations has been reached. A false negative will
451
+ * only result in a gas cost increase, since the core contract will still
452
+ * enforce a maxInvocation check during minting. A false positive is not
453
+ * possible because the V3 core contract only allows maximum invocations
454
+ * to be reduced, not increased. Based on this rationale, we intentionally
455
+ * do not do input validation in this method as to whether or not the input
456
+ * @param projectId is an existing project ID.
457
+ * @param coreContract is an existing core contract address.
458
+ */
459
+ function projectMaxHasBeenInvoked(
460
+ uint256 projectId,
461
+ address coreContract
462
+ ) external view returns (bool) {
463
+ return
464
+ MaxInvocationsLib.getMaxHasBeenInvoked({
465
+ projectId: projectId,
466
+ coreContract: coreContract
467
+ });
468
+ }
469
+
470
+ /**
471
+ * @notice projectId => project's maximum number of invocations.
472
+ * Optionally synced with core contract value, for gas optimization.
473
+ * Note that this returns a local cache of the core contract's
474
+ * state, and may be out of sync with the core contract. This is
475
+ * intentional, as it only enables gas optimization of mints after a
476
+ * project's maximum invocations has been reached.
477
+ * @dev A number greater than the core contract's project max invocations
478
+ * will only result in a gas cost increase, since the core contract will
479
+ * still enforce a maxInvocation check during minting. A number less than
480
+ * the core contract's project max invocations is only possible when the
481
+ * project's max invocations have not been synced on this minter, since the
482
+ * V3 core contract only allows maximum invocations to be reduced, not
483
+ * increased. When this happens, the minter will enable minting, allowing
484
+ * the core contract to enforce the max invocations check. Based on this
485
+ * rationale, we intentionally do not do input validation in this method as
486
+ * to whether or not the input `projectId` is an existing project ID.
487
+ * @param projectId is an existing project ID.
488
+ * @param coreContract is an existing core contract address.
489
+ */
490
+ function projectMaxInvocations(
491
+ uint256 projectId,
492
+ address coreContract
493
+ ) external view returns (uint256) {
494
+ return
495
+ MaxInvocationsLib.getMaxInvocations({
496
+ projectId: projectId,
497
+ coreContract: coreContract
498
+ });
499
+ }
500
+
501
+ /**
502
+ * @notice Gets if price of token is configured, price of minting a
503
+ * token on project `projectId`, and currency symbol and address to be
504
+ * used as payment.
505
+ * @param projectId Project ID to get price information for
506
+ * @param coreContract Contract address of the core contract
507
+ * @return isConfigured true only if token price has been configured on
508
+ * this minter
509
+ * @return tokenPriceInWei current price of token on this minter - invalid
510
+ * if price has not yet been configured
511
+ * @return currencySymbol currency symbol for purchases of project on this
512
+ * minter. This minter always returns "ETH"
513
+ * @return currencyAddress currency address for purchases of project on
514
+ * this minter. This minter always returns null address, reserved for ether
515
+ */
516
+ function getPriceInfo(
517
+ uint256 projectId,
518
+ address coreContract
519
+ )
520
+ external
521
+ view
522
+ returns (
523
+ bool isConfigured,
524
+ uint256 tokenPriceInWei,
525
+ string memory currencySymbol,
526
+ address currencyAddress
527
+ )
528
+ {
529
+ SetPriceLib.SetPriceProjectConfig
530
+ storage setPriceProjectConfig_ = SetPriceLib
531
+ .getSetPriceProjectConfig({
532
+ projectId: projectId,
533
+ coreContract: coreContract
534
+ });
535
+ isConfigured = setPriceProjectConfig_.priceIsConfigured;
536
+ tokenPriceInWei = setPriceProjectConfig_.pricePerToken;
537
+ currencySymbol = "ETH";
538
+ currencyAddress = address(0);
539
+ }
540
+
541
+ /**
542
+ * @notice Returns remaining invocations for a given address.
543
+ * If `projectLimitsMintInvocationsPerAddress` is false, individual
544
+ * addresses are only limited by the project's maximum invocations, and a
545
+ * dummy value of zero is returned for `mintInvocationsRemaining`.
546
+ * If `projectLimitsMintInvocationsPerAddress` is true, the quantity of
547
+ * remaining mint invocations for address `address` is returned as
548
+ * `mintInvocationsRemaining`.
549
+ * Note that mint invocations per address can be changed at any time by the
550
+ * artist of a project.
551
+ * Also note that all mint invocations are limited by a project's maximum
552
+ * invocations as defined on the core contract. This function may return
553
+ * a value greater than the project's remaining invocations.
554
+ * @param projectId Project ID to get remaining invocations for.
555
+ * @param coreContract Contract address of the core contract.
556
+ * @param address_ Wallet address to get remaining invocations for.
557
+ * @return projectLimitsMintInvocationsPerAddress true if project limits
558
+ * mint invocations per address, false if project does not limit mint
559
+ * invocations per address.
560
+ * @return mintInvocationsRemaining quantity of remaining mint invocations
561
+ * for wallet at `address`.
562
+ */
563
+ function projectRemainingInvocationsForAddress(
564
+ uint256 projectId,
565
+ address coreContract,
566
+ address address_
567
+ )
568
+ external
569
+ view
570
+ returns (
571
+ bool projectLimitsMintInvocationsPerAddress,
572
+ uint256 mintInvocationsRemaining
573
+ )
574
+ {
575
+ return
576
+ MerkleLib.projectRemainingInvocationsForAddress({
577
+ projectId: projectId,
578
+ coreContract: coreContract,
579
+ address_: address_
580
+ });
581
+ }
582
+
583
+ /**
584
+ * @notice projectId => maximum invocations per allowlisted address. If a
585
+ * a value of 0 is returned, there is no limit on the number of mints per
586
+ * allowlisted address.
587
+ * Default behavior is limit 1 mint per address.
588
+ * This value can be changed at any time by the artist.
589
+ * @dev default value stated above must be updated if the value of
590
+ * CONFIG_USE_MAX_INVOCATIONS_PER_ADDRESS_OVERRIDE is changed.
591
+ * @param projectId Project ID to get maximum invocations per address for.
592
+ * @param coreContract Contract address of the core contract.
593
+ * @return Maximum number of invocations per address for project.
594
+ */
595
+ function projectMaxInvocationsPerAddress(
596
+ uint256 projectId,
597
+ address coreContract
598
+ ) external view returns (uint256) {
599
+ return
600
+ MerkleLib.projectMaxInvocationsPerAddress({
601
+ projectId: projectId,
602
+ coreContract: coreContract
603
+ });
604
+ }
605
+
606
+ /**
607
+ * @notice Returns the min mint fee for this minter, applied to all
608
+ * and-on projects.
609
+ * @return minMintFee Min mint fee, in wei
610
+ */
611
+ function minMintFee() external view returns (uint256) {
612
+ return MinPriceLib.getMinMintFee();
613
+ }
614
+
615
+ /**
616
+ * @notice Processes a proof for an address.
617
+ * @param proof The proof to process.
618
+ * @param address_ The address to process the proof for.
619
+ * @return The resulting hash from processing the proof.
620
+ */
621
+ function processProofForAddress(
622
+ bytes32[] calldata proof,
623
+ address address_
624
+ ) external pure returns (bytes32) {
625
+ return
626
+ MerkleLib.processProofForAddress({
627
+ proof: proof,
628
+ address_: address_
629
+ });
630
+ }
631
+
632
+ /**
633
+ * @notice Returns hashed address (to be used as merkle tree leaf).
634
+ * Included as a public function to enable users to calculate their hashed
635
+ * address in Solidity when generating proofs off-chain.
636
+ * @param address_ address to be hashed
637
+ * @return bytes32 hashed address, via keccak256 (using encodePacked)
638
+ */
639
+ function hashAddress(address address_) external pure returns (bytes32) {
640
+ return MerkleLib.hashAddress(address_);
641
+ }
642
+
643
+ /**
644
+ * @notice Syncs local maximum invocations of project `projectId` based on
645
+ * the value currently defined in the core contract.
646
+ * @param projectId Project ID to set the maximum invocations for.
647
+ * @param coreContract Core contract address for the given project.
648
+ * @dev this enables gas reduction after maxInvocations have been reached -
649
+ * core contracts shall still enforce a maxInvocation check during mint.
650
+ */
651
+ function syncProjectMaxInvocationsToCore(
652
+ uint256 projectId,
653
+ address coreContract
654
+ ) public {
655
+ AuthLib.onlyArtist({
656
+ projectId: projectId,
657
+ coreContract: coreContract,
658
+ sender: msg.sender
659
+ });
660
+
661
+ MaxInvocationsLib.syncProjectMaxInvocationsToCore({
662
+ projectId: projectId,
663
+ coreContract: coreContract
664
+ });
665
+ }
666
+
667
+ /**
668
+ * @notice Purchases a token from project `projectId` and sets
669
+ * the token's owner to `to`.
670
+ * @param to Address to be the new token's owner.
671
+ * @param projectId Project ID to mint a token on.
672
+ * @param coreContract Core contract address for the given project.
673
+ * @param proof Merkle proof for the given project.
674
+ * @param vault Vault being purchased on behalf of. Acceptable to be
675
+ * `address(0)` if no vault.
676
+ * @return tokenId Token ID of minted token
677
+ */
678
+ function purchaseTo(
679
+ address to,
680
+ uint256 projectId,
681
+ address coreContract,
682
+ bytes32[] calldata proof,
683
+ address vault // acceptable to be `address(0)` if no vault
684
+ ) public payable nonReentrant returns (uint256 tokenId) {
685
+ // CHECKS
686
+ // pre-mint MaxInvocationsLib checks
687
+ // Note that `maxHasBeenInvoked` is only checked here to reduce gas
688
+ // consumption after a project has been fully minted.
689
+ // `maxInvocationsProjectConfig.maxHasBeenInvoked` is locally cached to reduce
690
+ // gas consumption, but if not in sync with the core contract's value,
691
+ // the core contract also enforces its own max invocation check during
692
+ // minting.
693
+ MaxInvocationsLib.preMintChecks({
694
+ projectId: projectId,
695
+ coreContract: coreContract
696
+ });
697
+
698
+ // pre-mint checks for set price lib, and get price per token in wei
699
+ // @dev price per token is loaded into memory here for gas efficiency
700
+ uint256 pricePerTokenInWei = SetPriceLib.preMintChecksAndGetPrice({
701
+ projectId: projectId,
702
+ coreContract: coreContract
703
+ });
704
+
705
+ require(msg.value >= pricePerTokenInWei, "Min value to mint req.");
706
+
707
+ // NOTE: delegate-vault handling **begins here**.
708
+
709
+ // handle that the vault may be either the `msg.sender` in the case
710
+ // that there is not a true vault, or may be `vault` if one is
711
+ // provided explicitly (and it is valid).
712
+ address vault_ = msg.sender;
713
+ if (vault != address(0)) {
714
+ // If a vault is provided, it must be valid, otherwise throw rather
715
+ // than optimistically-minting with original `msg.sender`.
716
+ // Note, we do not check `checkDelegateForAll` as well, as it is known
717
+ // to be implicitly checked by calling `checkDelegateForContract`.
718
+ bool isValidDelegee = _delegationRegistryContract
719
+ .checkDelegateForContract({
720
+ delegate: msg.sender,
721
+ vault: vault,
722
+ contract_: coreContract
723
+ });
724
+ require(isValidDelegee, "Invalid delegate-vault pairing");
725
+ vault_ = vault;
726
+ }
727
+
728
+ // pre-mint MerkleLib checks
729
+ MerkleLib.preMintChecks({
730
+ projectId: projectId,
731
+ coreContract: coreContract,
732
+ proof: proof,
733
+ vault: vault_
734
+ });
735
+
736
+ // EFFECTS
737
+ // mint effects for MerkleLib
738
+ MerkleLib.mintEffects({
739
+ projectId: projectId,
740
+ coreContract: coreContract,
741
+ vault: vault_
742
+ });
743
+
744
+ tokenId = _minterFilter.mint_joo({
745
+ to: to,
746
+ projectId: projectId,
747
+ coreContract: coreContract,
748
+ sender: vault_
749
+ });
750
+
751
+ MaxInvocationsLib.validateMintEffectsInvocations({
752
+ tokenId: tokenId,
753
+ coreContract: coreContract
754
+ });
755
+
756
+ // INTERACTIONS
757
+ SplitFundsLib.sendAllToRenderProviderETHRefundSender({
758
+ projectId: projectId,
759
+ pricePerTokenInWei: pricePerTokenInWei,
760
+ coreContract: coreContract
761
+ });
762
+
763
+ return tokenId;
764
+ }
765
+ }