@artblocks/contracts 1.0.2 → 1.0.3

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 (194) hide show
  1. package/README.md +30 -2
  2. package/artifacts/contracts/AdminACLV0.sol/AdminACLV0.json +2 -2
  3. package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
  4. package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +22 -4
  5. package/artifacts/contracts/GenArt721CoreV3.sol/GenArt721CoreV3.json +42 -5
  6. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol/MinterDAExpV2.json +2 -2
  7. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol/MinterDAExpV3.json +2 -2
  8. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol/MinterDAExpSettlementV0.json +2 -2
  9. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV1.sol/MinterDAExpSettlementV1.json +2 -2
  10. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV2.sol/MinterDALinV2.json +2 -2
  11. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV3.sol/MinterDALinV3.json +2 -2
  12. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV1.sol/MinterHolderV1.json +2 -2
  13. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +2 -2
  14. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV3.sol/MinterHolderV3.json +2 -2
  15. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV1.sol/MinterMerkleV1.json +2 -2
  16. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV2.sol/MinterMerkleV2.json +2 -2
  17. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol/MinterMerkleV3.json +2 -2
  18. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol/MinterMerkleV4.json +2 -2
  19. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol/MinterSetPriceV2.json +2 -2
  20. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol/MinterSetPriceV3.json +2 -2
  21. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol/MinterSetPriceERC20V2.json +2 -2
  22. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol/MinterSetPriceERC20V3.json +2 -2
  23. package/artifacts/contracts/engine/{GenArt721CoreV2_ENGINE_FLEX.sol → V2/GenArt721CoreV2_ENGINE_FLEX.sol}/GenArt721CoreV2_ENGINE_FLEX.json +3 -3
  24. package/artifacts/contracts/engine/{GenArt721CoreV2_PBAB.sol → V2/GenArt721CoreV2_PBAB.sol}/GenArt721CoreV2_PBAB.json +3 -3
  25. package/artifacts/contracts/engine/{GenArt721CoreV2_PRTNR.sol → V2/GenArt721CoreV2_PRTNR.sol}/GenArt721CoreV2_PRTNR.json +3 -3
  26. package/artifacts/contracts/engine/{GenArt721MinterBurner_PBAB.sol → V2/GenArt721MinterBurner_PBAB.sol}/GenArt721MinterBurner_PBAB.json +3 -3
  27. package/artifacts/contracts/engine/{GenArt721MinterDAExp_PBAB.sol → V2/GenArt721MinterDAExp_PBAB.sol}/GenArt721MinterDAExp_PBAB.json +3 -3
  28. package/artifacts/contracts/engine/{GenArt721Minter_PBAB.sol → V2/GenArt721Minter_PBAB.sol}/GenArt721Minter_PBAB.json +3 -3
  29. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +1960 -0
  30. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +2247 -0
  31. package/artifacts/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol/GenArt721CoreV3_Engine_Flex_PROOF.json +2247 -0
  32. package/artifacts/contracts/engine/V3/forks/PROHIBITION/AdminACLV0_PROHIBITION.sol/AdminACLV0_PROHIBITION.json +401 -0
  33. package/artifacts/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol/GenArt721CoreV3_Engine_Flex_PROHIBITION.json +2281 -0
  34. package/artifacts/contracts/engine/V3/forks/PROHIBITION/interfaces/IAdminACLV0_PROHIBITION.sol/IAdminACLV0_PROHIBITION.json +359 -0
  35. package/artifacts/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.json +1094 -0
  36. package/artifacts/contracts/engine-registry/CoreRegistryV1.sol/CoreRegistryV1.json +242 -0
  37. package/artifacts/contracts/engine-registry/EngineRegistryV0.sol/EngineRegistryV0.json +2 -2
  38. package/artifacts/contracts/explorations/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +41 -4
  39. package/artifacts/contracts/interfaces/0.8.x/IBytecodeStorageReader.sol/IBytecodeStorageReader.json +111 -0
  40. package/artifacts/contracts/interfaces/0.8.x/ICoreRegistryV1.sol/ICoreRegistryV1.json +172 -0
  41. package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterSEAV0.sol/IFilteredMinterSEAV0.json +55 -53
  42. package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractExposesHashSeed.sol/IGenArt721CoreContractExposesHashSeed.json +30 -0
  43. package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV3.sol/IGenArt721CoreContractV3.json +13 -0
  44. package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Base.sol/IGenArt721CoreContractV3_Base.json +13 -0
  45. package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Engine.sol/IGenArt721CoreContractV3_Engine.json +7 -13
  46. package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol/IGenArt721CoreContractV3_Engine_Flex.json +7 -13
  47. package/artifacts/contracts/interfaces/0.8.x/IMinterFilterV1.sol/IMinterFilterV1.json +429 -0
  48. package/artifacts/contracts/interfaces/0.8.x/IPseudorandomAtomic.sol/IPseudorandomAtomic.json +30 -0
  49. package/artifacts/contracts/interfaces/0.8.x/IRandomizer_V3CoreBase.sol/IRandomizer_V3CoreBase.json +24 -0
  50. package/artifacts/contracts/interfaces/0.8.x/ISharedRandomizerV0.sol/ISharedRandomizerV0.json +207 -0
  51. package/artifacts/contracts/libs/0.8.x/{BytecodeStorage.sol → BytecodeStorageV0.sol}/BytecodeStorage.json +3 -3
  52. package/artifacts/contracts/libs/0.8.x/BytecodeStorageV1.sol/BytecodeStorageReader.json +163 -0
  53. package/artifacts/contracts/libs/0.8.x/BytecodeStorageV1.sol/BytecodeStorageWriter.json +10 -0
  54. package/artifacts/contracts/libs/0.8.x/Bytes32Strings.sol/Bytes32Strings.json +2 -2
  55. package/artifacts/contracts/libs/0.8.x/ERC721_PackedHashSeed.sol/ERC721_PackedHashSeed.json +2 -2
  56. package/artifacts/contracts/libs/0.8.x/SSTORE2.sol/SSTORE2.json +10 -0
  57. package/artifacts/contracts/libs/integration-refs/delegation-registry/DelegationRegistry.sol/DelegationRegistry.json +2 -2
  58. package/artifacts/contracts/libs/integration-refs/gnosis-safe/GnosisSafeMock.sol/GnosisSafeMock.json +2 -2
  59. package/artifacts/contracts/libs/integration-refs/gnosis-safe/GnosisSafeProxyFactoryMock.sol/GnosisSafeProxyFactoryMock.json +2 -2
  60. package/artifacts/contracts/libs/integration-refs/gnosis-safe/MultiSendMock.sol/MultiSendMock.json +2 -2
  61. package/artifacts/contracts/libs/integration-refs/weth9/weth9.sol/WETH9_.json +2 -2
  62. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV1.sol/MinterFilterV1.json +2 -2
  63. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV2.sol/MinterFilterV2.json +692 -0
  64. package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +2 -2
  65. package/artifacts/contracts/minter-suite/Minters/MinterDAExpV4.sol/MinterDAExpV4.json +2 -2
  66. package/artifacts/contracts/minter-suite/Minters/MinterDALinV4.sol/MinterDALinV4.json +2 -2
  67. package/artifacts/contracts/minter-suite/Minters/MinterHolderV4.sol/MinterHolderV4.json +2 -2
  68. package/artifacts/contracts/minter-suite/Minters/MinterMerkleV5.sol/MinterMerkleV5.json +2 -2
  69. package/artifacts/contracts/minter-suite/Minters/MinterPolyptychV0.sol/IGenArt721CoreContractV3WithRandomizer.json +10 -160
  70. package/artifacts/contracts/minter-suite/Minters/MinterPolyptychV0.sol/MinterPolyptychV0.json +2 -2
  71. package/artifacts/contracts/minter-suite/Minters/MinterSEAV0.sol/MinterSEAV0.json +59 -80
  72. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V4.sol/MinterSetPriceERC20V4.json +2 -2
  73. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV4.sol/MinterSetPriceV4.json +2 -2
  74. package/artifacts/contracts/mock/{BytecodeTextCR_DMock.sol/BytecodeTextCR_DMock.json → BytecodeV0TextCR_DMock.sol/BytecodeV0TextCR_DMock.json} +4 -4
  75. package/artifacts/contracts/mock/BytecodeV1LibCallsMock.sol/BytecodeV1LibCallsMock.json +135 -0
  76. package/artifacts/contracts/mock/BytecodeV1TextCR_DMock.sol/BytecodeV1TextCR_DMock.json +301 -0
  77. package/artifacts/contracts/mock/DeadReceiverBidderMock.sol/DeadReceiverBidderMock.json +2 -2
  78. package/artifacts/contracts/mock/DeadReceiverMock.sol/DeadReceiverMock.json +2 -2
  79. package/artifacts/contracts/mock/DummySharedMinter.sol/DummySharedMinter.json +114 -0
  80. package/artifacts/contracts/mock/ERC20Mock.sol/ERC20Mock.json +2 -2
  81. package/artifacts/contracts/mock/GasLimitReceiverBidderMock.sol/GasLimitReceiverBidderMock.json +2 -2
  82. package/artifacts/contracts/mock/GasLimitReceiverMock.sol/GasLimitReceiverMock.json +2 -2
  83. package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +22 -4
  84. package/artifacts/contracts/mock/MockAdminACLV0.sol/MockAdminACLV0Events.json +2 -2
  85. package/artifacts/contracts/mock/MockAdminACLV0_PROHIBITION.sol/MockAdminACLV0Events_PROHIBITION.json +440 -0
  86. package/artifacts/contracts/mock/OriginRegisterMock.sol/OriginRegisterMock.json +39 -0
  87. package/artifacts/contracts/mock/RandomizerV2_NoAssignMock.sol/RandomizerV2_NoAssignMock.json +2 -2
  88. package/artifacts/contracts/mock/ReentrancyHolderMock.sol/ReentrancyHolderMock.json +2 -2
  89. package/artifacts/contracts/mock/ReentrancyMerkleMock.sol/ReentrancyMerkleMock.json +2 -2
  90. package/artifacts/contracts/mock/ReentrancyMock.sol/ReentrancyMock.json +2 -2
  91. package/artifacts/contracts/mock/ReentrancySEAMock.sol/ReentrancySEAAutoBidderMock.json +2 -2
  92. package/artifacts/contracts/mock/SSTORE2Mock.sol/SSTORE2Mock.json +118 -0
  93. package/artifacts/contracts/randomizer/{BasicRandomizer.sol → deprecated/BasicRandomizer.sol}/BasicRandomizer.json +3 -3
  94. package/artifacts/contracts/randomizer/{BasicRandomizerBase_v0_0_0.sol → deprecated/BasicRandomizerBase_v0_0_0.sol}/RandomizerBase.json +1 -1
  95. package/artifacts/contracts/randomizer/{PolyptychRandomizerV0.sol → deprecated/PolyptychRandomizerV0.sol}/BasicPolyptychRandomizerV0.json +3 -3
  96. package/artifacts/contracts/randomizer/{RandomizerV2.sol → deprecated/RandomizerV2.sol}/BasicRandomizerV2.json +3 -3
  97. package/artifacts/contracts/randomizer/primitive/PseudorandomAtomicBasic.sol/PseudorandomAtomic.json +30 -0
  98. package/artifacts/contracts/randomizer/shared/SharedRandomizerV0.sol/SharedRandomizerV0.json +231 -0
  99. package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverride.sol/GenArt721RoyaltyOverride.json +2 -2
  100. package/contracts/AdminACLV0.sol +1 -1
  101. package/contracts/AdminACLV1.sol +1 -1
  102. package/contracts/DependencyRegistryV0.sol +15 -28
  103. package/contracts/GenArt721CoreV3.sol +37 -34
  104. package/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol +1 -1
  105. package/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol +1 -1
  106. package/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol +1 -1
  107. package/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV1.sol +1 -1
  108. package/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV2.sol +1 -1
  109. package/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV3.sol +1 -1
  110. package/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV1.sol +1 -1
  111. package/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV2.sol +1 -1
  112. package/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV3.sol +1 -1
  113. package/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV1.sol +1 -1
  114. package/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV2.sol +1 -1
  115. package/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol +1 -1
  116. package/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol +1 -1
  117. package/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol +1 -1
  118. package/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol +1 -1
  119. package/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol +1 -1
  120. package/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol +1 -1
  121. package/contracts/engine/{GenArt721CoreV2_ENGINE_FLEX.sol → V2/GenArt721CoreV2_ENGINE_FLEX.sol} +2 -2
  122. package/contracts/engine/{GenArt721CoreV2_PBAB.sol → V2/GenArt721CoreV2_PBAB.sol} +2 -2
  123. package/contracts/engine/{GenArt721CoreV2_PRTNR.sol → V2/GenArt721CoreV2_PRTNR.sol} +3 -3
  124. package/contracts/engine/{GenArt721MinterBurner_PBAB.sol → V2/GenArt721MinterBurner_PBAB.sol} +2 -2
  125. package/contracts/engine/{GenArt721MinterDAExp_PBAB.sol → V2/GenArt721MinterDAExp_PBAB.sol} +2 -2
  126. package/contracts/engine/{GenArt721Minter_PBAB.sol → V2/GenArt721Minter_PBAB.sol} +2 -2
  127. package/contracts/{GenArt721CoreV3_Engine.sol → engine/V3/GenArt721CoreV3_Engine.sol} +29 -20
  128. package/contracts/{GenArt721CoreV3_Engine_Flex.sol → engine/V3/GenArt721CoreV3_Engine_Flex.sol} +30 -21
  129. package/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol +2293 -0
  130. package/contracts/engine/V3/forks/PROHIBITION/AdminACLV0_PROHIBITION.sol +281 -0
  131. package/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol +2354 -0
  132. package/contracts/engine/V3/forks/PROHIBITION/interfaces/IAdminACLV0_PROHIBITION.sol +123 -0
  133. package/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol +29 -0
  134. package/contracts/engine-registry/CoreRegistryV1.sol +254 -0
  135. package/contracts/engine-registry/EngineRegistryV0.sol +1 -1
  136. package/contracts/explorations/GenArt721CoreV3_Explorations.sol +34 -31
  137. package/contracts/interfaces/0.8.x/IBytecodeStorageReader.sol +62 -0
  138. package/contracts/interfaces/0.8.x/ICoreRegistryV1.sol +27 -0
  139. package/contracts/interfaces/0.8.x/IDelegationRegistry.sol +1 -1
  140. package/contracts/interfaces/0.8.x/IDependencyRegistryCompatibleV0.sol +1 -1
  141. package/contracts/interfaces/0.8.x/IDependencyRegistryV0.sol +1 -1
  142. package/contracts/interfaces/0.8.x/IEngineRegistryV0.sol +1 -1
  143. package/contracts/interfaces/0.8.x/IFilteredMinterSEAV0.sol +34 -15
  144. package/contracts/interfaces/0.8.x/IGenArt721CoreContractExposesHashSeed.sol +11 -0
  145. package/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Base.sol +3 -0
  146. package/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Engine.sol +0 -5
  147. package/contracts/interfaces/0.8.x/IMinterFilterV1.sol +158 -0
  148. package/contracts/interfaces/0.8.x/IPseudorandomAtomic.sol +16 -0
  149. package/contracts/interfaces/0.8.x/IRandomizerPolyptychV0.sol +1 -1
  150. package/contracts/interfaces/0.8.x/IRandomizerV2.sol +2 -5
  151. package/contracts/interfaces/0.8.x/IRandomizer_V3CoreBase.sol +10 -0
  152. package/contracts/interfaces/0.8.x/ISharedRandomizerV0.sol +105 -0
  153. package/contracts/libs/0.8.x/BytecodeStorageV1.sol +399 -0
  154. package/contracts/libs/0.8.x/SSTORE2.sol +109 -0
  155. package/contracts/libs/integration-refs/delegation-registry/DelegationRegistry.sol +1 -1
  156. package/contracts/libs/integration-refs/weth9/weth9.sol +2 -0
  157. package/contracts/minter-suite/MinterFilter/MinterFilterV1.sol +1 -1
  158. package/contracts/minter-suite/MinterFilter/MinterFilterV2.sol +756 -0
  159. package/contracts/minter-suite/Minters/MinterDAExpSettlementV2.sol +1 -1
  160. package/contracts/minter-suite/Minters/MinterDAExpV4.sol +1 -1
  161. package/contracts/minter-suite/Minters/MinterDALinV4.sol +1 -1
  162. package/contracts/minter-suite/Minters/MinterHolderV4.sol +1 -1
  163. package/contracts/minter-suite/Minters/MinterMerkleV5.sol +1 -1
  164. package/contracts/minter-suite/Minters/MinterPolyptychV0.sol +14 -13
  165. package/contracts/minter-suite/Minters/MinterSEAV0.sol +232 -183
  166. package/contracts/minter-suite/Minters/MinterSetPriceERC20V4.sol +1 -1
  167. package/contracts/minter-suite/Minters/MinterSetPriceV4.sol +1 -1
  168. package/contracts/mock/{BytecodeTextCR_DMock.sol → BytecodeV0TextCR_DMock.sol} +5 -5
  169. package/contracts/mock/BytecodeV1LibCallsMock.sol +114 -0
  170. package/contracts/mock/BytecodeV1TextCR_DMock.sol +233 -0
  171. package/contracts/mock/DeadReceiverBidderMock.sol +1 -1
  172. package/contracts/mock/DeadReceiverMock.sol +1 -1
  173. package/contracts/mock/DummySharedMinter.sol +75 -0
  174. package/contracts/mock/GasLimitReceiverBidderMock.sol +1 -1
  175. package/contracts/mock/GasLimitReceiverMock.sol +1 -1
  176. package/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol +14 -27
  177. package/contracts/mock/MockAdminACLV0.sol +1 -1
  178. package/contracts/mock/MockAdminACLV0_PROHIBITION.sol +207 -0
  179. package/contracts/mock/OriginRegisterMock.sol +27 -0
  180. package/contracts/mock/RandomizerV2_NoAssignMock.sol +2 -2
  181. package/contracts/mock/SSTORE2Mock.sol +93 -0
  182. package/contracts/randomizer/{BasicRandomizer.sol → deprecated/BasicRandomizer.sol} +1 -1
  183. package/contracts/randomizer/{BasicRandomizerBase_v0_0_0.sol → deprecated/BasicRandomizerBase_v0_0_0.sol} +1 -1
  184. package/contracts/randomizer/{PolyptychRandomizerV0.sol → deprecated/PolyptychRandomizerV0.sol} +3 -3
  185. package/contracts/randomizer/{RandomizerV2.sol → deprecated/RandomizerV2.sol} +3 -3
  186. package/contracts/randomizer/primitive/PseudorandomAtomicBasic.sol +30 -0
  187. package/contracts/randomizer/shared/SharedRandomizerV0.sol +245 -0
  188. package/package.json +23 -30
  189. package/.env.example +0 -17
  190. package/artifacts/contracts/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +0 -1942
  191. package/artifacts/contracts/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +0 -2229
  192. package/artifacts/contracts/engine-registry/future/EngineRegistryV1.sol/EngineRegistryV1.json +0 -109
  193. package/contracts/engine-registry/future/EngineRegistryV1.sol +0 -86
  194. /package/contracts/libs/0.8.x/{BytecodeStorage.sol → BytecodeStorageV0.sol} +0 -0
@@ -0,0 +1,2354 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ pragma solidity 0.8.19;
3
+
4
+ // Created By: Art Blocks Inc.
5
+
6
+ import "./interfaces/IAdminACLV0_PROHIBITION.sol";
7
+ import "./interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol";
8
+
9
+ import "../../../../interfaces/0.8.x/IRandomizerV2.sol";
10
+ import "../../../../interfaces/0.8.x/IEngineRegistryV0.sol";
11
+ import "../../../../interfaces/0.8.x/IDependencyRegistryCompatibleV0.sol";
12
+ import "../../../../interfaces/0.8.x/IManifold.sol";
13
+
14
+ import "@openzeppelin-4.7/contracts/access/Ownable.sol";
15
+ import "../../../../libs/0.8.x/ERC721_PackedHashSeed.sol";
16
+ import "../../../../libs/0.8.x/BytecodeStorageV1.sol";
17
+ import "../../../../libs/0.8.x/Bytes32Strings.sol";
18
+
19
+ /**
20
+ * @title Art Blocks Engine Flex ERC-721 core contract, V3.
21
+ * @author Art Blocks Inc.
22
+ * @notice Privileged Roles and Ownership:
23
+ * This contract is designed to be managed, with progressively limited powers
24
+ * as a project progresses from active to locked.
25
+ * Privileged roles and abilities are controlled by the admin ACL contract and
26
+ * artists. Both of these roles hold extensive power and can arbitrarily
27
+ * control and modify portions of projects, dependent upon project state. After
28
+ * a project is locked, important project metadata fields are locked including
29
+ * the project name, artist name, and script and display details. Edition size
30
+ * can never be increased.
31
+ * Care must be taken to ensure that the admin ACL contract and artist
32
+ * addresses are secure behind a multi-sig or other access control mechanism.
33
+ * ----------------------------------------------------------------------------
34
+ * The following functions are restricted to the Admin ACL contract:
35
+ * - updateArtblocksDependencyRegistryAddress
36
+ * - updateProviderSalesAddresses
37
+ * - updateProviderPrimarySalesPercentages (up to 100%)
38
+ * - updateProviderSecondarySalesBPS (up to 100%)
39
+ * - updateMinterContract
40
+ * - updateRandomizerAddress
41
+ * - toggleProjectIsActive
42
+ * - addProject
43
+ * - forbidNewProjects (forever forbidding new projects)
44
+ * - updateDefaultBaseURI (used to initialize new project base URIs)
45
+ * - updateIPFSGateway
46
+ * - updateArweaveGateway
47
+ * ----------------------------------------------------------------------------
48
+ * The following functions are restricted to either the the Artist address or
49
+ * the Admin ACL contract, only when the project is not locked:
50
+ * - updateProjectName
51
+ * - updateProjectArtistName
52
+ * - updateProjectLicense
53
+ * - Change project script via addProjectScript, updateProjectScript,
54
+ * and removeProjectLastScript
55
+ * - updateProjectScriptType
56
+ * - updateProjectAspectRatio
57
+ * - updateProjectSecondaryMarketRoyaltyPercentage (up to
58
+ * ARTIST_MAX_SECONDARY_ROYALTY_PERCENTAGE percent)
59
+ * - updateProjectWebsite
60
+ * - updateProjectMaxInvocations (to a number greater than or equal to the
61
+ * current number of invocations, and less than current project maximum
62
+ * invocations)
63
+ * - updateProjectBaseURI (controlling the base URI for tokens in the project)
64
+ * ----------------------------------------------------------------------------
65
+ * The following functions are restricted to only the Artist or Admin ACL
66
+ * contract of a valid project ID:
67
+ * - proposeArtistPaymentAddressesAndSplits (Note that this has to be accepted
68
+ * by adminAcceptArtistAddressesAndSplits to take effect, which is restricted
69
+ * to the Admin ACL contract, or the artist if the core contract owner has
70
+ * renounced ownership. Also note that a proposal will be automatically
71
+ * accepted if the artist only proposes changed payee percentages without
72
+ * modifying any payee addresses, or is only removing payee addresses, or
73
+ * if the global config `autoApproveArtistSplitProposals` is set to `true`.)
74
+ * - toggleProjectIsPaused (note the artist can still mint while paused)
75
+ * ----------------------------------------------------------------------------
76
+ * The following function is restricted to either the Admin ACL contract, or
77
+ * the Artist address if the core contract owner has renounced ownership:
78
+ * - adminAcceptArtistAddressesAndSplits
79
+ * - updateProjectArtistAddress (owner ultimately controlling the project and
80
+ * its and-on revenue, unless owner has renounced ownership)
81
+ * ----------------------------------------------------------------------------
82
+ * The following function is restricted to the artist or AdminACL contract when
83
+ * a project is unlocked, and only callable by Admin ACL contract when a project
84
+ * is locked:
85
+ * - updateProjectDescription
86
+ * ----------------------------------------------------------------------------
87
+ * The following functions for managing external asset dependencies are restricted
88
+ * to projects with external asset dependencies that are unlocked:
89
+ * - lockProjectExternalAssetDependencies
90
+ * - updateProjectExternalAssetDependency
91
+ * - removeProjectExternalAssetDependency
92
+ * - addProjectExternalAssetDependency
93
+ * ----------------------------------------------------------------------------
94
+ * The following function is restricted to owner calling directly:
95
+ * - transferOwnership
96
+ * - renounceOwnership
97
+ * ----------------------------------------------------------------------------
98
+ * The following configuration variables are set at time of contract deployment,
99
+ * and not modifiable thereafter (immutable after the point of deployment):
100
+ * - (bool) autoApproveArtistSplitProposals
101
+ * ----------------------------------------------------------------------------
102
+ * Additional admin and artist privileged roles may be described on minters,
103
+ * registries, and other contracts that may interact with this core contract.
104
+ */
105
+ contract GenArt721CoreV3_Engine_Flex_PROHIBITION is
106
+ ERC721_PackedHashSeed,
107
+ Ownable,
108
+ IDependencyRegistryCompatibleV0,
109
+ IManifold,
110
+ IGenArt721CoreContractV3_Engine_Flex_PROHIBITION
111
+ {
112
+ using BytecodeStorageWriter for string;
113
+ using Bytes32Strings for bytes32;
114
+ uint256 constant ONE_HUNDRED = 100;
115
+ uint256 constant ONE_MILLION = 1_000_000;
116
+ uint24 constant ONE_MILLION_UINT24 = 1_000_000;
117
+ uint256 constant FOUR_WEEKS_IN_SECONDS = 2_419_200;
118
+ uint8 constant AT_CHARACTER_CODE = uint8(bytes1("@")); // 0x40
119
+
120
+ // numeric constants
121
+ uint256 constant MAX_PROVIDER_SECONDARY_SALES_BPS = 10000; // 10_000 BPS = 100%
122
+ uint256 constant ARTIST_MAX_SECONDARY_ROYALTY_PERCENTAGE = 95; // 95%
123
+
124
+ // This contract emits generic events that contain fields that indicate
125
+ // which parameter has been updated. This is sufficient for application
126
+ // state management, while also simplifying the contract and indexing code.
127
+ // This was done as an alternative to having custom events that emit what
128
+ // field-values have changed for each event, given that changed values can
129
+ // be introspected by indexers due to the design of this smart contract
130
+ // exposing these state changes via publicly viewable fields.
131
+ //
132
+ // The following fields are used to indicate which contract-level parameter
133
+ // has been updated in the `PlatformUpdated` event:
134
+ bytes32 FIELD_NEXT_PROJECT_ID = "nextProjectId";
135
+ bytes32 FIELD_NEW_PROJECTS_FORBIDDEN = "newProjectsForbidden";
136
+ bytes32 FIELD_DEFAULT_BASE_URI = "defaultBaseURI";
137
+ bytes32 FIELD_RANDOMIZER_ADDRESS = "randomizerAddress";
138
+ bytes32 FIELD_ARTBLOCKS_DEPENDENCY_REGISTRY_ADDRESS =
139
+ "dependencyRegistryAddress";
140
+ bytes32 FIELD_PROVIDER_SALES_ADDRESSES = "providerSalesAddresses";
141
+ bytes32 FIELD_PROVIDER_PRIMARY_SALES_PERCENTAGES =
142
+ "providerPrimaryPercentages";
143
+ bytes32 FIELD_PROVIDER_SECONDARY_SALES_BPS = "providerSecondaryBPS";
144
+ // The following fields are used to indicate which project-level parameter
145
+ // has been updated in the `ProjectUpdated` event:
146
+ bytes32 FIELD_PROJECT_COMPLETED = "completed";
147
+ bytes32 FIELD_PROJECT_ACTIVE = "active";
148
+ bytes32 FIELD_PROJECT_ARTIST_ADDRESS = "artistAddress";
149
+ bytes32 FIELD_PROJECT_PAUSED = "paused";
150
+ bytes32 FIELD_PROJECT_CREATED = "created";
151
+ bytes32 FIELD_PROJECT_NAME = "name";
152
+ bytes32 FIELD_PROJECT_ARTIST_NAME = "artistName";
153
+ bytes32 FIELD_PROJECT_SECONDARY_MARKET_ROYALTY_PERCENTAGE =
154
+ "royaltyPercentage";
155
+ bytes32 FIELD_PROJECT_DESCRIPTION = "description";
156
+ bytes32 FIELD_PROJECT_WEBSITE = "website";
157
+ bytes32 FIELD_PROJECT_LICENSE = "license";
158
+ bytes32 FIELD_PROJECT_MAX_INVOCATIONS = "maxInvocations";
159
+ bytes32 FIELD_PROJECT_SCRIPT = "script";
160
+ bytes32 FIELD_PROJECT_SCRIPT_TYPE = "scriptType";
161
+ bytes32 FIELD_PROJECT_ASPECT_RATIO = "aspectRatio";
162
+ bytes32 FIELD_PROJECT_BASE_URI = "baseURI";
163
+
164
+ /// Dependency registry managed by Art Blocks
165
+ address public artblocksDependencyRegistryAddress;
166
+
167
+ /// current randomizer contract
168
+ IRandomizerV2 public randomizerContract;
169
+
170
+ /// append-only array of all randomizer contract addresses ever used by
171
+ /// this contract
172
+ address[] private _historicalRandomizerAddresses;
173
+
174
+ /// admin ACL contract
175
+ IAdminACLV0 public adminACLContract;
176
+
177
+ struct Project {
178
+ uint24 invocations;
179
+ uint24 maxInvocations;
180
+ uint24 scriptCount;
181
+ // max uint64 ~= 1.8e19 sec ~= 570 billion years
182
+ uint64 completedTimestamp;
183
+ bool active;
184
+ bool paused;
185
+ string name;
186
+ string artist;
187
+ string description;
188
+ string website;
189
+ string license;
190
+ string projectBaseURI;
191
+ bytes32 scriptTypeAndVersion;
192
+ string aspectRatio;
193
+ // mapping from script index to address storing script in bytecode
194
+ mapping(uint256 => address) scriptBytecodeAddresses;
195
+ bool externalAssetDependenciesLocked;
196
+ uint24 externalAssetDependencyCount;
197
+ mapping(uint256 => ExternalAssetDependency) externalAssetDependencies;
198
+ }
199
+
200
+ mapping(uint256 => Project) projects;
201
+
202
+ string public preferredIPFSGateway;
203
+ string public preferredArweaveGateway;
204
+
205
+ /// packed struct containing project financial information
206
+ struct ProjectFinance {
207
+ address payable additionalPayeePrimarySales;
208
+ // packed uint: max of 95, max uint8 = 255
209
+ uint8 secondaryMarketRoyaltyPercentage;
210
+ address payable additionalPayeeSecondarySales;
211
+ // packed uint: max of 100, max uint8 = 255
212
+ uint8 additionalPayeeSecondarySalesPercentage;
213
+ address payable artistAddress;
214
+ // packed uint: max of 100, max uint8 = 255
215
+ uint8 additionalPayeePrimarySalesPercentage;
216
+ }
217
+ // Project financials mapping
218
+ mapping(uint256 => ProjectFinance) projectIdToFinancials;
219
+
220
+ /// hash of artist's proposed payment updates to be approved by admin
221
+ mapping(uint256 => bytes32) public proposedArtistAddressesAndSplitsHash;
222
+
223
+ /// The render provider payment address for all primary sales revenues
224
+ /// (packed)
225
+ address payable public renderProviderPrimarySalesAddress;
226
+ /// Percentage of primary sales revenue allocated to the render provider
227
+ /// (packed)
228
+ // packed uint: max of 100, max uint8 = 255
229
+ uint8 private _renderProviderPrimarySalesPercentage = 10;
230
+ /// The platform provider payment address for all primary sales revenues
231
+ /// (packed)
232
+ address payable public platformProviderPrimarySalesAddress;
233
+ /// Percentage of primary sales revenue allocated to the platform provider
234
+ /// (packed)
235
+ // packed uint: max of 100, max uint8 = 255
236
+ uint8 private _platformProviderPrimarySalesPercentage = 10;
237
+
238
+ /// The render provider payment address for all secondary sales royalty
239
+ /// revenues
240
+ address payable public renderProviderSecondarySalesAddress;
241
+ /// Basis Points of secondary sales royalties allocated to the
242
+ /// render provider
243
+ uint256 public renderProviderSecondarySalesBPS = 250;
244
+ /// The platform provider payment address for all secondary sales royalty
245
+ /// revenues
246
+ address payable public platformProviderSecondarySalesAddress;
247
+ /// Basis Points of secondary sales royalties allocated to the
248
+ /// platform provider
249
+ uint256 public platformProviderSecondarySalesBPS = 250;
250
+
251
+ /// single minter allowed for this core contract
252
+ address public minterContract;
253
+
254
+ /// starting (initial) project ID on this contract
255
+ uint256 public immutable startingProjectId;
256
+
257
+ /// next project ID to be created
258
+ uint248 private _nextProjectId;
259
+
260
+ /// bool indicating if adding new projects is forbidden;
261
+ /// default behavior is to allow new projects
262
+ bool public newProjectsForbidden;
263
+
264
+ /// configuration variable (determined at time of deployment)
265
+ /// that determines whether or not admin approval^ should be required
266
+ /// to accept artist address change proposals, or if these proposals
267
+ /// should always auto-approve, as determined by the business process
268
+ /// requirements of the Engine partner using this contract.
269
+ ///
270
+ /// ^does not apply in the case where contract-ownership itself is revoked
271
+ bool public immutable autoApproveArtistSplitProposals;
272
+
273
+ /// version & type of this core contract
274
+ bytes32 constant CORE_VERSION = "v3.1.3";
275
+
276
+ function coreVersion() external pure returns (string memory) {
277
+ return CORE_VERSION.toString();
278
+ }
279
+
280
+ bytes32 constant CORE_TYPE = "GenArt721CoreV3_Engine_Flex";
281
+
282
+ function coreType() external pure returns (string memory) {
283
+ return CORE_TYPE.toString();
284
+ }
285
+
286
+ /// default base URI to initialize all new project projectBaseURI values to
287
+ string public defaultBaseURI;
288
+
289
+ function _onlyUnlockedProjectExternalAssetDependencies(
290
+ uint256 _projectId
291
+ ) internal view {
292
+ require(
293
+ !projects[_projectId].externalAssetDependenciesLocked,
294
+ "External dependencies locked"
295
+ );
296
+ }
297
+
298
+ function _onlyNonZeroAddress(address _address) internal pure {
299
+ require(_address != address(0), "Must input non-zero address");
300
+ }
301
+
302
+ function _onlyNonEmptyString(string memory _string) internal pure {
303
+ require(bytes(_string).length != 0, "Must input non-empty string");
304
+ }
305
+
306
+ function _onlyValidTokenId(uint256 _tokenId) internal view {
307
+ require(_exists(_tokenId), "Token ID does not exist");
308
+ }
309
+
310
+ function _onlyValidProjectId(uint256 _projectId) internal view {
311
+ require(
312
+ (_projectId >= startingProjectId) && (_projectId < _nextProjectId),
313
+ "Project ID does not exist"
314
+ );
315
+ }
316
+
317
+ function _onlyUnlocked(uint256 _projectId) internal view {
318
+ // Note: calling `_projectUnlocked` enforces that the `_projectId`
319
+ // passed in is valid.`
320
+ require(_projectUnlocked(_projectId), "Only if unlocked");
321
+ }
322
+
323
+ function _onlyAdminACL(bytes4 _selector, uint256 _projectId) internal {
324
+ require(
325
+ adminACLAllowed(msg.sender, address(this), _selector, _projectId),
326
+ "Only Admin ACL allowed"
327
+ );
328
+ }
329
+
330
+ function _onlyArtist(uint256 _projectId) internal view {
331
+ require(
332
+ msg.sender == projectIdToFinancials[_projectId].artistAddress,
333
+ "Only artist"
334
+ );
335
+ }
336
+
337
+ function _onlyArtistOrAdminACL(
338
+ uint256 _projectId,
339
+ bytes4 _selector
340
+ ) internal {
341
+ require(
342
+ msg.sender == projectIdToFinancials[_projectId].artistAddress ||
343
+ adminACLAllowed(
344
+ msg.sender,
345
+ address(this),
346
+ _selector,
347
+ _projectId
348
+ ),
349
+ "Only artist or Admin ACL allowed"
350
+ );
351
+ }
352
+
353
+ /**
354
+ * This modifier allows the artist of a project to call a function if the
355
+ * owner of the contract has renounced ownership. This is to allow the
356
+ * contract to continue to function if the owner decides to renounce
357
+ * ownership.
358
+ */
359
+ function _onlyAdminACLOrRenouncedArtist(
360
+ uint256 _projectId,
361
+ bytes4 _selector
362
+ ) internal {
363
+ require(
364
+ adminACLAllowed(msg.sender, address(this), _selector, _projectId) ||
365
+ (owner() == address(0) &&
366
+ msg.sender ==
367
+ projectIdToFinancials[_projectId].artistAddress),
368
+ "Only Admin ACL allowed, or artist if owner has renounced"
369
+ );
370
+ }
371
+
372
+ /**
373
+ * @notice Initializes contract.
374
+ * @param _tokenName Name of token.
375
+ * @param _tokenSymbol Token symbol.
376
+ * @param _randomizerContract Randomizer contract.
377
+ * @param _adminACLContract Address of admin access control contract, to be
378
+ * set as contract owner.
379
+ * @param _startingProjectId The initial next project ID.
380
+ * @param _autoApproveArtistSplitProposals Whether or not to always
381
+ * auto-approve proposed artist split updates.
382
+ * @dev _startingProjectId should be set to a value much, much less than
383
+ * max(uint248), but an explicit input type of `uint248` is used as it is
384
+ * safer to cast up to `uint256` than it is to cast down for the purposes
385
+ * of setting `_nextProjectId`.
386
+ */
387
+ constructor(
388
+ string memory _tokenName,
389
+ string memory _tokenSymbol,
390
+ address _renderProviderAddress,
391
+ address _platformProviderAddress,
392
+ address _randomizerContract,
393
+ address _adminACLContract,
394
+ uint248 _startingProjectId,
395
+ bool _autoApproveArtistSplitProposals,
396
+ address _engineRegistryContract
397
+ ) ERC721_PackedHashSeed(_tokenName, _tokenSymbol) {
398
+ _onlyNonZeroAddress(_renderProviderAddress);
399
+ _onlyNonZeroAddress(_platformProviderAddress);
400
+ _onlyNonZeroAddress(_randomizerContract);
401
+ _onlyNonZeroAddress(_adminACLContract);
402
+ // setup immutable `autoApproveArtistSplitProposals` config
403
+ autoApproveArtistSplitProposals = _autoApproveArtistSplitProposals;
404
+ // record contracts starting project ID
405
+ // casting-up is safe
406
+ startingProjectId = uint256(_startingProjectId);
407
+ _updateProviderSalesAddresses(
408
+ _renderProviderAddress,
409
+ _renderProviderAddress,
410
+ _platformProviderAddress,
411
+ _platformProviderAddress
412
+ );
413
+ _updateRandomizerAddress(_randomizerContract);
414
+ // set AdminACL management contract as owner
415
+ _transferOwnership(_adminACLContract);
416
+ // initialize default base URI
417
+ _updateDefaultBaseURI(
418
+ string.concat(
419
+ "https://token.artblocks.io/",
420
+ toHexString(address(this)),
421
+ "/"
422
+ )
423
+ );
424
+ // initialize next project ID
425
+ _nextProjectId = _startingProjectId;
426
+ emit PlatformUpdated(FIELD_NEXT_PROJECT_ID);
427
+ // register contract as an Engine contract
428
+ IEngineRegistryV0(_engineRegistryContract).registerContract(
429
+ address(this),
430
+ CORE_VERSION,
431
+ CORE_TYPE
432
+ );
433
+ }
434
+
435
+ /**
436
+ * @notice Updates preferredIPFSGateway to `_gateway`.
437
+ */
438
+ function updateIPFSGateway(string calldata _gateway) public {
439
+ _onlyAdminACL(this.updateIPFSGateway.selector, type(uint256).max);
440
+ preferredIPFSGateway = _gateway;
441
+ emit GatewayUpdated(ExternalAssetDependencyType.IPFS, _gateway);
442
+ }
443
+
444
+ /**
445
+ * @notice Updates preferredArweaveGateway to `_gateway`.
446
+ */
447
+ function updateArweaveGateway(string calldata _gateway) public {
448
+ _onlyAdminACL(this.updateArweaveGateway.selector, type(uint256).max);
449
+ preferredArweaveGateway = _gateway;
450
+ emit GatewayUpdated(ExternalAssetDependencyType.ARWEAVE, _gateway);
451
+ }
452
+
453
+ /**
454
+ * @notice Locks external asset dependencies for project `_projectId`.
455
+ */
456
+ function lockProjectExternalAssetDependencies(uint256 _projectId) external {
457
+ _onlyUnlockedProjectExternalAssetDependencies(_projectId);
458
+ _onlyArtistOrAdminACL(
459
+ _projectId,
460
+ this.lockProjectExternalAssetDependencies.selector
461
+ );
462
+ projects[_projectId].externalAssetDependenciesLocked = true;
463
+ emit ProjectExternalAssetDependenciesLocked(_projectId);
464
+ }
465
+
466
+ /**
467
+ * @notice Updates external asset dependency for project `_projectId`.
468
+ * @param _projectId Project to be updated.
469
+ * @param _index Asset index.
470
+ * @param _cidOrData Asset cid (Content identifier) or data string to be translated into bytecode.
471
+ * @param _dependencyType Asset dependency type.
472
+ * 0 - IPFS
473
+ * 1 - ARWEAVE
474
+ * 2 - ONCHAIN
475
+ */
476
+ function updateProjectExternalAssetDependency(
477
+ uint256 _projectId,
478
+ uint256 _index,
479
+ string memory _cidOrData,
480
+ ExternalAssetDependencyType _dependencyType
481
+ ) external {
482
+ _onlyUnlockedProjectExternalAssetDependencies(_projectId);
483
+ _onlyArtistOrAdminACL(
484
+ _projectId,
485
+ this.updateProjectExternalAssetDependency.selector
486
+ );
487
+ uint24 assetCount = projects[_projectId].externalAssetDependencyCount;
488
+ require(_index < assetCount, "Asset index out of range");
489
+ ExternalAssetDependency storage _oldDependency = projects[_projectId]
490
+ .externalAssetDependencies[_index];
491
+ ExternalAssetDependencyType _oldDependencyType = _oldDependency
492
+ .dependencyType;
493
+ projects[_projectId]
494
+ .externalAssetDependencies[_index]
495
+ .dependencyType = _dependencyType;
496
+ // if the incoming dependency type is onchain, we need to write the data to bytecode
497
+ if (_dependencyType == ExternalAssetDependencyType.ONCHAIN) {
498
+ if (_oldDependencyType != ExternalAssetDependencyType.ONCHAIN) {
499
+ // we only need to set the cid to an empty string if we are replacing an offchain asset
500
+ // an onchain asset will already have an empty cid
501
+ projects[_projectId].externalAssetDependencies[_index].cid = "";
502
+ }
503
+
504
+ projects[_projectId]
505
+ .externalAssetDependencies[_index]
506
+ .bytecodeAddress = _cidOrData.writeToBytecode();
507
+ // we don't want to emit data, so we emit the cid as an empty string
508
+ _cidOrData = "";
509
+ } else {
510
+ projects[_projectId]
511
+ .externalAssetDependencies[_index]
512
+ .cid = _cidOrData;
513
+ }
514
+ emit ExternalAssetDependencyUpdated(
515
+ _projectId,
516
+ _index,
517
+ _cidOrData,
518
+ _dependencyType,
519
+ assetCount
520
+ );
521
+ }
522
+
523
+ /**
524
+ * @notice Removes external asset dependency for project `_projectId` at index `_index`.
525
+ * Removal is done by swapping the element to be removed with the last element in the array, then deleting this last element.
526
+ * Assets with indices higher than `_index` can have their indices adjusted as a result of this operation.
527
+ * @param _projectId Project to be updated.
528
+ * @param _index Asset index
529
+ */
530
+ function removeProjectExternalAssetDependency(
531
+ uint256 _projectId,
532
+ uint256 _index
533
+ ) external {
534
+ _onlyUnlockedProjectExternalAssetDependencies(_projectId);
535
+ _onlyArtistOrAdminACL(
536
+ _projectId,
537
+ this.removeProjectExternalAssetDependency.selector
538
+ );
539
+ uint24 assetCount = projects[_projectId].externalAssetDependencyCount;
540
+ require(_index < assetCount, "Asset index out of range");
541
+
542
+ uint24 lastElementIndex = assetCount - 1;
543
+
544
+ // copy last element to index of element to be removed
545
+ projects[_projectId].externalAssetDependencies[_index] = projects[
546
+ _projectId
547
+ ].externalAssetDependencies[lastElementIndex];
548
+
549
+ delete projects[_projectId].externalAssetDependencies[lastElementIndex];
550
+
551
+ projects[_projectId].externalAssetDependencyCount = lastElementIndex;
552
+
553
+ emit ExternalAssetDependencyRemoved(_projectId, _index);
554
+ }
555
+
556
+ /**
557
+ * @notice Adds external asset dependency for project `_projectId`.
558
+ * @param _projectId Project to be updated.
559
+ * @param _cidOrData Asset cid (Content identifier) or data string to be translated into bytecode.
560
+ * @param _dependencyType Asset dependency type.
561
+ * 0 - IPFS
562
+ * 1 - ARWEAVE
563
+ * 2 - ONCHAIN
564
+ */
565
+ function addProjectExternalAssetDependency(
566
+ uint256 _projectId,
567
+ string memory _cidOrData,
568
+ ExternalAssetDependencyType _dependencyType
569
+ ) external {
570
+ _onlyUnlockedProjectExternalAssetDependencies(_projectId);
571
+ _onlyArtistOrAdminACL(
572
+ _projectId,
573
+ this.addProjectExternalAssetDependency.selector
574
+ );
575
+ uint24 assetCount = projects[_projectId].externalAssetDependencyCount;
576
+ address _bytecodeAddress = address(0);
577
+ // if the incoming dependency type is onchain, we need to write the data to bytecode
578
+ if (_dependencyType == ExternalAssetDependencyType.ONCHAIN) {
579
+ _bytecodeAddress = _cidOrData.writeToBytecode();
580
+ // we don't want to emit data, so we emit the cid as an empty string
581
+ _cidOrData = "";
582
+ }
583
+ ExternalAssetDependency memory asset = ExternalAssetDependency({
584
+ cid: _cidOrData,
585
+ dependencyType: _dependencyType,
586
+ bytecodeAddress: _bytecodeAddress
587
+ });
588
+ projects[_projectId].externalAssetDependencies[assetCount] = asset;
589
+ projects[_projectId].externalAssetDependencyCount = assetCount + 1;
590
+
591
+ emit ExternalAssetDependencyUpdated(
592
+ _projectId,
593
+ assetCount,
594
+ _cidOrData,
595
+ _dependencyType,
596
+ assetCount + 1
597
+ );
598
+ }
599
+
600
+ /**
601
+ * @notice Mints a token from project `_projectId` and sets the
602
+ * token's owner to `_to`. Hash may or may not be assigned to the token
603
+ * during the mint transaction, depending on the randomizer contract.
604
+ * @param _to Address to be the minted token's owner.
605
+ * @param _projectId Project ID to mint a token on.
606
+ * @param _by Purchaser of minted token.
607
+ * @return _tokenId The ID of the minted token.
608
+ * @dev sender must be the allowed minterContract
609
+ * @dev name of function is optimized for gas usage
610
+ */
611
+ function mint_Ecf(
612
+ address _to,
613
+ uint256 _projectId,
614
+ address _by
615
+ ) external returns (uint256 _tokenId) {
616
+ // CHECKS
617
+ require(msg.sender == minterContract, "Must mint from minter contract");
618
+ Project storage project = projects[_projectId];
619
+ // load invocations into memory
620
+ uint24 invocationsBefore = project.invocations;
621
+ uint24 invocationsAfter;
622
+ unchecked {
623
+ // invocationsBefore guaranteed <= maxInvocations <= 1_000_000,
624
+ // 1_000_000 << max uint24, so no possible overflow
625
+ invocationsAfter = invocationsBefore + 1;
626
+ }
627
+ uint24 maxInvocations = project.maxInvocations;
628
+
629
+ require(
630
+ invocationsBefore < maxInvocations,
631
+ "Must not exceed max invocations"
632
+ );
633
+ require(
634
+ project.active ||
635
+ _by == projectIdToFinancials[_projectId].artistAddress,
636
+ "Project must exist and be active"
637
+ );
638
+ require(
639
+ !project.paused ||
640
+ _by == projectIdToFinancials[_projectId].artistAddress,
641
+ "Purchases are paused."
642
+ );
643
+
644
+ // EFFECTS
645
+ // increment project's invocations
646
+ project.invocations = invocationsAfter;
647
+ uint256 thisTokenId;
648
+ unchecked {
649
+ // invocationsBefore is uint24 << max uint256. In production use,
650
+ // _projectId * ONE_MILLION must be << max uint256, otherwise
651
+ // tokenIdToProjectId function become invalid.
652
+ // Therefore, no risk of overflow
653
+ thisTokenId = (_projectId * ONE_MILLION) + invocationsBefore;
654
+ }
655
+
656
+ // mark project as completed if hit max invocations
657
+ if (invocationsAfter == maxInvocations) {
658
+ _completeProject(_projectId);
659
+ }
660
+
661
+ // INTERACTIONS
662
+ _mint(_to, thisTokenId);
663
+
664
+ // token hash is updated by the randomizer contract on V3
665
+ randomizerContract.assignTokenHash(thisTokenId);
666
+
667
+ // Do not need to also log `projectId` in event, as the `projectId` for
668
+ // a given token can be derived from the `tokenId` with:
669
+ // projectId = tokenId / 1_000_000
670
+ emit Mint(_to, thisTokenId);
671
+
672
+ return thisTokenId;
673
+ }
674
+
675
+ /**
676
+ * @notice Sets the hash seed for a given token ID `_tokenId`.
677
+ * May only be called by the current randomizer contract.
678
+ * May only be called for tokens that have not already been assigned a
679
+ * non-zero hash.
680
+ * @param _tokenId Token ID to set the hash for.
681
+ * @param _hashSeed Hash seed to set for the token ID. Only last 12 bytes
682
+ * will be used.
683
+ * @dev gas-optimized function name because called during mint sequence
684
+ * @dev if a separate event is required when the token hash is set, e.g.
685
+ * for indexing purposes, it must be emitted by the randomizer. This is to
686
+ * minimize gas when minting.
687
+ */
688
+ function setTokenHash_8PT(uint256 _tokenId, bytes32 _hashSeed) external {
689
+ _onlyValidTokenId(_tokenId);
690
+
691
+ OwnerAndHashSeed storage ownerAndHashSeed = _ownersAndHashSeeds[
692
+ _tokenId
693
+ ];
694
+ require(
695
+ msg.sender == address(randomizerContract),
696
+ "Only randomizer may set"
697
+ );
698
+ require(
699
+ ownerAndHashSeed.hashSeed == bytes12(0),
700
+ "Token hash already set"
701
+ );
702
+ require(_hashSeed != bytes12(0), "No zero hash seed");
703
+ ownerAndHashSeed.hashSeed = bytes12(_hashSeed);
704
+ }
705
+
706
+ /**
707
+ * @notice Allows owner (AdminACL) to revoke ownership of the contract.
708
+ * Note that the contract is intended to continue to function after the
709
+ * owner renounces ownership, but no new projects will be able to be added.
710
+ * Renouncing ownership will leave the contract without an owner,
711
+ * thereby removing any functionality that is only available to the
712
+ * owner/AdminACL contract. The same is true for any dependent contracts
713
+ * that also integrate with the owner/AdminACL contract (e.g. potentially
714
+ * minter suite contracts, registry contracts, etc.).
715
+ * After renouncing ownership, artists will be in control of updates to
716
+ * their payment addresses and splits (see modifier
717
+ * onlyAdminACLOrRenouncedArtist`).
718
+ * While there is no currently intended reason to call this method based on
719
+ * typical Engine partner business practices, this method exists to allow
720
+ * artists to continue to maintain the limited set of contract
721
+ * functionality that exists post-project-lock in an environment in which
722
+ * there is no longer an admin maintaining this smart contract.
723
+ * @dev This function is intended to be called directly by the AdminACL,
724
+ * not by an address allowed by the AdminACL contract.
725
+ */
726
+ function renounceOwnership() public override onlyOwner {
727
+ // broadcast that new projects are no longer allowed (if not already)
728
+ _forbidNewProjects();
729
+ // renounce ownership viw Ownable
730
+ Ownable.renounceOwnership();
731
+ }
732
+
733
+ /**
734
+ * @notice Updates reference to Art Blocks Dependency Registry contract.
735
+ * @param _artblocksDependencyRegistryAddress Address of new Dependency
736
+ * Registry.
737
+ */
738
+ function updateArtblocksDependencyRegistryAddress(
739
+ address _artblocksDependencyRegistryAddress
740
+ ) external {
741
+ _onlyAdminACL(
742
+ this.updateArtblocksDependencyRegistryAddress.selector,
743
+ type(uint256).max
744
+ );
745
+ _onlyNonZeroAddress(_artblocksDependencyRegistryAddress);
746
+ artblocksDependencyRegistryAddress = _artblocksDependencyRegistryAddress;
747
+ emit PlatformUpdated(FIELD_ARTBLOCKS_DEPENDENCY_REGISTRY_ADDRESS);
748
+ }
749
+
750
+ /**
751
+ * @notice Updates sales addresses for the platform and render providers to
752
+ * the input parameters.
753
+ * @param _renderProviderPrimarySalesAddress Address of new primary sales
754
+ * payment address.
755
+ * @param _renderProviderSecondarySalesAddress Address of new secondary sales
756
+ * payment address.
757
+ * @param _platformProviderPrimarySalesAddress Address of new primary sales
758
+ * payment address.
759
+ * @param _platformProviderSecondarySalesAddress Address of new secondary sales
760
+ * payment address.
761
+ */
762
+ function updateProviderSalesAddresses(
763
+ address payable _renderProviderPrimarySalesAddress,
764
+ address payable _renderProviderSecondarySalesAddress,
765
+ address payable _platformProviderPrimarySalesAddress,
766
+ address payable _platformProviderSecondarySalesAddress
767
+ ) external {
768
+ _onlyAdminACL(
769
+ this.updateProviderSalesAddresses.selector,
770
+ type(uint256).max
771
+ );
772
+ _onlyNonZeroAddress(_renderProviderPrimarySalesAddress);
773
+ _onlyNonZeroAddress(_renderProviderSecondarySalesAddress);
774
+ _onlyNonZeroAddress(_platformProviderPrimarySalesAddress);
775
+ _onlyNonZeroAddress(_platformProviderSecondarySalesAddress);
776
+ _updateProviderSalesAddresses(
777
+ _renderProviderPrimarySalesAddress,
778
+ _renderProviderSecondarySalesAddress,
779
+ _platformProviderPrimarySalesAddress,
780
+ _platformProviderSecondarySalesAddress
781
+ );
782
+ }
783
+
784
+ /**
785
+ * @notice Updates the render and platform provider primary sales revenue percentage to
786
+ * the provided inputs.
787
+ * @param renderProviderPrimarySalesPercentage_ New primary sales revenue % for the render provider
788
+ * @param platformProviderPrimarySalesPercentage_ New primary sales revenue % for the platform provider
789
+ * percentage.
790
+ */
791
+ function updateProviderPrimarySalesPercentages(
792
+ uint256 renderProviderPrimarySalesPercentage_,
793
+ uint256 platformProviderPrimarySalesPercentage_
794
+ ) external {
795
+ _onlyAdminACL(
796
+ this.updateProviderPrimarySalesPercentages.selector,
797
+ type(uint256).max
798
+ );
799
+
800
+ // Validate that the sum of the proposed %s, does not exceed 100%.
801
+ require(
802
+ (renderProviderPrimarySalesPercentage_ +
803
+ platformProviderPrimarySalesPercentage_) <= ONE_HUNDRED,
804
+ "Max sum of ONE_HUNDRED %"
805
+ );
806
+ // Casting to `uint8` here is safe due check above, which does not allow
807
+ // overflow as of solidity version ^0.8.0.
808
+ _renderProviderPrimarySalesPercentage = uint8(
809
+ renderProviderPrimarySalesPercentage_
810
+ );
811
+ _platformProviderPrimarySalesPercentage = uint8(
812
+ platformProviderPrimarySalesPercentage_
813
+ );
814
+ emit PlatformUpdated(FIELD_PROVIDER_PRIMARY_SALES_PERCENTAGES);
815
+ }
816
+
817
+ /**
818
+ * @notice Updates render and platform provider secondary sales royalty Basis Points to
819
+ * the provided inputs.
820
+ * @param _renderProviderSecondarySalesBPS New secondary sales royalty Basis
821
+ * points.
822
+ * @param _platformProviderSecondarySalesBPS New secondary sales royalty Basis
823
+ * points.
824
+ * @dev Due to secondary royalties being ultimately enforced via social
825
+ * consensus, no hard upper limit is imposed on the BPS value, other than
826
+ * <= 100% royalty, which would not make mathematical sense. Realistically,
827
+ * changing this value is expected to either never occur, or be a rare
828
+ * occurrence.
829
+ */
830
+ function updateProviderSecondarySalesBPS(
831
+ uint256 _renderProviderSecondarySalesBPS,
832
+ uint256 _platformProviderSecondarySalesBPS
833
+ ) external {
834
+ _onlyAdminACL(
835
+ this.updateProviderSecondarySalesBPS.selector,
836
+ type(uint256).max
837
+ );
838
+ // Validate that the sum of the proposed provider BPS, does not exceed 10_000 BPS.
839
+ require(
840
+ (_renderProviderSecondarySalesBPS +
841
+ _platformProviderSecondarySalesBPS) <=
842
+ MAX_PROVIDER_SECONDARY_SALES_BPS,
843
+ "Over max sum of BPS"
844
+ );
845
+ renderProviderSecondarySalesBPS = _renderProviderSecondarySalesBPS;
846
+ platformProviderSecondarySalesBPS = _platformProviderSecondarySalesBPS;
847
+ emit PlatformUpdated(FIELD_PROVIDER_SECONDARY_SALES_BPS);
848
+ }
849
+
850
+ /**
851
+ * @notice Updates minter to `_address`.
852
+ * @param _address Address of new minter.
853
+ */
854
+ function updateMinterContract(address _address) external {
855
+ _onlyAdminACL(this.updateMinterContract.selector, type(uint256).max);
856
+ _onlyNonZeroAddress(_address);
857
+ minterContract = _address;
858
+ emit MinterUpdated(_address);
859
+ }
860
+
861
+ /**
862
+ * @notice Updates randomizer to `_randomizerAddress`.
863
+ * @param _randomizerAddress Address of new randomizer.
864
+ */
865
+ function updateRandomizerAddress(address _randomizerAddress) external {
866
+ _onlyAdminACL(this.updateRandomizerAddress.selector, type(uint256).max);
867
+ _onlyNonZeroAddress(_randomizerAddress);
868
+ _updateRandomizerAddress(_randomizerAddress);
869
+ }
870
+
871
+ /**
872
+ * @notice Toggles project `_projectId` as active/inactive.
873
+ * @param _projectId Project ID to be toggled.
874
+ */
875
+ function toggleProjectIsActive(uint256 _projectId) external {
876
+ _onlyAdminACL(this.toggleProjectIsActive.selector, _projectId);
877
+ _onlyValidProjectId(_projectId);
878
+ projects[_projectId].active = !projects[_projectId].active;
879
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_ACTIVE);
880
+ }
881
+
882
+ /**
883
+ * @notice Artist proposes updated set of artist address, additional payee
884
+ * addresses, and percentage splits for project `_projectId`. Addresses and
885
+ * percentages do not have to all be changed, but they must all be defined
886
+ * as a complete set.
887
+ * Note that if the artist is only proposing a change to the payee percentage
888
+ * splits, without modifying the payee addresses, the proposal will be
889
+ * automatically approved and the new splits will become active immediately.
890
+ * Automatic approval will also be granted if the artist is only removing
891
+ * additional payee addresses, without adding any new ones.
892
+ * Also note that if `autoApproveArtistSplitProposals` is true, proposals
893
+ * will always be auto-approved, regardless of what is being changed.
894
+ * Also note that if the artist is proposing sending funds to the zero
895
+ * address, this function will revert and the proposal will not be created.
896
+ * @param _projectId Project ID.
897
+ * @param _artistAddress Artist address that controls the project, and may
898
+ * receive payments.
899
+ * @param _additionalPayeePrimarySales Address that may receive a
900
+ * percentage split of the artist's primary sales revenue.
901
+ * @param _additionalPayeePrimarySalesPercentage Percent of artist's
902
+ * portion of primary sale revenue that will be split to address
903
+ * `_additionalPayeePrimarySales`.
904
+ * @param _additionalPayeeSecondarySales Address that may receive a percentage
905
+ * split of the secondary sales royalties.
906
+ * @param _additionalPayeeSecondarySalesPercentage Percent of artist's portion
907
+ * of secondary sale royalties that will be split to address
908
+ * `_additionalPayeeSecondarySales`.
909
+ * @dev `_artistAddress` must be a valid address (non-zero-address), but it
910
+ * is intentionally allowable for `_additionalPayee{Primary,Secondaary}Sales`
911
+ * and their associated percentages to be zero'd out by the controlling artist.
912
+ */
913
+ function proposeArtistPaymentAddressesAndSplits(
914
+ uint256 _projectId,
915
+ address payable _artistAddress,
916
+ address payable _additionalPayeePrimarySales,
917
+ uint256 _additionalPayeePrimarySalesPercentage,
918
+ address payable _additionalPayeeSecondarySales,
919
+ uint256 _additionalPayeeSecondarySalesPercentage
920
+ ) external {
921
+ _onlyValidProjectId(_projectId);
922
+ _onlyArtist(_projectId);
923
+ _onlyNonZeroAddress(_artistAddress);
924
+ ProjectFinance storage projectFinance = projectIdToFinancials[
925
+ _projectId
926
+ ];
927
+ // checks
928
+ require(
929
+ _additionalPayeePrimarySalesPercentage <= ONE_HUNDRED &&
930
+ _additionalPayeeSecondarySalesPercentage <= ONE_HUNDRED,
931
+ "Max of 100%"
932
+ );
933
+ require(
934
+ _additionalPayeePrimarySalesPercentage == 0 ||
935
+ _additionalPayeePrimarySales != address(0),
936
+ "Primary payee is zero address"
937
+ );
938
+ require(
939
+ _additionalPayeeSecondarySalesPercentage == 0 ||
940
+ _additionalPayeeSecondarySales != address(0),
941
+ "Secondary payee is zero address"
942
+ );
943
+ // effects
944
+ // emit event for off-chain indexing
945
+ // note: always emit a proposal event, even in the pathway of
946
+ // automatic approval, to simplify indexing expectations
947
+ emit ProposedArtistAddressesAndSplits(
948
+ _projectId,
949
+ _artistAddress,
950
+ _additionalPayeePrimarySales,
951
+ _additionalPayeePrimarySalesPercentage,
952
+ _additionalPayeeSecondarySales,
953
+ _additionalPayeeSecondarySalesPercentage
954
+ );
955
+ // automatically accept if no proposed addresses modifications, or if
956
+ // the proposal only removes payee addresses, or if contract is set to
957
+ // always auto-approve.
958
+ // store proposal hash on-chain, only if not automatic accept
959
+ bool automaticAccept = autoApproveArtistSplitProposals;
960
+ if (!automaticAccept) {
961
+ // block scope to avoid stack too deep error
962
+ bool artistUnchanged = _artistAddress ==
963
+ projectFinance.artistAddress;
964
+ bool additionalPrimaryUnchangedOrRemoved = (_additionalPayeePrimarySales ==
965
+ projectFinance.additionalPayeePrimarySales) ||
966
+ (_additionalPayeePrimarySales == address(0));
967
+ bool additionalSecondaryUnchangedOrRemoved = (_additionalPayeeSecondarySales ==
968
+ projectFinance.additionalPayeeSecondarySales) ||
969
+ (_additionalPayeeSecondarySales == address(0));
970
+ automaticAccept =
971
+ artistUnchanged &&
972
+ additionalPrimaryUnchangedOrRemoved &&
973
+ additionalSecondaryUnchangedOrRemoved;
974
+ }
975
+ if (automaticAccept) {
976
+ // clear any previously proposed values
977
+ proposedArtistAddressesAndSplitsHash[_projectId] = bytes32(0);
978
+ // update storage
979
+ // artist address can change during automatic accept if
980
+ // autoApproveArtistSplitProposals is true
981
+ projectFinance.artistAddress = _artistAddress;
982
+ projectFinance
983
+ .additionalPayeePrimarySales = _additionalPayeePrimarySales;
984
+ // safe to cast as uint8 as max is 100%, max uint8 is 255
985
+ projectFinance.additionalPayeePrimarySalesPercentage = uint8(
986
+ _additionalPayeePrimarySalesPercentage
987
+ );
988
+ projectFinance
989
+ .additionalPayeeSecondarySales = _additionalPayeeSecondarySales;
990
+ // safe to cast as uint8 as max is 100%, max uint8 is 255
991
+ projectFinance.additionalPayeeSecondarySalesPercentage = uint8(
992
+ _additionalPayeeSecondarySalesPercentage
993
+ );
994
+ // emit event for off-chain indexing
995
+ emit AcceptedArtistAddressesAndSplits(_projectId);
996
+ } else {
997
+ proposedArtistAddressesAndSplitsHash[_projectId] = keccak256(
998
+ abi.encode(
999
+ _artistAddress,
1000
+ _additionalPayeePrimarySales,
1001
+ _additionalPayeePrimarySalesPercentage,
1002
+ _additionalPayeeSecondarySales,
1003
+ _additionalPayeeSecondarySalesPercentage
1004
+ )
1005
+ );
1006
+ }
1007
+ }
1008
+
1009
+ /**
1010
+ * @notice Admin accepts a proposed set of updated artist address,
1011
+ * additional payee addresses, and percentage splits for project
1012
+ * `_projectId`. Addresses and percentages do not have to all be changed,
1013
+ * but they must all be defined as a complete set.
1014
+ * @param _projectId Project ID.
1015
+ * @param _artistAddress Artist address that controls the project, and may
1016
+ * receive payments.
1017
+ * @param _additionalPayeePrimarySales Address that may receive a
1018
+ * percentage split of the artist's primary sales revenue.
1019
+ * @param _additionalPayeePrimarySalesPercentage Percent of artist's
1020
+ * portion of primary sale revenue that will be split to address
1021
+ * `_additionalPayeePrimarySales`.
1022
+ * @param _additionalPayeeSecondarySales Address that may receive a percentage
1023
+ * split of the secondary sales royalties.
1024
+ * @param _additionalPayeeSecondarySalesPercentage Percent of artist's portion
1025
+ * of secondary sale royalties that will be split to address
1026
+ * `_additionalPayeeSecondarySales`.
1027
+ * @dev this must be called by the Admin ACL contract, and must only accept
1028
+ * the most recent proposed values for a given project (validated on-chain
1029
+ * by comparing the hash of the proposed and accepted values).
1030
+ * @dev `_artistAddress` must be a valid address (non-zero-address), but it
1031
+ * is intentionally allowable for `_additionalPayee{Primary,Secondaary}Sales`
1032
+ * and their associated percentages to be zero'd out by the controlling artist.
1033
+ */
1034
+ function adminAcceptArtistAddressesAndSplits(
1035
+ uint256 _projectId,
1036
+ address payable _artistAddress,
1037
+ address payable _additionalPayeePrimarySales,
1038
+ uint256 _additionalPayeePrimarySalesPercentage,
1039
+ address payable _additionalPayeeSecondarySales,
1040
+ uint256 _additionalPayeeSecondarySalesPercentage
1041
+ ) external {
1042
+ _onlyValidProjectId(_projectId);
1043
+ _onlyAdminACLOrRenouncedArtist(
1044
+ _projectId,
1045
+ this.adminAcceptArtistAddressesAndSplits.selector
1046
+ );
1047
+ _onlyNonZeroAddress(_artistAddress);
1048
+ // checks
1049
+ require(
1050
+ proposedArtistAddressesAndSplitsHash[_projectId] ==
1051
+ keccak256(
1052
+ abi.encode(
1053
+ _artistAddress,
1054
+ _additionalPayeePrimarySales,
1055
+ _additionalPayeePrimarySalesPercentage,
1056
+ _additionalPayeeSecondarySales,
1057
+ _additionalPayeeSecondarySalesPercentage
1058
+ )
1059
+ ),
1060
+ "Must match artist proposal"
1061
+ );
1062
+ // effects
1063
+ ProjectFinance storage projectFinance = projectIdToFinancials[
1064
+ _projectId
1065
+ ];
1066
+ projectFinance.artistAddress = _artistAddress;
1067
+ projectFinance
1068
+ .additionalPayeePrimarySales = _additionalPayeePrimarySales;
1069
+ projectFinance.additionalPayeePrimarySalesPercentage = uint8(
1070
+ _additionalPayeePrimarySalesPercentage
1071
+ );
1072
+ projectFinance
1073
+ .additionalPayeeSecondarySales = _additionalPayeeSecondarySales;
1074
+ projectFinance.additionalPayeeSecondarySalesPercentage = uint8(
1075
+ _additionalPayeeSecondarySalesPercentage
1076
+ );
1077
+ // clear proposed values
1078
+ proposedArtistAddressesAndSplitsHash[_projectId] = bytes32(0);
1079
+ // emit event for off-chain indexing
1080
+ emit AcceptedArtistAddressesAndSplits(_projectId);
1081
+ }
1082
+
1083
+ /**
1084
+ * @notice Updates artist of project `_projectId` to `_artistAddress`.
1085
+ * This is to only be used in the event that the artist address is
1086
+ * compromised or sanctioned.
1087
+ * @param _projectId Project ID.
1088
+ * @param _artistAddress New artist address.
1089
+ */
1090
+ function updateProjectArtistAddress(
1091
+ uint256 _projectId,
1092
+ address payable _artistAddress
1093
+ ) external {
1094
+ _onlyValidProjectId(_projectId);
1095
+ _onlyAdminACLOrRenouncedArtist(
1096
+ _projectId,
1097
+ this.updateProjectArtistAddress.selector
1098
+ );
1099
+ _onlyNonZeroAddress(_artistAddress);
1100
+ projectIdToFinancials[_projectId].artistAddress = _artistAddress;
1101
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_ARTIST_ADDRESS);
1102
+ }
1103
+
1104
+ /**
1105
+ * @notice Toggles paused state of project `_projectId`.
1106
+ * @param _projectId Project ID to be toggled.
1107
+ */
1108
+ function toggleProjectIsPaused(uint256 _projectId) external {
1109
+ _onlyArtist(_projectId);
1110
+ projects[_projectId].paused = !projects[_projectId].paused;
1111
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_PAUSED);
1112
+ }
1113
+
1114
+ /**
1115
+ * @notice Adds new project `_projectName` by `_artistAddress`.
1116
+ * @param _projectName Project name.
1117
+ * @param _artistAddress Artist's address.
1118
+ * @dev token price now stored on minter
1119
+ */
1120
+ function addProject(
1121
+ string memory _projectName,
1122
+ address payable _artistAddress
1123
+ ) external {
1124
+ _onlyNonEmptyString(_projectName);
1125
+ _onlyNonZeroAddress(_artistAddress);
1126
+ require(!newProjectsForbidden, "New projects forbidden");
1127
+ uint256 projectId = _nextProjectId;
1128
+ projectIdToFinancials[projectId].artistAddress = _artistAddress;
1129
+ projects[projectId].name = _projectName;
1130
+ projects[projectId].paused = true;
1131
+ projects[projectId].maxInvocations = ONE_MILLION_UINT24;
1132
+ projects[projectId].projectBaseURI = defaultBaseURI;
1133
+
1134
+ _nextProjectId = uint248(projectId) + 1;
1135
+ emit ProjectUpdated(projectId, FIELD_PROJECT_CREATED);
1136
+ }
1137
+
1138
+ /**
1139
+ * @notice Forever forbids new projects from being added to this contract.
1140
+ */
1141
+ function forbidNewProjects() external {
1142
+ _onlyAdminACL(this.forbidNewProjects.selector, type(uint256).max);
1143
+ require(!newProjectsForbidden, "Already forbidden");
1144
+ _forbidNewProjects();
1145
+ }
1146
+
1147
+ /**
1148
+ * @notice Updates name of project `_projectId` to be `_projectName`.
1149
+ * @param _projectId Project ID.
1150
+ * @param _projectName New project name.
1151
+ */
1152
+ function updateProjectName(
1153
+ uint256 _projectId,
1154
+ string memory _projectName
1155
+ ) external {
1156
+ _onlyUnlocked(_projectId);
1157
+ _onlyArtistOrAdminACL(_projectId, this.updateProjectName.selector);
1158
+ _onlyNonEmptyString(_projectName);
1159
+ projects[_projectId].name = _projectName;
1160
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_NAME);
1161
+ }
1162
+
1163
+ /**
1164
+ * @notice Updates artist name for project `_projectId` to be
1165
+ * `_projectArtistName`.
1166
+ * @param _projectId Project ID.
1167
+ * @param _projectArtistName New artist name.
1168
+ */
1169
+ function updateProjectArtistName(
1170
+ uint256 _projectId,
1171
+ string memory _projectArtistName
1172
+ ) external {
1173
+ _onlyUnlocked(_projectId);
1174
+ _onlyArtistOrAdminACL(
1175
+ _projectId,
1176
+ this.updateProjectArtistName.selector
1177
+ );
1178
+ _onlyNonEmptyString(_projectArtistName);
1179
+ projects[_projectId].artist = _projectArtistName;
1180
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_ARTIST_NAME);
1181
+ }
1182
+
1183
+ /**
1184
+ * @notice Updates artist secondary market royalties for project
1185
+ * `_projectId` to be `_secondMarketRoyalty` percent.
1186
+ * This DOES NOT include the secondary market royalty percentages collected
1187
+ * by the issuing platform; it is only the total percentage of royalties
1188
+ * that will be split to artist and additionalSecondaryPayee.
1189
+ * @param _projectId Project ID.
1190
+ * @param _secondMarketRoyalty Percent of secondary sales revenue that will
1191
+ * be split to artist and additionalSecondaryPayee. This must be less than
1192
+ * or equal to ARTIST_MAX_SECONDARY_ROYALTY_PERCENTAGE percent.
1193
+ */
1194
+ function updateProjectSecondaryMarketRoyaltyPercentage(
1195
+ uint256 _projectId,
1196
+ uint256 _secondMarketRoyalty
1197
+ ) external {
1198
+ _onlyArtistOrAdminACL(
1199
+ _projectId,
1200
+ this.updateProjectSecondaryMarketRoyaltyPercentage.selector
1201
+ );
1202
+ require(
1203
+ _secondMarketRoyalty <= ARTIST_MAX_SECONDARY_ROYALTY_PERCENTAGE,
1204
+ "Over max percent"
1205
+ );
1206
+ projectIdToFinancials[_projectId]
1207
+ .secondaryMarketRoyaltyPercentage = uint8(_secondMarketRoyalty);
1208
+ emit ProjectUpdated(
1209
+ _projectId,
1210
+ FIELD_PROJECT_SECONDARY_MARKET_ROYALTY_PERCENTAGE
1211
+ );
1212
+ }
1213
+
1214
+ /**
1215
+ * @notice Updates description of project `_projectId`.
1216
+ * Only artist may call when unlocked, only admin may call when locked.
1217
+ * @param _projectId Project ID.
1218
+ * @param _projectDescription New project description.
1219
+ */
1220
+ function updateProjectDescription(
1221
+ uint256 _projectId,
1222
+ string memory _projectDescription
1223
+ ) external {
1224
+ // checks
1225
+ if (_projectUnlocked(_projectId)) {
1226
+ _onlyArtistOrAdminACL(
1227
+ _projectId,
1228
+ this.updateProjectDescription.selector
1229
+ );
1230
+ } else {
1231
+ require(
1232
+ adminACLAllowed(
1233
+ msg.sender,
1234
+ address(this),
1235
+ this.updateProjectDescription.selector,
1236
+ _projectId
1237
+ ),
1238
+ "Only artist when unlocked, owner when locked"
1239
+ );
1240
+ }
1241
+ // effects
1242
+ projects[_projectId].description = _projectDescription;
1243
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_DESCRIPTION);
1244
+ }
1245
+
1246
+ /**
1247
+ * @notice Updates website of project `_projectId` to be `_projectWebsite`.
1248
+ * @param _projectId Project ID.
1249
+ * @param _projectWebsite New project website.
1250
+ * @dev It is intentionally allowed for this to be set to the empty string.
1251
+ */
1252
+ function updateProjectWebsite(
1253
+ uint256 _projectId,
1254
+ string memory _projectWebsite
1255
+ ) external {
1256
+ _onlyArtistOrAdminACL(_projectId, this.updateProjectWebsite.selector);
1257
+ projects[_projectId].website = _projectWebsite;
1258
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_WEBSITE);
1259
+ }
1260
+
1261
+ /**
1262
+ * @notice Updates license for project `_projectId`.
1263
+ * @param _projectId Project ID.
1264
+ * @param _projectLicense New project license.
1265
+ */
1266
+ function updateProjectLicense(
1267
+ uint256 _projectId,
1268
+ string memory _projectLicense
1269
+ ) external {
1270
+ _onlyUnlocked(_projectId);
1271
+ _onlyArtistOrAdminACL(_projectId, this.updateProjectLicense.selector);
1272
+ _onlyNonEmptyString(_projectLicense);
1273
+ projects[_projectId].license = _projectLicense;
1274
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_LICENSE);
1275
+ }
1276
+
1277
+ /**
1278
+ * @notice Updates maximum invocations for project `_projectId` to
1279
+ * `_maxInvocations`. Maximum invocations may only be decreased by the
1280
+ * artist, and must be greater than or equal to current invocations.
1281
+ * New projects are created with maximum invocations of 1 million by
1282
+ * default.
1283
+ * @param _projectId Project ID.
1284
+ * @param _maxInvocations New maximum invocations.
1285
+ */
1286
+ function updateProjectMaxInvocations(
1287
+ uint256 _projectId,
1288
+ uint24 _maxInvocations
1289
+ ) external {
1290
+ _onlyArtistOrAdminACL(
1291
+ _projectId,
1292
+ this.updateProjectMaxInvocations.selector
1293
+ );
1294
+ // CHECKS
1295
+ Project storage project = projects[_projectId];
1296
+ uint256 _invocations = project.invocations;
1297
+ require(
1298
+ (_maxInvocations < project.maxInvocations),
1299
+ "Only maxInvocations decrease"
1300
+ );
1301
+ require(_maxInvocations >= _invocations, "Only gte invocations");
1302
+ // EFFECTS
1303
+ project.maxInvocations = _maxInvocations;
1304
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_MAX_INVOCATIONS);
1305
+
1306
+ // register completed timestamp if action completed the project
1307
+ if (_maxInvocations == _invocations) {
1308
+ _completeProject(_projectId);
1309
+ }
1310
+ }
1311
+
1312
+ /**
1313
+ * @notice Adds a script to project `_projectId`.
1314
+ * @param _projectId Project to be updated.
1315
+ * @param _script Script to be added. Required to be a non-empty string,
1316
+ * but no further validation is performed.
1317
+ */
1318
+ function addProjectScript(
1319
+ uint256 _projectId,
1320
+ string memory _script
1321
+ ) external {
1322
+ _onlyUnlocked(_projectId);
1323
+ _onlyArtistOrAdminACL(_projectId, this.addProjectScript.selector);
1324
+ _onlyNonEmptyString(_script);
1325
+ Project storage project = projects[_projectId];
1326
+ // store script in contract bytecode
1327
+ project.scriptBytecodeAddresses[project.scriptCount] = _script
1328
+ .writeToBytecode();
1329
+ project.scriptCount = project.scriptCount + 1;
1330
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_SCRIPT);
1331
+ }
1332
+
1333
+ /**
1334
+ * @notice Updates script for project `_projectId` at script ID `_scriptId`.
1335
+ * @param _projectId Project to be updated.
1336
+ * @param _scriptId Script ID to be updated.
1337
+ * @param _script The updated script value. Required to be a non-empty
1338
+ * string, but no further validation is performed.
1339
+ */
1340
+ function updateProjectScript(
1341
+ uint256 _projectId,
1342
+ uint256 _scriptId,
1343
+ string memory _script
1344
+ ) external {
1345
+ _onlyUnlocked(_projectId);
1346
+ _onlyArtistOrAdminACL(_projectId, this.updateProjectScript.selector);
1347
+ _onlyNonEmptyString(_script);
1348
+ Project storage project = projects[_projectId];
1349
+ require(_scriptId < project.scriptCount, "scriptId out of range");
1350
+
1351
+ // store script in contract bytecode, replacing reference address from
1352
+ // the contract that no longer exists with the newly created one
1353
+ project.scriptBytecodeAddresses[_scriptId] = _script.writeToBytecode();
1354
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_SCRIPT);
1355
+ }
1356
+
1357
+ /**
1358
+ * @notice Removes last script from project `_projectId`.
1359
+ * @param _projectId Project to be updated.
1360
+ */
1361
+ function removeProjectLastScript(uint256 _projectId) external {
1362
+ _onlyUnlocked(_projectId);
1363
+ _onlyArtistOrAdminACL(
1364
+ _projectId,
1365
+ this.removeProjectLastScript.selector
1366
+ );
1367
+ Project storage project = projects[_projectId];
1368
+ require(project.scriptCount > 0, "No scripts to remove");
1369
+
1370
+ // delete reference to contract address that no longer exists
1371
+ delete project.scriptBytecodeAddresses[project.scriptCount - 1];
1372
+ unchecked {
1373
+ project.scriptCount = project.scriptCount - 1;
1374
+ }
1375
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_SCRIPT);
1376
+ }
1377
+
1378
+ /**
1379
+ * @notice Updates script type for project `_projectId`.
1380
+ * @param _projectId Project to be updated.
1381
+ * @param _scriptTypeAndVersion Script type and version e.g. "p5js@1.0.0",
1382
+ * as bytes32 encoded string.
1383
+ */
1384
+ function updateProjectScriptType(
1385
+ uint256 _projectId,
1386
+ bytes32 _scriptTypeAndVersion
1387
+ ) external {
1388
+ _onlyUnlocked(_projectId);
1389
+ _onlyArtistOrAdminACL(
1390
+ _projectId,
1391
+ this.updateProjectScriptType.selector
1392
+ );
1393
+ Project storage project = projects[_projectId];
1394
+ // require exactly one @ symbol in _scriptTypeAndVersion
1395
+ require(
1396
+ _scriptTypeAndVersion.containsExactCharacterQty(
1397
+ AT_CHARACTER_CODE,
1398
+ uint8(1)
1399
+ ),
1400
+ "must contain exactly one @"
1401
+ );
1402
+ project.scriptTypeAndVersion = _scriptTypeAndVersion;
1403
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_SCRIPT_TYPE);
1404
+ }
1405
+
1406
+ /**
1407
+ * @notice Updates project's aspect ratio.
1408
+ * @param _projectId Project to be updated.
1409
+ * @param _aspectRatio Aspect ratio to be set. Intended to be string in the
1410
+ * format of a decimal, e.g. "1" for square, "1.77777778" for 16:9, etc.,
1411
+ * allowing for a maximum of 10 digits and one (optional) decimal separator.
1412
+ */
1413
+ function updateProjectAspectRatio(
1414
+ uint256 _projectId,
1415
+ string memory _aspectRatio
1416
+ ) external {
1417
+ _onlyUnlocked(_projectId);
1418
+ _onlyArtistOrAdminACL(
1419
+ _projectId,
1420
+ this.updateProjectAspectRatio.selector
1421
+ );
1422
+ _onlyNonEmptyString(_aspectRatio);
1423
+ // Perform more detailed input validation for aspect ratio.
1424
+ bytes memory aspectRatioBytes = bytes(_aspectRatio);
1425
+ uint256 bytesLength = aspectRatioBytes.length;
1426
+ require(bytesLength <= 11, "Aspect ratio format too long");
1427
+ bool hasSeenDecimalSeparator = false;
1428
+ bool hasSeenNumber = false;
1429
+ for (uint256 i; i < bytesLength; i++) {
1430
+ bytes1 character = aspectRatioBytes[i];
1431
+ // Allow as many #s as desired.
1432
+ if (character >= 0x30 && character <= 0x39) {
1433
+ // 9-0
1434
+ // We need to ensure there is at least 1 `9-0` occurrence.
1435
+ hasSeenNumber = true;
1436
+ continue;
1437
+ }
1438
+ if (character == 0x2E) {
1439
+ // .
1440
+ // Allow no more than 1 `.` occurrence.
1441
+ if (!hasSeenDecimalSeparator) {
1442
+ hasSeenDecimalSeparator = true;
1443
+ continue;
1444
+ }
1445
+ }
1446
+ revert("Improperly formatted aspect ratio");
1447
+ }
1448
+ require(hasSeenNumber, "Aspect ratio has no numbers");
1449
+
1450
+ projects[_projectId].aspectRatio = _aspectRatio;
1451
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_ASPECT_RATIO);
1452
+ }
1453
+
1454
+ /**
1455
+ * @notice Updates base URI for project `_projectId` to `_newBaseURI`.
1456
+ * This is the controlling base URI for all tokens in the project. The
1457
+ * contract-level defaultBaseURI is only used when initializing new
1458
+ * projects.
1459
+ * @param _projectId Project to be updated.
1460
+ * @param _newBaseURI New base URI.
1461
+ */
1462
+ function updateProjectBaseURI(
1463
+ uint256 _projectId,
1464
+ string memory _newBaseURI
1465
+ ) external {
1466
+ _onlyArtistOrAdminACL(_projectId, this.updateProjectBaseURI.selector);
1467
+ _onlyNonEmptyString(_newBaseURI);
1468
+ projects[_projectId].projectBaseURI = _newBaseURI;
1469
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_BASE_URI);
1470
+ }
1471
+
1472
+ /**
1473
+ * @notice Updates default base URI to `_defaultBaseURI`. The
1474
+ * contract-level defaultBaseURI is only used when initializing new
1475
+ * projects. Token URIs are determined by their project's `projectBaseURI`.
1476
+ * @param _defaultBaseURI New default base URI.
1477
+ */
1478
+ function updateDefaultBaseURI(string memory _defaultBaseURI) external {
1479
+ _onlyAdminACL(this.updateDefaultBaseURI.selector, type(uint256).max);
1480
+ _onlyNonEmptyString(_defaultBaseURI);
1481
+ _updateDefaultBaseURI(_defaultBaseURI);
1482
+ }
1483
+
1484
+ /**
1485
+ * @notice Next project ID to be created on this contract.
1486
+ * @return uint256 Next project ID.
1487
+ */
1488
+ function nextProjectId() external view returns (uint256) {
1489
+ return _nextProjectId;
1490
+ }
1491
+
1492
+ /**
1493
+ * @notice Returns token hash for token ID `_tokenId`. Returns null if hash
1494
+ * has not been set.
1495
+ * @param _tokenId Token ID to be queried.
1496
+ * @return bytes32 Token hash.
1497
+ * @dev token hash is the keccak256 hash of the stored hash seed
1498
+ */
1499
+ function tokenIdToHash(uint256 _tokenId) external view returns (bytes32) {
1500
+ bytes12 _hashSeed = _ownersAndHashSeeds[_tokenId].hashSeed;
1501
+ if (_hashSeed == 0) {
1502
+ return 0;
1503
+ }
1504
+ return keccak256(abi.encode(_hashSeed));
1505
+ }
1506
+
1507
+ /**
1508
+ * @notice Returns token hash **seed** for token ID `_tokenId`. Returns
1509
+ * null if hash seed has not been set. The hash seed id the bytes12 value
1510
+ * which is hashed to produce the token hash.
1511
+ * @param _tokenId Token ID to be queried.
1512
+ * @return bytes12 Token hash seed.
1513
+ * @dev token hash seed is keccak256 hashed to give the token hash
1514
+ */
1515
+ function tokenIdToHashSeed(
1516
+ uint256 _tokenId
1517
+ ) external view returns (bytes12) {
1518
+ return _ownersAndHashSeeds[_tokenId].hashSeed;
1519
+ }
1520
+
1521
+ /**
1522
+ * @notice View function returning the render provider portion of
1523
+ * primary sales, in percent.
1524
+ * @return uint256 The render provider portion of primary sales,
1525
+ * in percent.
1526
+ */
1527
+ function renderProviderPrimarySalesPercentage()
1528
+ external
1529
+ view
1530
+ returns (uint256)
1531
+ {
1532
+ return _renderProviderPrimarySalesPercentage;
1533
+ }
1534
+
1535
+ /**
1536
+ * @notice View function returning the platform provider portion of
1537
+ * primary sales, in percent.
1538
+ * @return uint256 The platform provider portion of primary sales,
1539
+ * in percent.
1540
+ */
1541
+ function platformProviderPrimarySalesPercentage()
1542
+ external
1543
+ view
1544
+ returns (uint256)
1545
+ {
1546
+ return _platformProviderPrimarySalesPercentage;
1547
+ }
1548
+
1549
+ /**
1550
+ * @notice View function returning Artist's address for project
1551
+ * `_projectId`.
1552
+ * @param _projectId Project ID to be queried.
1553
+ * @return address Artist's address.
1554
+ */
1555
+ function projectIdToArtistAddress(
1556
+ uint256 _projectId
1557
+ ) external view returns (address payable) {
1558
+ return projectIdToFinancials[_projectId].artistAddress;
1559
+ }
1560
+
1561
+ /**
1562
+ * @notice View function returning Artist's secondary market royalty
1563
+ * percentage for project `_projectId`.
1564
+ * This does not include render/platform providers portions of secondary
1565
+ * market royalties.
1566
+ * @param _projectId Project ID to be queried.
1567
+ * @return uint256 Artist's secondary market royalty percentage.
1568
+ */
1569
+ function projectIdToSecondaryMarketRoyaltyPercentage(
1570
+ uint256 _projectId
1571
+ ) external view returns (uint256) {
1572
+ return
1573
+ projectIdToFinancials[_projectId].secondaryMarketRoyaltyPercentage;
1574
+ }
1575
+
1576
+ /**
1577
+ * @notice View function returning Artist's additional payee address for
1578
+ * primary sales, for project `_projectId`.
1579
+ * @param _projectId Project ID to be queried.
1580
+ * @return address Artist's additional payee address for primary sales.
1581
+ */
1582
+ function projectIdToAdditionalPayeePrimarySales(
1583
+ uint256 _projectId
1584
+ ) external view returns (address payable) {
1585
+ return projectIdToFinancials[_projectId].additionalPayeePrimarySales;
1586
+ }
1587
+
1588
+ /**
1589
+ * @notice View function returning Artist's additional payee primary sales
1590
+ * percentage, for project `_projectId`.
1591
+ * @param _projectId Project ID to be queried.
1592
+ * @return uint256 Artist's additional payee primary sales percentage.
1593
+ */
1594
+ function projectIdToAdditionalPayeePrimarySalesPercentage(
1595
+ uint256 _projectId
1596
+ ) external view returns (uint256) {
1597
+ return
1598
+ projectIdToFinancials[_projectId]
1599
+ .additionalPayeePrimarySalesPercentage;
1600
+ }
1601
+
1602
+ /**
1603
+ * @notice View function returning Artist's additional payee address for
1604
+ * secondary sales, for project `_projectId`.
1605
+ * @param _projectId Project ID to be queried.
1606
+ * @return address payable Artist's additional payee address for secondary
1607
+ * sales.
1608
+ */
1609
+ function projectIdToAdditionalPayeeSecondarySales(
1610
+ uint256 _projectId
1611
+ ) external view returns (address payable) {
1612
+ return projectIdToFinancials[_projectId].additionalPayeeSecondarySales;
1613
+ }
1614
+
1615
+ /**
1616
+ * @notice View function returning Artist's additional payee secondary
1617
+ * sales percentage, for project `_projectId`.
1618
+ * @param _projectId Project ID to be queried.
1619
+ * @return uint256 Artist's additional payee secondary sales percentage.
1620
+ */
1621
+ function projectIdToAdditionalPayeeSecondarySalesPercentage(
1622
+ uint256 _projectId
1623
+ ) external view returns (uint256) {
1624
+ return
1625
+ projectIdToFinancials[_projectId]
1626
+ .additionalPayeeSecondarySalesPercentage;
1627
+ }
1628
+
1629
+ /**
1630
+ * @notice Returns project details for project `_projectId`.
1631
+ * @param _projectId Project to be queried.
1632
+ * @return projectName Name of project
1633
+ * @return artist Artist of project
1634
+ * @return description Project description
1635
+ * @return website Project website
1636
+ * @return license Project license
1637
+ * @dev this function was named projectDetails prior to V3 core contract.
1638
+ */
1639
+ function projectDetails(
1640
+ uint256 _projectId
1641
+ )
1642
+ external
1643
+ view
1644
+ returns (
1645
+ string memory projectName,
1646
+ string memory artist,
1647
+ string memory description,
1648
+ string memory website,
1649
+ string memory license
1650
+ )
1651
+ {
1652
+ Project storage project = projects[_projectId];
1653
+ projectName = project.name;
1654
+ artist = project.artist;
1655
+ description = project.description;
1656
+ website = project.website;
1657
+ license = project.license;
1658
+ }
1659
+
1660
+ /**
1661
+ * @notice Returns project state data for project `_projectId`.
1662
+ * @param _projectId Project to be queried
1663
+ * @return invocations Current number of invocations
1664
+ * @return maxInvocations Maximum allowed invocations
1665
+ * @return active Boolean representing if project is currently active
1666
+ * @return paused Boolean representing if project is paused
1667
+ * @return completedTimestamp zero if project not complete, otherwise
1668
+ * timestamp of project completion.
1669
+ * @return locked Boolean representing if project is locked
1670
+ * @dev price and currency info are located on minter contracts
1671
+ */
1672
+ function projectStateData(
1673
+ uint256 _projectId
1674
+ )
1675
+ external
1676
+ view
1677
+ returns (
1678
+ uint256 invocations,
1679
+ uint256 maxInvocations,
1680
+ bool active,
1681
+ bool paused,
1682
+ uint256 completedTimestamp,
1683
+ bool locked
1684
+ )
1685
+ {
1686
+ Project storage project = projects[_projectId];
1687
+ invocations = project.invocations;
1688
+ maxInvocations = project.maxInvocations;
1689
+ active = project.active;
1690
+ paused = project.paused;
1691
+ completedTimestamp = project.completedTimestamp;
1692
+ locked = !_projectUnlocked(_projectId);
1693
+ }
1694
+
1695
+ /**
1696
+ * @notice Returns artist payment information for project `_projectId`.
1697
+ * @param _projectId Project to be queried
1698
+ * @return artistAddress Project Artist's address
1699
+ * @return additionalPayeePrimarySales Additional payee address for primary
1700
+ * sales
1701
+ * @return additionalPayeePrimarySalesPercentage Percentage of artist revenue
1702
+ * to be sent to the additional payee address for primary sales
1703
+ * @return additionalPayeeSecondarySales Additional payee address for secondary
1704
+ * sales royalties
1705
+ * @return additionalPayeeSecondarySalesPercentage Percentage of artist revenue
1706
+ * to be sent to the additional payee address for secondary sales royalties
1707
+ * @return secondaryMarketRoyaltyPercentage Royalty percentage to be sent to
1708
+ * combination of artist and additional payee. This does not include the
1709
+ * platform's percentage of secondary sales royalties, which is defined as
1710
+ * the sum of `renderProviderSecondarySalesBPS`
1711
+ * and `platformProviderSecondarySalesBPS`.
1712
+ */
1713
+ function projectArtistPaymentInfo(
1714
+ uint256 _projectId
1715
+ )
1716
+ external
1717
+ view
1718
+ returns (
1719
+ address artistAddress,
1720
+ address additionalPayeePrimarySales,
1721
+ uint256 additionalPayeePrimarySalesPercentage,
1722
+ address additionalPayeeSecondarySales,
1723
+ uint256 additionalPayeeSecondarySalesPercentage,
1724
+ uint256 secondaryMarketRoyaltyPercentage
1725
+ )
1726
+ {
1727
+ ProjectFinance storage projectFinance = projectIdToFinancials[
1728
+ _projectId
1729
+ ];
1730
+ artistAddress = projectFinance.artistAddress;
1731
+ additionalPayeePrimarySales = projectFinance
1732
+ .additionalPayeePrimarySales;
1733
+ additionalPayeePrimarySalesPercentage = projectFinance
1734
+ .additionalPayeePrimarySalesPercentage;
1735
+ additionalPayeeSecondarySales = projectFinance
1736
+ .additionalPayeeSecondarySales;
1737
+ additionalPayeeSecondarySalesPercentage = projectFinance
1738
+ .additionalPayeeSecondarySalesPercentage;
1739
+ secondaryMarketRoyaltyPercentage = projectFinance
1740
+ .secondaryMarketRoyaltyPercentage;
1741
+ }
1742
+
1743
+ /**
1744
+ * @notice Returns script information for project `_projectId`.
1745
+ * @param _projectId Project to be queried.
1746
+ * @return scriptTypeAndVersion Project's script type and version
1747
+ * (e.g. "p5js(atSymbol)1.0.0")
1748
+ * @return aspectRatio Aspect ratio of project (e.g. "1" for square,
1749
+ * "1.77777778" for 16:9, etc.)
1750
+ * @return scriptCount Count of scripts for project
1751
+ */
1752
+ function projectScriptDetails(
1753
+ uint256 _projectId
1754
+ )
1755
+ external
1756
+ view
1757
+ override(IGenArt721CoreContractV3_Base, IDependencyRegistryCompatibleV0)
1758
+ returns (
1759
+ string memory scriptTypeAndVersion,
1760
+ string memory aspectRatio,
1761
+ uint256 scriptCount
1762
+ )
1763
+ {
1764
+ Project storage project = projects[_projectId];
1765
+ scriptTypeAndVersion = project.scriptTypeAndVersion.toString();
1766
+ aspectRatio = project.aspectRatio;
1767
+ scriptCount = project.scriptCount;
1768
+ }
1769
+
1770
+ /**
1771
+ * @notice Returns address with bytecode containing project script for
1772
+ * project `_projectId` at script index `_index`.
1773
+ */
1774
+ function projectScriptBytecodeAddressByIndex(
1775
+ uint256 _projectId,
1776
+ uint256 _index
1777
+ ) external view returns (address) {
1778
+ return projects[_projectId].scriptBytecodeAddresses[_index];
1779
+ }
1780
+
1781
+ /**
1782
+ * @notice Returns script for project `_projectId` at script index `_index`.
1783
+ * @param _projectId Project to be queried.
1784
+ * @param _index Index of script to be queried.
1785
+ */
1786
+ function projectScriptByIndex(
1787
+ uint256 _projectId,
1788
+ uint256 _index
1789
+ ) external view returns (string memory) {
1790
+ Project storage project = projects[_projectId];
1791
+ // If trying to access an out-of-index script, return the empty string.
1792
+ if (_index >= project.scriptCount) {
1793
+ return "";
1794
+ }
1795
+ return _readFromBytecode(project.scriptBytecodeAddresses[_index]);
1796
+ }
1797
+
1798
+ /**
1799
+ * @notice Returns base URI for project `_projectId`.
1800
+ * @param _projectId Project to be queried.
1801
+ * @return projectBaseURI Base URI for project
1802
+ */
1803
+ function projectURIInfo(
1804
+ uint256 _projectId
1805
+ ) external view returns (string memory projectBaseURI) {
1806
+ projectBaseURI = projects[_projectId].projectBaseURI;
1807
+ }
1808
+
1809
+ /**
1810
+ * @notice Backwards-compatible (pre-V3) function returning if `_minter` is
1811
+ * minterContract.
1812
+ * @param _minter Address to be queried.
1813
+ * @return bool Boolean representing if `_minter` is minterContract.
1814
+ */
1815
+ function isMintWhitelisted(address _minter) external view returns (bool) {
1816
+ return (minterContract == _minter);
1817
+ }
1818
+
1819
+ /**
1820
+ * @notice Gets qty of randomizers in history of all randomizers used by
1821
+ * this core contract. If a randomizer is switched away from then back to,
1822
+ * it will show up in the history twice.
1823
+ * @return randomizerHistoryCount Count of randomizers in history
1824
+ */
1825
+ function numHistoricalRandomizers() external view returns (uint256) {
1826
+ return _historicalRandomizerAddresses.length;
1827
+ }
1828
+
1829
+ /**
1830
+ * @notice Gets address of randomizer at index `_index` in history of all
1831
+ * randomizers used by this core contract. Index is zero-based.
1832
+ * @param _index Historical index of randomizer to be queried.
1833
+ * @return randomizerAddress Address of randomizer at index `_index`.
1834
+ * @dev If a randomizer is switched away from and then switched back to, it
1835
+ * will show up in the history twice.
1836
+ */
1837
+ function getHistoricalRandomizerAt(
1838
+ uint256 _index
1839
+ ) external view returns (address) {
1840
+ require(
1841
+ _index < _historicalRandomizerAddresses.length,
1842
+ "Index out of bounds"
1843
+ );
1844
+ return _historicalRandomizerAddresses[_index];
1845
+ }
1846
+
1847
+ /**
1848
+ * @notice Gets royalty Basis Points (BPS) for token ID `_tokenId`.
1849
+ * This conforms to the IManifold interface designated in the Royalty
1850
+ * Registry's RoyaltyEngineV1.sol contract.
1851
+ * ref: https://github.com/manifoldxyz/royalty-registry-solidity
1852
+ * @param _tokenId Token ID to be queried.
1853
+ * @return recipients Array of royalty payment recipients
1854
+ * @return bps Array of Basis Points (BPS) allocated to each recipient,
1855
+ * aligned by index.
1856
+ * @dev reverts if invalid _tokenId
1857
+ * @dev only returns recipients that have a non-zero BPS allocation
1858
+ */
1859
+ function getRoyalties(
1860
+ uint256 _tokenId
1861
+ )
1862
+ external
1863
+ view
1864
+ returns (address payable[] memory recipients, uint256[] memory bps)
1865
+ {
1866
+ _onlyValidTokenId(_tokenId);
1867
+ // initialize arrays with maximum potential length
1868
+ recipients = new address payable[](4);
1869
+ bps = new uint256[](4);
1870
+
1871
+ uint256 projectId = tokenIdToProjectId(_tokenId);
1872
+ ProjectFinance storage projectFinance = projectIdToFinancials[
1873
+ projectId
1874
+ ];
1875
+ // load values into memory
1876
+ uint256 royaltyPercentageForArtistAndAdditional = projectFinance
1877
+ .secondaryMarketRoyaltyPercentage;
1878
+ uint256 additionalPayeePercentage = projectFinance
1879
+ .additionalPayeeSecondarySalesPercentage;
1880
+ // calculate BPS = percentage * 100
1881
+ uint256 artistBPS = (ONE_HUNDRED - additionalPayeePercentage) *
1882
+ royaltyPercentageForArtistAndAdditional;
1883
+
1884
+ uint256 additionalBPS = additionalPayeePercentage *
1885
+ royaltyPercentageForArtistAndAdditional;
1886
+ uint256 renderProviderBPS = renderProviderSecondarySalesBPS;
1887
+ uint256 platformProviderBPS = platformProviderSecondarySalesBPS;
1888
+ // populate arrays
1889
+ uint256 payeeCount;
1890
+ if (artistBPS > 0) {
1891
+ recipients[payeeCount] = projectFinance.artistAddress;
1892
+ bps[payeeCount++] = artistBPS;
1893
+ }
1894
+ if (additionalBPS > 0) {
1895
+ recipients[payeeCount] = projectFinance
1896
+ .additionalPayeeSecondarySales;
1897
+ bps[payeeCount++] = additionalBPS;
1898
+ }
1899
+ if (renderProviderBPS > 0) {
1900
+ recipients[payeeCount] = renderProviderSecondarySalesAddress;
1901
+ bps[payeeCount++] = renderProviderBPS;
1902
+ }
1903
+ if (platformProviderBPS > 0) {
1904
+ recipients[payeeCount] = platformProviderSecondarySalesAddress;
1905
+ bps[payeeCount++] = platformProviderBPS;
1906
+ }
1907
+ // trim arrays if necessary
1908
+ if (4 > payeeCount) {
1909
+ assembly {
1910
+ let decrease := sub(4, payeeCount)
1911
+ mstore(recipients, sub(mload(recipients), decrease))
1912
+ mstore(bps, sub(mload(bps), decrease))
1913
+ }
1914
+ }
1915
+ return (recipients, bps);
1916
+ }
1917
+
1918
+ /**
1919
+ * @notice View function that returns appropriate revenue splits between
1920
+ * different render provider, platform provider, Artist, and Artist's
1921
+ * additional primary sales payee given a sale price of `_price` on
1922
+ * project `_projectId`.
1923
+ * This always returns four revenue amounts and four addresses, but if a
1924
+ * revenue is zero for either Artist or additional payee, the corresponding
1925
+ * address returned will also be null (for gas optimization).
1926
+ * Does not account for refund if user overpays for a token (minter should
1927
+ * handle a refund of the difference, if appropriate).
1928
+ * Some minters may have alternative methods of splitting payments, in
1929
+ * which case they should implement their own payment splitting logic.
1930
+ * @param _projectId Project ID to be queried.
1931
+ * @param _price Sale price of token.
1932
+ * @return renderProviderRevenue_ amount of revenue to be sent to the
1933
+ * render provider
1934
+ * @return renderProviderAddress_ address to send render provider revenue to
1935
+ * @return platformProviderRevenue_ amount of revenue to be sent to the
1936
+ * platform provider
1937
+ * @return platformProviderAddress_ address to send platform provider revenue to
1938
+ * @return artistRevenue_ amount of revenue to be sent to Artist
1939
+ * @return artistAddress_ address to send Artist revenue to. Will be null
1940
+ * if no revenue is due to artist (gas optimization).
1941
+ * @return additionalPayeePrimaryRevenue_ amount of revenue to be sent to
1942
+ * additional payee for primary sales
1943
+ * @return additionalPayeePrimaryAddress_ address to send Artist's
1944
+ * additional payee for primary sales revenue to. Will be null if no
1945
+ * revenue is due to additional payee for primary sales (gas optimization).
1946
+ * @dev this always returns four addresses and four revenues, but if the
1947
+ * revenue is zero, the corresponding address will be address(0). It is up
1948
+ * to the contract performing the revenue split to handle this
1949
+ * appropriately.
1950
+ */
1951
+ function getPrimaryRevenueSplits(
1952
+ uint256 _projectId,
1953
+ uint256 _price
1954
+ )
1955
+ external
1956
+ view
1957
+ returns (
1958
+ uint256 renderProviderRevenue_,
1959
+ address payable renderProviderAddress_,
1960
+ uint256 platformProviderRevenue_,
1961
+ address payable platformProviderAddress_,
1962
+ uint256 artistRevenue_,
1963
+ address payable artistAddress_,
1964
+ uint256 additionalPayeePrimaryRevenue_,
1965
+ address payable additionalPayeePrimaryAddress_
1966
+ )
1967
+ {
1968
+ ProjectFinance storage projectFinance = projectIdToFinancials[
1969
+ _projectId
1970
+ ];
1971
+ // calculate revenues – this is a three-way split between the
1972
+ // render provider, the platform provider, and the artist, and
1973
+ // is safe to perform this given that in the case of loss of
1974
+ // precision Solidity will round down.
1975
+ uint256 projectFunds = _price;
1976
+ renderProviderRevenue_ =
1977
+ (_price * uint256(_renderProviderPrimarySalesPercentage)) /
1978
+ ONE_HUNDRED;
1979
+ // renderProviderRevenue_ percentage is always <=100, so guaranteed to never underflow
1980
+ projectFunds -= renderProviderRevenue_;
1981
+ platformProviderRevenue_ =
1982
+ (_price * uint256(_platformProviderPrimarySalesPercentage)) /
1983
+ ONE_HUNDRED;
1984
+ // platformProviderRevenue_ percentage is always <=100, so guaranteed to never underflow
1985
+ projectFunds -= platformProviderRevenue_;
1986
+ additionalPayeePrimaryRevenue_ =
1987
+ (projectFunds *
1988
+ projectFinance.additionalPayeePrimarySalesPercentage) /
1989
+ ONE_HUNDRED;
1990
+ // projectIdToAdditionalPayeePrimarySalesPercentage is always
1991
+ // <=100, so guaranteed to never underflow
1992
+ artistRevenue_ = projectFunds - additionalPayeePrimaryRevenue_;
1993
+ // set addresses from storage
1994
+ renderProviderAddress_ = renderProviderPrimarySalesAddress;
1995
+ platformProviderAddress_ = platformProviderPrimarySalesAddress;
1996
+ if (artistRevenue_ > 0) {
1997
+ artistAddress_ = projectFinance.artistAddress;
1998
+ }
1999
+ if (additionalPayeePrimaryRevenue_ > 0) {
2000
+ additionalPayeePrimaryAddress_ = projectFinance
2001
+ .additionalPayeePrimarySales;
2002
+ }
2003
+ }
2004
+
2005
+ /**
2006
+ * @notice Returns external asset dependency for project `_projectId` at index `_index`.
2007
+ * If the dependencyType is ONCHAIN, the `data` field will contain the extrated bytecode data and `cid`
2008
+ * will be an empty string. Conversly, for any other dependencyType, the `data` field will be an empty string
2009
+ * and the `bytecodeAddress` will point to the zero address.
2010
+ */
2011
+ function projectExternalAssetDependencyByIndex(
2012
+ uint256 _projectId,
2013
+ uint256 _index
2014
+ ) external view returns (ExternalAssetDependencyWithData memory) {
2015
+ ExternalAssetDependency storage _dependency = projects[_projectId]
2016
+ .externalAssetDependencies[_index];
2017
+ address _bytecodeAddress = _dependency.bytecodeAddress;
2018
+
2019
+ return
2020
+ ExternalAssetDependencyWithData({
2021
+ dependencyType: _dependency.dependencyType,
2022
+ cid: _dependency.cid,
2023
+ bytecodeAddress: _bytecodeAddress,
2024
+ data: (_dependency.dependencyType ==
2025
+ ExternalAssetDependencyType.ONCHAIN)
2026
+ ? _readFromBytecode(_bytecodeAddress)
2027
+ : ""
2028
+ });
2029
+ }
2030
+
2031
+ /**
2032
+ * @notice Returns external asset dependency count for project `_projectId` at index `_index`.
2033
+ */
2034
+ function projectExternalAssetDependencyCount(
2035
+ uint256 _projectId
2036
+ ) external view returns (uint256) {
2037
+ return uint256(projects[_projectId].externalAssetDependencyCount);
2038
+ }
2039
+
2040
+ /**
2041
+ * @notice Backwards-compatible (pre-V3) getter returning contract admin
2042
+ * @return address Address of contract admin (same as owner)
2043
+ */
2044
+ function admin() external view returns (address) {
2045
+ return owner();
2046
+ }
2047
+
2048
+ /**
2049
+ * @notice Gets the project ID for a given `_tokenId`.
2050
+ * @param _tokenId Token ID to be queried.
2051
+ * @return _projectId Project ID for given `_tokenId`.
2052
+ */
2053
+ function tokenIdToProjectId(
2054
+ uint256 _tokenId
2055
+ ) public pure returns (uint256 _projectId) {
2056
+ return _tokenId / ONE_MILLION;
2057
+ }
2058
+
2059
+ /**
2060
+ * @notice Convenience function that returns whether `_sender` is allowed
2061
+ * to call function with selector `_selector` on contract `_contract`, as
2062
+ * determined by this contract's current Admin ACL contract. Expected use
2063
+ * cases include minter contracts checking if caller is allowed to call
2064
+ * admin-gated functions on minter contracts.
2065
+ * @param _sender Address of the sender calling function with selector
2066
+ * `_selector` on contract `_contract`.
2067
+ * @param _contract Address of the contract being called by `_sender`.
2068
+ * @param _selector Function selector of the function being called by
2069
+ * `_sender`.
2070
+ * @param _projectId Project ID of the project being acted on by `_sender`.
2071
+ * @return bool Whether `_sender` is allowed to call function with selector
2072
+ * `_selector` on contract `_contract`.
2073
+ * @dev assumes the Admin ACL contract is the owner of this contract, which
2074
+ * is expected to always be true.
2075
+ * @dev adminACLContract is expected to either be null address (if owner
2076
+ * has renounced ownership), or conform to IAdminACLV0 interface. Check for
2077
+ * null address first to avoid revert when admin has renounced ownership.
2078
+ */
2079
+ function adminACLAllowed(
2080
+ address _sender,
2081
+ address _contract,
2082
+ bytes4 _selector,
2083
+ uint256 _projectId
2084
+ ) public returns (bool) {
2085
+ return
2086
+ owner() != address(0) &&
2087
+ IAdminACLV0_PROHIBITION(address(adminACLContract)).allowed(
2088
+ _sender,
2089
+ _contract,
2090
+ _selector,
2091
+ _projectId
2092
+ );
2093
+ }
2094
+
2095
+ /**
2096
+ * @notice Convenience function that returns whether `_sender` is allowed
2097
+ * to call function with selector `_selector` on contract `_contract`, as
2098
+ * determined by this contract's current Admin ACL contract. Expected use
2099
+ * cases include minter contracts checking if caller is allowed to call
2100
+ * admin-gated functions on minter contracts.
2101
+ * @param _sender Address of the sender calling function with selector
2102
+ * `_selector` on contract `_contract`.
2103
+ * @param _contract Address of the contract being called by `_sender`.
2104
+ * @param _selector Function selector of the function being called by
2105
+ * `_sender`.
2106
+ * @return bool Whether `_sender` is allowed to call function with selector
2107
+ * `_selector` on contract `_contract`.
2108
+ * @dev assumes the Admin ACL contract is the owner of this contract, which
2109
+ * is expected to always be true.
2110
+ * @dev adminACLContract is expected to either be null address (if owner
2111
+ * has renounced ownership), or conform to IAdminACLV0 interface. Check for
2112
+ * null address first to avoid revert when admin has renounced ownership.
2113
+ */
2114
+ function adminACLAllowed(
2115
+ address _sender,
2116
+ address _contract,
2117
+ bytes4 _selector
2118
+ ) public returns (bool) {
2119
+ return
2120
+ owner() != address(0) &&
2121
+ IAdminACLV0_PROHIBITION(address(adminACLContract)).allowed(
2122
+ _sender,
2123
+ _contract,
2124
+ _selector,
2125
+ type(uint256).max
2126
+ );
2127
+ }
2128
+
2129
+ /**
2130
+ * @notice Returns contract owner. Set to deployer's address by default on
2131
+ * contract deployment.
2132
+ * @return address Address of contract owner.
2133
+ * @dev ref: https://docs.openzeppelin.com/contracts/4.x/api/access#Ownable
2134
+ * @dev owner role was called `admin` prior to V3 core contract
2135
+ */
2136
+ function owner()
2137
+ public
2138
+ view
2139
+ override(Ownable, IGenArt721CoreContractV3_Base)
2140
+ returns (address)
2141
+ {
2142
+ return Ownable.owner();
2143
+ }
2144
+
2145
+ /**
2146
+ * @notice Gets token URI for token ID `_tokenId`.
2147
+ * @param _tokenId Token ID to be queried.
2148
+ * @return string URI of token ID `_tokenId`.
2149
+ * @dev token URIs are the concatenation of the project base URI and the
2150
+ * token ID.
2151
+ */
2152
+ function tokenURI(
2153
+ uint256 _tokenId
2154
+ ) public view override returns (string memory) {
2155
+ _onlyValidTokenId(_tokenId);
2156
+ string memory _projectBaseURI = projects[tokenIdToProjectId(_tokenId)]
2157
+ .projectBaseURI;
2158
+ return string.concat(_projectBaseURI, toString(_tokenId));
2159
+ }
2160
+
2161
+ /**
2162
+ * @dev See {IERC165-supportsInterface}.
2163
+ */
2164
+ function supportsInterface(
2165
+ bytes4 interfaceId
2166
+ ) public view virtual override returns (bool) {
2167
+ return
2168
+ interfaceId == type(IManifold).interfaceId ||
2169
+ super.supportsInterface(interfaceId);
2170
+ }
2171
+
2172
+ /**
2173
+ * @notice Forbids new projects from being created
2174
+ * @dev only performs operation and emits event if contract is not already
2175
+ * forbidding new projects.
2176
+ */
2177
+ function _forbidNewProjects() internal {
2178
+ if (!newProjectsForbidden) {
2179
+ newProjectsForbidden = true;
2180
+ emit PlatformUpdated(FIELD_NEW_PROJECTS_FORBIDDEN);
2181
+ }
2182
+ }
2183
+
2184
+ /**
2185
+ * @notice Transfers ownership of the contract to a new account (`newOwner`).
2186
+ * Internal function without access restriction.
2187
+ * @param newOwner New owner.
2188
+ * @dev owner role was called `admin` prior to V3 core contract.
2189
+ * @dev Overrides and wraps OpenZeppelin's _transferOwnership function to
2190
+ * also update adminACLContract for improved introspection.
2191
+ */
2192
+ function _transferOwnership(address newOwner) internal override {
2193
+ Ownable._transferOwnership(newOwner);
2194
+ adminACLContract = IAdminACLV0(newOwner);
2195
+ }
2196
+
2197
+ /**
2198
+ * @notice Updates sales addresses for the platform and render providers to
2199
+ * the input parameters.
2200
+ * @param _renderProviderPrimarySalesAddress Address of new primary sales
2201
+ * payment address.
2202
+ * @param _renderProviderSecondarySalesAddress Address of new secondary sales
2203
+ * payment address.
2204
+ * @param _platformProviderPrimarySalesAddress Address of new primary sales
2205
+ * payment address.
2206
+ * @param _platformProviderSecondarySalesAddress Address of new secondary sales
2207
+ * payment address.
2208
+ * @dev Note that this method does not check that the input address is
2209
+ * not `address(0)`, as it is expected that callers of this method should
2210
+ * perform input validation where applicable.
2211
+ */
2212
+ function _updateProviderSalesAddresses(
2213
+ address _renderProviderPrimarySalesAddress,
2214
+ address _renderProviderSecondarySalesAddress,
2215
+ address _platformProviderPrimarySalesAddress,
2216
+ address _platformProviderSecondarySalesAddress
2217
+ ) internal {
2218
+ platformProviderPrimarySalesAddress = payable(
2219
+ _platformProviderPrimarySalesAddress
2220
+ );
2221
+ platformProviderSecondarySalesAddress = payable(
2222
+ _platformProviderSecondarySalesAddress
2223
+ );
2224
+ renderProviderPrimarySalesAddress = payable(
2225
+ _renderProviderPrimarySalesAddress
2226
+ );
2227
+ renderProviderSecondarySalesAddress = payable(
2228
+ _renderProviderSecondarySalesAddress
2229
+ );
2230
+ emit PlatformUpdated(FIELD_PROVIDER_SALES_ADDRESSES);
2231
+ }
2232
+
2233
+ /**
2234
+ * @notice Updates randomizer address to `_randomizerAddress`.
2235
+ * @param _randomizerAddress New randomizer address.
2236
+ * @dev Note that this method does not check that the input address is
2237
+ * not `address(0)`, as it is expected that callers of this method should
2238
+ * perform input validation where applicable.
2239
+ */
2240
+ function _updateRandomizerAddress(address _randomizerAddress) internal {
2241
+ randomizerContract = IRandomizerV2(_randomizerAddress);
2242
+ // populate historical randomizer array
2243
+ _historicalRandomizerAddresses.push(_randomizerAddress);
2244
+ emit PlatformUpdated(FIELD_RANDOMIZER_ADDRESS);
2245
+ }
2246
+
2247
+ /**
2248
+ * @notice Updates default base URI to `_defaultBaseURI`.
2249
+ * When new projects are added, their `projectBaseURI` is automatically
2250
+ * initialized to `_defaultBaseURI`.
2251
+ * @param _defaultBaseURI New default base URI.
2252
+ * @dev Note that this method does not check that the input string is not
2253
+ * the empty string, as it is expected that callers of this method should
2254
+ * perform input validation where applicable.
2255
+ */
2256
+ function _updateDefaultBaseURI(string memory _defaultBaseURI) internal {
2257
+ defaultBaseURI = _defaultBaseURI;
2258
+ emit PlatformUpdated(FIELD_DEFAULT_BASE_URI);
2259
+ }
2260
+
2261
+ /**
2262
+ * @notice Internal function to complete a project.
2263
+ * @param _projectId Project ID to be completed.
2264
+ */
2265
+ function _completeProject(uint256 _projectId) internal {
2266
+ projects[_projectId].completedTimestamp = uint64(block.timestamp);
2267
+ emit ProjectUpdated(_projectId, FIELD_PROJECT_COMPLETED);
2268
+ }
2269
+
2270
+ /**
2271
+ * @notice Internal function that returns whether a project is unlocked.
2272
+ * Projects automatically lock four weeks after they are completed.
2273
+ * Projects are considered completed when they have been invoked the
2274
+ * maximum number of times.
2275
+ * @param _projectId Project ID to be queried.
2276
+ * @return bool true if project is unlocked, false otherwise.
2277
+ * @dev This also enforces that the `_projectId` passed in is valid.
2278
+ */
2279
+ function _projectUnlocked(uint256 _projectId) internal view returns (bool) {
2280
+ _onlyValidProjectId(_projectId);
2281
+ uint256 projectCompletedTimestamp = projects[_projectId]
2282
+ .completedTimestamp;
2283
+ bool projectOpen = projectCompletedTimestamp == 0;
2284
+ return
2285
+ projectOpen ||
2286
+ (block.timestamp - projectCompletedTimestamp <
2287
+ FOUR_WEEKS_IN_SECONDS);
2288
+ }
2289
+
2290
+ /**
2291
+ * Helper for calling `BytecodeStorageReader` external library reader method,
2292
+ * added for bytecode size reduction purposes.
2293
+ */
2294
+ function _readFromBytecode(
2295
+ address _address
2296
+ ) internal view returns (string memory) {
2297
+ return BytecodeStorageReader.readFromBytecode(_address);
2298
+ }
2299
+
2300
+ // strings library from OpenZeppelin, modified for no constants
2301
+
2302
+ bytes16 private _HEX_SYMBOLS = "0123456789abcdef";
2303
+ uint8 private _ADDRESS_LENGTH = 20;
2304
+
2305
+ /**
2306
+ * @dev Converts a `uint256` to its ASCII `string` decimal representation.
2307
+ */
2308
+ function toString(uint256 value) internal pure returns (string memory) {
2309
+ // Inspired by OraclizeAPI's implementation - MIT licence
2310
+ // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
2311
+
2312
+ if (value == 0) {
2313
+ return "0";
2314
+ }
2315
+ uint256 temp = value;
2316
+ uint256 digits;
2317
+ while (temp != 0) {
2318
+ digits++;
2319
+ temp /= 10;
2320
+ }
2321
+ bytes memory buffer = new bytes(digits);
2322
+ while (value != 0) {
2323
+ digits -= 1;
2324
+ buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
2325
+ value /= 10;
2326
+ }
2327
+ return string(buffer);
2328
+ }
2329
+
2330
+ /**
2331
+ * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
2332
+ */
2333
+ function toHexString(
2334
+ uint256 value,
2335
+ uint256 length
2336
+ ) internal view returns (string memory) {
2337
+ bytes memory buffer = new bytes(2 * length + 2);
2338
+ buffer[0] = "0";
2339
+ buffer[1] = "x";
2340
+ for (uint256 i = 2 * length + 1; i > 1; --i) {
2341
+ buffer[i] = _HEX_SYMBOLS[value & 0xf];
2342
+ value >>= 4;
2343
+ }
2344
+ require(value == 0, "hex length insufficient");
2345
+ return string(buffer);
2346
+ }
2347
+
2348
+ /**
2349
+ * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
2350
+ */
2351
+ function toHexString(address addr) internal view returns (string memory) {
2352
+ return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
2353
+ }
2354
+ }