@artblocks/contracts 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/README.md +22 -38
  2. package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
  3. package/artifacts/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2.sol/BytecodeStorageReaderContractV2.json +201 -0
  4. package/artifacts/contracts/BytecodeStorageReaders/UniversalBytecodeStorageReader.sol/UniversalBytecodeStorageReader.json +154 -0
  5. package/artifacts/contracts/BytecodeStorageV2Writer.sol/BytecodeStorageV2Writer.json +87 -0
  6. package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +144 -14
  7. package/artifacts/contracts/GenArt721CoreV3_Curated.sol/GenArt721CoreV3_Curated.json +2493 -0
  8. package/artifacts/contracts/OwnedCreate2FactoryV0.sol/OwnedCreate2FactoryV0.json +311 -0
  9. package/artifacts/contracts/archive/GenArt721CoreV3.sol/GenArt721CoreV3.json +15 -2
  10. package/artifacts/contracts/archive/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +15 -2
  11. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol/MinterDAExpV2.json +2 -2
  12. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol/MinterDAExpV3.json +2 -2
  13. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV4.sol/MinterDAExpV4.json +2 -2
  14. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol/MinterDAExpSettlementV0.json +2 -2
  15. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV1.sol/MinterDAExpSettlementV1.json +2 -2
  16. package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +2 -2
  17. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV2.sol/MinterDALinV2.json +2 -2
  18. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV3.sol/MinterDALinV3.json +2 -2
  19. package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV4.sol/MinterDALinV4.json +2 -2
  20. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV1.sol/MinterHolderV1.json +2 -2
  21. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +2 -2
  22. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV3.sol/MinterHolderV3.json +2 -2
  23. package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV4.sol/MinterHolderV4.json +2 -2
  24. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV1.sol/MinterMerkleV1.json +2 -2
  25. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV2.sol/MinterMerkleV2.json +2 -2
  26. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol/MinterMerkleV3.json +2 -2
  27. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol/MinterMerkleV4.json +2 -2
  28. package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV5.sol/MinterMerkleV5.json +2 -2
  29. package/artifacts/contracts/archive/minter-suite/Minters/MinterPolyptych/MinterPolyptychV0.sol/IGenArt721CoreContractV3WithRandomizer.json +37 -0
  30. package/artifacts/contracts/archive/minter-suite/Minters/MinterPolyptych/MinterPolyptychV0.sol/MinterPolyptychV0.json +2 -2
  31. package/artifacts/contracts/archive/minter-suite/Minters/MinterSEA/MinterSEAV0.sol/MinterSEAV0.json +2 -2
  32. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol/MinterSetPriceV2.json +2 -2
  33. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol/MinterSetPriceV3.json +2 -2
  34. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV4.sol/MinterSetPriceV4.json +2 -2
  35. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol/MinterSetPriceERC20V2.json +2 -2
  36. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol/MinterSetPriceERC20V3.json +2 -2
  37. package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V4.sol/MinterSetPriceERC20V4.json +2 -2
  38. package/artifacts/contracts/engine/V3/EngineFactoryV0.sol/EngineFactoryV0.json +20 -2
  39. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +48 -12
  40. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +76 -40
  41. package/artifacts/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol/GenArt721CoreV3_Engine_Flex_PROOF.json +15 -2
  42. package/artifacts/contracts/engine/V3/forks/PROHIBITION/AdminACLV0_PROHIBITION.sol/AdminACLV0_PROHIBITION.json +2 -2
  43. package/artifacts/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol/GenArt721CoreV3_Engine_Flex_PROHIBITION.json +15 -2
  44. package/artifacts/contracts/engine/V3/forks/PROHIBITION/interfaces/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.sol/IGenArt721CoreContractV3_Engine_Flex_PROHIBITION.json +37 -0
  45. package/artifacts/contracts/engine-registry/CoreRegistryV1.sol/CoreRegistryV1.json +2 -2
  46. package/artifacts/contracts/generator/AddressChunks.sol/AddressChunks.json +10 -0
  47. package/artifacts/contracts/generator/GenArt721GeneratorV0.sol/GenArt721GeneratorV0.json +333 -0
  48. package/artifacts/contracts/generator/GenArt721GeneratorV0.sol/ILegacyGenArt721CoreV2_PBAB_Flex.json +47 -0
  49. package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReader.sol/IBytecodeStorageReader.json +7 -7
  50. package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReaderV2.sol/IBytecodeStorageReaderV2.json +7 -7
  51. package/artifacts/contracts/interfaces/v0.8.x/IBytecodeStorageReader_Base.sol/IBytecodeStorageReader_Base.json +30 -0
  52. package/artifacts/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol/ICoreRegistryV1.json +13 -0
  53. package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +170 -0
  54. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3.sol/IGenArt721CoreContractV3.json +37 -0
  55. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol/IGenArt721CoreContractV3_Base.json +37 -0
  56. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol/IGenArt721CoreContractV3_Engine.json +42 -0
  57. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol/IGenArt721CoreContractV3_Engine_Flex.json +42 -0
  58. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.sol/IGenArt721CoreContractV3_Engine_Flex_PreV3p2.json +37 -0
  59. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_PreV3p2.sol/IGenArt721CoreContractV3_Engine_PreV3p2.json +37 -0
  60. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV0.sol/IGenArt721CoreProjectScriptV0.json +59 -0
  61. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV1.sol/IGenArt721CoreProjectScriptV1.json +64 -0
  62. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV0.sol/IGenArt721CoreTokenHashProviderV0.json +30 -0
  63. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV1.sol/IGenArt721CoreTokenHashProviderV1.json +30 -0
  64. package/artifacts/contracts/interfaces/v0.8.x/IGenArt721GeneratorV0.sol/IGenArt721GeneratorV0.json +63 -0
  65. package/artifacts/contracts/interfaces/v0.8.x/IOwnedCreate2FactoryV0.sol/IOwnedCreate2FactoryV0.json +74 -0
  66. package/artifacts/contracts/interfaces/v0.8.x/ISeaDropShimForContract.sol/ISeaDropShimForContract.json +37 -0
  67. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterMinPriceV0.sol/ISharedMinterMinPriceV0.json +37 -0
  68. package/artifacts/contracts/interfaces/v0.8.x/IUniversalBytecodeStorageReader.sol/IUniversalBytecodeStorageReader.json +56 -0
  69. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ERC721SeaDropStructsErrorsAndEvents.sol/ERC721SeaDropStructsErrorsAndEvents.json +43 -0
  70. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/INonFungibleSeaDropToken.sol/INonFungibleSeaDropToken.json +715 -0
  71. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDrop.sol/ISeaDrop.json +1571 -0
  72. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDropTokenContractMetadata.sol/ISeaDropTokenContractMetadata.json +345 -0
  73. package/artifacts/contracts/interfaces/v0.8.x/integration-refs/OpenSea/SeaDropErrorsAndEvents.sol/SeaDropErrorsAndEvents.json +717 -0
  74. package/artifacts/contracts/libs/v0.8.x/AuthLib.sol/AuthLib.json +2 -2
  75. package/artifacts/contracts/libs/v0.8.x/Bytes32Strings.sol/Bytes32Strings.json +2 -2
  76. package/artifacts/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol/DependencyRegistryStorageLib.json +2 -2
  77. package/artifacts/contracts/libs/v0.8.x/JsonStatic.sol/JsonStatic.json +10 -0
  78. package/artifacts/contracts/libs/v0.8.x/V3FlexLib.sol/V3FlexLib.json +9 -22
  79. package/artifacts/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol/MaxInvocationsLib.json +2 -2
  80. package/artifacts/contracts/libs/v0.8.x/minter-libs/MinPriceLib.sol/MinPriceLib.json +24 -0
  81. package/artifacts/contracts/libs/v0.8.x/minter-libs/PolyptychLib.sol/PolyptychLib.json +2 -2
  82. package/artifacts/contracts/libs/v0.8.x/minter-libs/RAMLib.sol/RAMLib.json +2 -2
  83. package/artifacts/contracts/libs/v0.8.x/minter-libs/SEALib.sol/SEALib.json +2 -2
  84. package/artifacts/contracts/libs/v0.8.x/minter-libs/SettlementExpLib.sol/SettlementExpLib.json +2 -2
  85. package/artifacts/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol/SplitFundsLib.json +2 -2
  86. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV1.sol/MinterFilterV1.json +2 -2
  87. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV2.sol/MinterFilterV2.json +2 -2
  88. package/artifacts/contracts/minter-suite/Minters/MinterDAExpHolderV5.sol/MinterDAExpHolderV5.json +2 -2
  89. package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV3.sol/MinterDAExpSettlementV3.json +2 -2
  90. package/artifacts/contracts/minter-suite/Minters/MinterDAExpV5.sol/MinterDAExpV5.json +2 -2
  91. package/artifacts/contracts/minter-suite/Minters/MinterDALinHolderV5.sol/MinterDALinHolderV5.json +2 -2
  92. package/artifacts/contracts/minter-suite/Minters/MinterDALinV5.sol/MinterDALinV5.json +2 -2
  93. package/artifacts/contracts/minter-suite/Minters/MinterMinPriceMerkleV0.sol/MinterMinPriceMerkleV0.json +664 -0
  94. package/artifacts/contracts/minter-suite/Minters/MinterMinPriceV0.sol/MinterMinPriceV0.json +387 -0
  95. package/artifacts/contracts/minter-suite/Minters/MinterRAMV0.sol/MinterRAMV0.json +2 -2
  96. package/artifacts/contracts/minter-suite/Minters/MinterSEAV1.sol/MinterSEAV1.json +2 -2
  97. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V5.sol/MinterSetPriceERC20V5.json +2 -2
  98. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceHolderV5.sol/MinterSetPriceHolderV5.json +2 -2
  99. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceMerkleV5.sol/MinterSetPriceMerkleV5.json +2 -2
  100. package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychERC20V5.sol/MinterSetPricePolyptychERC20V5.json +2 -2
  101. package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol/MinterSetPricePolyptychV5.json +2 -2
  102. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV5.sol/MinterSetPriceV5.json +2 -2
  103. package/artifacts/contracts/minter-suite/Minters/one-off/MinterSetPriceV5_SingleCore.sol/MinterSetPriceV5_SingleCore.json +2 -2
  104. package/artifacts/contracts/minter-suite/Minters/one-off/SeaDropXArtBlocksShim.sol/SeaDropXArtBlocksShim.json +1206 -0
  105. package/artifacts/contracts/mock/BytecodeV1LibCallsMock.sol/BytecodeV1LibCallsMock.json +2 -2
  106. package/artifacts/contracts/mock/BytecodeV2LibCallsMock.sol/BytecodeV2LibCallsMock.json +2 -2
  107. package/artifacts/contracts/mock/DummySharedMinter.sol/DummySharedMinter.json +2 -2
  108. package/artifacts/contracts/mock/ERC20MockAltDecimals.sol/ERC20MockAltDecimals.json +318 -0
  109. package/artifacts/contracts/mock/ForceSendMock.sol/ForceSendMock.json +2 -2
  110. package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +2 -2
  111. package/artifacts/contracts/mock/MockAdminACLV0_PROHIBITION.sol/MockAdminACLV0Events_PROHIBITION.json +2 -2
  112. package/artifacts/contracts/mock/MockFileStore.sol/MockFileStore.json +35 -0
  113. package/artifacts/contracts/mock/OriginRegisterMock.sol/OriginRegisterMock.json +2 -2
  114. package/artifacts/contracts/mock/RandomizerV2_NoAssignMock.sol/RandomizerV2_NoAssignMock.json +2 -2
  115. package/artifacts/contracts/randomizer/deprecated/PolyptychRandomizerV0.sol/BasicPolyptychRandomizerV0.json +2 -2
  116. package/artifacts/contracts/randomizer/deprecated/RandomizerV2.sol/BasicRandomizerV2.json +2 -2
  117. package/artifacts/contracts/randomizer/shared/SharedRandomizerV0.sol/SharedRandomizerV0.json +2 -2
  118. package/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2.sol +103 -0
  119. package/contracts/BytecodeStorageReaders/UniversalBytecodeStorageReader.sol +70 -0
  120. package/contracts/BytecodeStorageV2Writer.sol +69 -0
  121. package/contracts/DependencyRegistryV0.sol +229 -60
  122. package/contracts/GenArt721CoreV3_Curated.sol +133 -0
  123. package/contracts/OwnedCreate2FactoryV0.sol +173 -0
  124. package/contracts/engine/V3/EngineFactoryV0.sol +10 -2
  125. package/contracts/engine/V3/GenArt721CoreV3_Engine.sol +139 -70
  126. package/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol +141 -71
  127. package/contracts/generator/AddressChunks.sol +106 -0
  128. package/contracts/generator/GenArt721GeneratorV0.sol +1094 -0
  129. package/contracts/generator/scripty-support/Scripty.sol +5 -0
  130. package/contracts/interfaces/v0.8.x/IBytecodeStorageReader.sol +34 -36
  131. package/contracts/interfaces/v0.8.x/IBytecodeStorageReaderV2.sol +5 -3
  132. package/contracts/interfaces/v0.8.x/IBytecodeStorageReader_Base.sol +20 -0
  133. package/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol +5 -0
  134. package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +94 -0
  135. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol +13 -2
  136. package/contracts/interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol +3 -1
  137. package/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV0.sol +22 -0
  138. package/contracts/interfaces/v0.8.x/IGenArt721CoreProjectScriptV1.sol +23 -0
  139. package/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV0.sol +11 -0
  140. package/contracts/interfaces/v0.8.x/IGenArt721CoreTokenHashProviderV1.sol +9 -0
  141. package/contracts/interfaces/v0.8.x/IGenArt721GeneratorV0.sol +14 -0
  142. package/contracts/interfaces/v0.8.x/IOwnedCreate2FactoryV0.sol +40 -0
  143. package/contracts/interfaces/v0.8.x/ISeaDropShimForContract.sol +19 -0
  144. package/contracts/interfaces/v0.8.x/ISharedMinterMinPriceV0.sol +22 -0
  145. package/contracts/interfaces/v0.8.x/ISharedMinterRequired.sol +10 -4
  146. package/contracts/interfaces/v0.8.x/IUniversalBytecodeStorageReader.sol +28 -0
  147. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ERC721SeaDropStructsErrorsAndEvents.sol +58 -0
  148. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/INonFungibleSeaDropToken.sol +186 -0
  149. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDrop.sol +337 -0
  150. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/ISeaDropTokenContractMetadata.sol +152 -0
  151. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/SeaDropErrorsAndEvents.sol +320 -0
  152. package/contracts/interfaces/v0.8.x/integration-refs/OpenSea/SeaDropStructs.sol +146 -0
  153. package/contracts/libs/v0.8.x/Bytes32Strings.sol +20 -0
  154. package/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol +11 -3
  155. package/contracts/libs/v0.8.x/JsonStatic.sol +373 -0
  156. package/contracts/libs/v0.8.x/V3FlexLib.sol +9 -3
  157. package/contracts/libs/v0.8.x/minter-libs/MinPriceLib.sol +64 -0
  158. package/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol +107 -0
  159. package/contracts/minter-suite/Minters/MinterMinPriceMerkleV0.sol +765 -0
  160. package/contracts/minter-suite/Minters/MinterMinPriceV0.sol +462 -0
  161. package/contracts/minter-suite/Minters/one-off/SeaDropXArtBlocksShim.sol +869 -0
  162. package/contracts/mock/ERC20MockAltDecimals.sol +31 -0
  163. package/contracts/mock/MockFileStore.sol +22 -0
  164. package/package.json +20 -18
@@ -0,0 +1,173 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ // @dev fixed to specific solidity version for clarity and for more clear
5
+ // source code verification purposes.
6
+ pragma solidity 0.8.22;
7
+
8
+ import {IOwnedCreate2FactoryV0} from "./interfaces/v0.8.x/IOwnedCreate2FactoryV0.sol";
9
+
10
+ import "@openzeppelin-5.0/contracts/access/Ownable.sol";
11
+ import {IERC20} from "@openzeppelin-5.0/contracts/token/ERC20/IERC20.sol";
12
+ import {SafeERC20} from "@openzeppelin-5.0/contracts/token/ERC20/utils/SafeERC20.sol";
13
+ import {Create2} from "@openzeppelin-5.0/contracts/utils/Create2.sol";
14
+
15
+ /**
16
+ * @title OwnedCreate2FactoryV0
17
+ * @author Art Blocks Inc.
18
+ * @notice Owned, Create2 factory contract for deploying arbitrary contracts from a single wallet.
19
+ * This contract is intended to be used as a factory for deploying other contracts, while also allowing
20
+ * the owner to drain the contract's balance to a recipient address. The contract also provides a
21
+ * function to execute a batch of calls, which can be useful for interacting with contracts that
22
+ * might deem this contract eligible for airdrops, thereby avoiding loss of funds.
23
+ */
24
+ contract OwnedCreate2FactoryV0 is Ownable, IOwnedCreate2FactoryV0 {
25
+ // public type
26
+ bytes32 public constant type_ = "OwnedCreate2FactoryV0";
27
+
28
+ /**
29
+ * Represents a generic call operation.
30
+ */
31
+ struct Call {
32
+ address to;
33
+ bytes data;
34
+ }
35
+
36
+ /**
37
+ * @notice creates this contract and deploys the curated contract
38
+ * @param owner_ address of the initial owner of this contract to execute all future calls
39
+ */
40
+ constructor(address owner_) Ownable(owner_) {
41
+ // input validation
42
+ // @dev Ownable enforces that the owner must be non-zero
43
+
44
+ // emit Deployed event
45
+ emit Deployed();
46
+ }
47
+
48
+ /**
49
+ * @notice Deploy a new contract using create2.
50
+ * Reverts if the initcode is empty.
51
+ * Reverts if not called by the owner.
52
+ * The address of the new contract is deterministic based on the salt and initcode, and may be obtained by calling
53
+ * the `predictDeterministicAddress` function.
54
+ * @param salt The salt to use for the deployment.
55
+ * @param initcode The initcode of the contract to deploy.
56
+ * @return newContract The address of the newly deployed contract.
57
+ */
58
+ function deployCreate2(
59
+ bytes32 salt,
60
+ bytes calldata initcode
61
+ ) external payable onlyOwner returns (address newContract) {
62
+ // input validation
63
+ // @dev Create2.deploy will revert if initcode is empty
64
+
65
+ // deploy contract
66
+ newContract = Create2.deploy({
67
+ amount: msg.value,
68
+ salt: salt,
69
+ bytecode: initcode
70
+ });
71
+
72
+ emit ContractCreated({newContract: newContract});
73
+ return newContract;
74
+ }
75
+
76
+ /**
77
+ * @dev This contract is not intended to hold funds. This function,
78
+ * `drainETH`, and `drainERC20` are implemented to prevent the loss
79
+ * of funds that might be sent to this contract inadvertently.
80
+ */
81
+ receive() external payable {}
82
+
83
+ /**
84
+ * @notice Drains the contract's balance to the `recipient`.
85
+ * @param recipient The address to send funds to.
86
+ * Only callable by the owner.
87
+ */
88
+ function drainETH(address payable recipient) external onlyOwner {
89
+ uint256 balance = address(this).balance;
90
+ if (balance > 0) {
91
+ (bool success, ) = recipient.call{value: balance}("");
92
+ require(success, "Payment failed");
93
+ }
94
+ }
95
+
96
+ /**
97
+ * @notice Drains the contract's balance of an input ERC20 token to
98
+ * the `recipient`.
99
+ * @param ERC20TokenAddress The address of the ERC20 token to withdraw.
100
+ * @param recipient The address to send ERC20 tokens to.
101
+ * Only callable by the owner.
102
+ */
103
+ function drainERC20(
104
+ address ERC20TokenAddress,
105
+ address recipient
106
+ ) external onlyOwner {
107
+ IERC20 token = IERC20(ERC20TokenAddress);
108
+ uint256 balance = token.balanceOf(address(this));
109
+ if (balance > 0) {
110
+ SafeERC20.safeTransfer({
111
+ token: token,
112
+ to: recipient,
113
+ value: balance
114
+ });
115
+ }
116
+ }
117
+
118
+ /**
119
+ * @notice Execute a batch of calls.
120
+ * @dev The calls are executed in order, reverting if any of them fails. Can
121
+ * only be called by the owner. It is safe to check ownership only once here
122
+ * because the owner status is only used to gate access to the function, not
123
+ * to validate each individual call. Even if ownership is transferred during
124
+ * the sequence of calls, it does not affect the execution logic or security,
125
+ * as ownership is solely used to prevent unauthorized use of this batch
126
+ * execution capability. This is particularly useful to safely interact
127
+ * with contracts or addresses that might deem this contract eligible for
128
+ * airdrops, thereby avoiding loss of funds.
129
+ * @param _calls The calls to execute
130
+ */
131
+ function execCalls(
132
+ Call[] calldata _calls
133
+ )
134
+ external
135
+ onlyOwner
136
+ returns (uint256 blockNumber, bytes[] memory returnData)
137
+ {
138
+ blockNumber = block.number;
139
+ uint256 length = _calls.length;
140
+ returnData = new bytes[](length);
141
+
142
+ for (uint256 i = 0; i < length; ++i) {
143
+ Call calldata calli = _calls[i];
144
+
145
+ // check for existence of code at the target address
146
+ if (calli.to.code.length == 0) {
147
+ // when the call is to an EOA, the calldata must be empty.
148
+ require(calli.data.length == 0, "Invalid call data");
149
+ }
150
+
151
+ (bool success, bytes memory data) = calli.to.call(calli.data);
152
+ require(success, string(data));
153
+ returnData[i] = data;
154
+ }
155
+ }
156
+
157
+ /**
158
+ * @dev Predict the deterministic address for a new deployment using create2.
159
+ * @param salt Salt used to deterministically deploy the clone.
160
+ * @param initcode The initcode of the contract to deploy.
161
+ */
162
+
163
+ function predictDeterministicAddress(
164
+ bytes32 salt,
165
+ bytes memory initcode
166
+ ) external view returns (address predicted) {
167
+ return
168
+ Create2.computeAddress({
169
+ salt: salt,
170
+ bytecodeHash: keccak256(initcode)
171
+ });
172
+ }
173
+ }
@@ -65,6 +65,9 @@ contract EngineFactoryV0 is Ownable, IEngineFactoryV0 {
65
65
  */
66
66
  bool public isAbandoned; // default false
67
67
 
68
+ /// Universal Bytecode Storage Reader contract address, which all core contracts are initialized to use
69
+ address public immutable universalBytecodeStorageReader;
70
+
68
71
  // pseudorandom salt nonce to prevent collisions for multiple contract deployments in single block
69
72
  uint256 private _pseudorandomSaltNonce;
70
73
 
@@ -87,13 +90,15 @@ contract EngineFactoryV0 is Ownable, IEngineFactoryV0 {
87
90
  * @param owner_ address of the initial owner
88
91
  * @param defaultBaseURIHost_ default base URI prefix for all Engine contracts,
89
92
  * e.g. "https://token.artblocks.io/" for mainnet, "https://token.arbitrum.artblocks.io/" for arbitrum, etc.
93
+ * @param universalBytecodeStorageReader_ address of the UniversalBytecodeStorageReader contract
90
94
  */
91
95
  constructor(
92
96
  address engineImplementation_,
93
97
  address engineFlexImplementation_,
94
98
  address coreRegistry_,
95
99
  address owner_,
96
- string memory defaultBaseURIHost_
100
+ string memory defaultBaseURIHost_,
101
+ address universalBytecodeStorageReader_
97
102
  ) Ownable(owner_) {
98
103
  _onlyNonZeroAddress(engineImplementation_);
99
104
  _onlyNonZeroAddress(engineFlexImplementation_);
@@ -117,6 +122,8 @@ contract EngineFactoryV0 is Ownable, IEngineFactoryV0 {
117
122
  engineFlexImplementation
118
123
  ).coreVersion();
119
124
 
125
+ universalBytecodeStorageReader = universalBytecodeStorageReader_;
126
+
120
127
  // emit event
121
128
  emit Deployed({
122
129
  engineImplementation: engineImplementation_,
@@ -191,7 +198,8 @@ contract EngineFactoryV0 is Ownable, IEngineFactoryV0 {
191
198
  IGenArt721CoreContractV3_Engine(engineContract).initialize({
192
199
  engineConfiguration: engineConfiguration,
193
200
  adminACLContract_: adminACLContract,
194
- defaultBaseURIHost: defaultBaseURIHost
201
+ defaultBaseURIHost: defaultBaseURIHost,
202
+ bytecodeStorageReaderContract_: universalBytecodeStorageReader
195
203
  });
196
204
 
197
205
  (
@@ -10,12 +10,13 @@ import {IGenArt721CoreContractV3_ProjectFinance} from "../../interfaces/v0.8.x/I
10
10
  import "../../interfaces/v0.8.x/IGenArt721CoreContractExposesHashSeed.sol";
11
11
  import "../../interfaces/v0.8.x/IDependencyRegistryCompatibleV0.sol";
12
12
  import {ISplitProviderV0} from "../../interfaces/v0.8.x/ISplitProviderV0.sol";
13
+ import {IBytecodeStorageReader_Base} from "../../interfaces/v0.8.x/IBytecodeStorageReader_Base.sol";
13
14
 
14
15
  import "@openzeppelin-5.0/contracts/utils/Strings.sol";
15
16
  import "@openzeppelin-5.0/contracts/access/Ownable.sol";
16
17
  import {IERC2981} from "@openzeppelin-5.0/contracts/interfaces/IERC2981.sol";
17
18
  import "../../libs/v0.8.x/ERC721_PackedHashSeedV1.sol";
18
- import "../../libs/v0.8.x/BytecodeStorageV2.sol";
19
+ import {BytecodeStorageWriter, BytecodeStorageReader} from "../../libs/v0.8.x/BytecodeStorageV2.sol";
19
20
  import "../../libs/v0.8.x/Bytes32Strings.sol";
20
21
 
21
22
  /**
@@ -48,6 +49,7 @@ import "../../libs/v0.8.x/Bytes32Strings.sol";
48
49
  * - forbidNewProjects (forever forbidding new projects)
49
50
  * - updateDefaultBaseURI (used to initialize new project base URIs)
50
51
  * - updateSplitProvider
52
+ * - updateBytecodeStorageReaderContract
51
53
  * ----------------------------------------------------------------------------
52
54
  * The following functions are restricted to either the Artist address or
53
55
  * the Admin ACL contract, only when the project is not locked:
@@ -265,9 +267,9 @@ contract GenArt721CoreV3_Engine is
265
267
  bool public allowArtistProjectActivation;
266
268
 
267
269
  /// version & type of this core contract
268
- bytes32 constant CORE_VERSION = "v3.2.2";
270
+ bytes32 constant CORE_VERSION = "v3.2.4";
269
271
 
270
- function coreVersion() external pure returns (string memory) {
272
+ function coreVersion() external pure virtual returns (string memory) {
271
273
  return CORE_VERSION.toString();
272
274
  }
273
275
 
@@ -287,6 +289,9 @@ contract GenArt721CoreV3_Engine is
287
289
  // royalty split provider
288
290
  ISplitProviderV0 public splitProvider;
289
291
 
292
+ // bytecode storage reader contract; may be universal or specific version reader contract
293
+ IBytecodeStorageReader_Base public bytecodeStorageReaderContract;
294
+
290
295
  /**
291
296
  * @dev This constructor sets the owner to a non-functional address as a formality.
292
297
  * It is only ever ran on the implementation contract. The `Ownable` constructor is
@@ -395,77 +400,25 @@ contract GenArt721CoreV3_Engine is
395
400
  * function will be called atomically by the factory contract that deploys this
396
401
  * contract, after which it will be initialized and uncallable.
397
402
  * @param engineConfiguration EngineConfiguration to configure the contract with.
403
+ * note: parameter `engineConfiguration.newSuperAdminAddress` is not used or operated on in this contract.
398
404
  * @param adminACLContract_ Address of admin access control contract, to be
399
405
  * set as contract owner.
400
406
  * @param defaultBaseURIHost Base URI prefix to initialize default base URI with.
407
+ * @param bytecodeStorageReaderContract_ Address of the bytecode storage reader contract.
401
408
  */
402
409
  function initialize(
403
- EngineConfiguration calldata engineConfiguration,
410
+ EngineConfiguration memory engineConfiguration,
404
411
  address adminACLContract_,
405
- string memory defaultBaseURIHost
406
- ) external {
407
- // can only be initialized once
408
- if (_initialized) {
409
- revert GenArt721Error(ErrorCodes.ContractInitialized);
410
- }
411
- // immediately mark as initialized
412
- _initialized = true;
413
- // @dev assume renderProviderAddress, randomizer, and AdminACL non-zero
414
- // checks on platform provider addresses performed in _updateProviderSalesAddresses
415
- // initialize default sales revenue percentages and basis points
416
- _renderProviderPrimarySalesPercentage = 10;
417
- defaultRenderProviderSecondarySalesBPS = 250;
418
- _platformProviderPrimarySalesPercentage = engineConfiguration
419
- .nullPlatformProvider
420
- ? 0
421
- : 10;
422
- defaultPlatformProviderSecondarySalesBPS = engineConfiguration
423
- .nullPlatformProvider
424
- ? 0
425
- : 250;
426
-
427
- // set token name and token symbol
428
- ERC721_PackedHashSeedV1.initialize(
429
- engineConfiguration.tokenName,
430
- engineConfiguration.tokenSymbol
431
- );
432
- // update minter if populated
433
- if (engineConfiguration.minterFilterAddress != address(0)) {
434
- _updateMinterContract(engineConfiguration.minterFilterAddress);
435
- }
436
- _updateSplitProvider(engineConfiguration.splitProviderAddress);
437
- // setup immutable `autoApproveArtistSplitProposals` config
438
- autoApproveArtistSplitProposals = engineConfiguration
439
- .autoApproveArtistSplitProposals;
440
- // setup immutable `nullPlatformProvider` config
441
- nullPlatformProvider = engineConfiguration.nullPlatformProvider;
442
- // setup immutable `allowArtistProjectActivation` config
443
- allowArtistProjectActivation = engineConfiguration
444
- .allowArtistProjectActivation;
445
- // record contracts starting project ID
446
- // casting-up is safe
447
- startingProjectId = uint256(engineConfiguration.startingProjectId);
448
- // @dev nullPlatformProvider must be set before calling _updateProviderSalesAddresses
449
- _updateProviderSalesAddresses(
450
- engineConfiguration.renderProviderAddress,
451
- engineConfiguration.renderProviderAddress,
452
- engineConfiguration.platformProviderAddress,
453
- engineConfiguration.platformProviderAddress
454
- );
455
- _updateRandomizerAddress(engineConfiguration.randomizerContract);
456
- // set AdminACL management contract as owner
457
- _transferOwnership(adminACLContract_);
458
- // initialize default base URI
459
- _updateDefaultBaseURI(
460
- string.concat(defaultBaseURIHost, address(this).toHexString(), "/")
461
- );
462
- // initialize next project ID
463
- _nextProjectId = engineConfiguration.startingProjectId;
464
- emit PlatformUpdated(
465
- bytes32(uint256(PlatformUpdatedFields.FIELD_NEXT_PROJECT_ID))
466
- );
467
- // @dev This contract is registered on the core registry in a
468
- // subsequent call by the factory.
412
+ string memory defaultBaseURIHost,
413
+ address bytecodeStorageReaderContract_
414
+ ) external virtual {
415
+ // @dev internal function call so derived contracts have access to initialization logic
416
+ _initialize({
417
+ engineConfiguration: engineConfiguration,
418
+ adminACLContract_: adminACLContract_,
419
+ defaultBaseURIHost: defaultBaseURIHost,
420
+ bytecodeStorageReaderContract_: bytecodeStorageReaderContract_
421
+ });
469
422
  }
470
423
 
471
424
  /**
@@ -814,6 +767,22 @@ contract GenArt721CoreV3_Engine is
814
767
  _updateSplitProvider(_splitProviderAddress);
815
768
  }
816
769
 
770
+ /**
771
+ * @notice Updates bytecode storage reader contract to `_bytecodeStorageReaderContract`.
772
+ * Reverts if `_bytecodeStorageReaderContract` is zero address.
773
+ * Updating the active Bytecode Storage Reader contract may affect the ability to read
774
+ * data related to existing projects. Care should be taken to ensure that the new
775
+ * contract is compatible with the existing project data.
776
+ * @param _bytecodeStorageReaderContract New bytecode storage reader contract address.
777
+ */
778
+ function updateBytecodeStorageReaderContract(
779
+ address _bytecodeStorageReaderContract
780
+ ) external {
781
+ _onlyAdminACL(this.updateBytecodeStorageReaderContract.selector);
782
+ _onlyNonZeroAddress(_bytecodeStorageReaderContract);
783
+ _updateBytecodeStorageReaderContract(_bytecodeStorageReaderContract);
784
+ }
785
+
817
786
  /**
818
787
  * @notice Toggles project `_projectId` as active/inactive.
819
788
  * @param _projectId Project ID to be toggled.
@@ -1902,6 +1871,7 @@ contract GenArt721CoreV3_Engine is
1902
1871
  string memory _script
1903
1872
  ) external pure returns (bytes memory) {
1904
1873
  _onlyNonEmptyString(_script);
1874
+ // @dev want a potentially version-specific compression algorithm, so use version-specific library here
1905
1875
  return BytecodeStorageReader.getCompressed(_script);
1906
1876
  }
1907
1877
 
@@ -2320,6 +2290,23 @@ contract GenArt721CoreV3_Engine is
2320
2290
  );
2321
2291
  }
2322
2292
 
2293
+ /**
2294
+ * @notice Update the bytecode storage reader contract address, and emit corresponding event.
2295
+ * @param _bytecodeStorageReaderContract New bytecode storage reader contract address.
2296
+ */
2297
+ function _updateBytecodeStorageReaderContract(
2298
+ address _bytecodeStorageReaderContract
2299
+ ) internal {
2300
+ bytecodeStorageReaderContract = IBytecodeStorageReader_Base(
2301
+ _bytecodeStorageReaderContract
2302
+ );
2303
+ emit PlatformUpdated(
2304
+ bytes32(
2305
+ uint256(PlatformUpdatedFields.FIELD_BYTECODE_STORAGE_READER)
2306
+ )
2307
+ );
2308
+ }
2309
+
2323
2310
  /**
2324
2311
  * @notice internal function to update a splitter contract for a project,
2325
2312
  * based on the project's financials in this contract's storage.
@@ -2390,6 +2377,88 @@ contract GenArt721CoreV3_Engine is
2390
2377
  );
2391
2378
  }
2392
2379
 
2380
+ /**
2381
+ * @notice Initializes the contract with the provided `engineConfiguration`.
2382
+ * This function should be called atomically, immediately after deployment.
2383
+ * Only callable once. Validation on `engineConfiguration` is performed by caller.
2384
+ * @param engineConfiguration EngineConfiguration to configure the contract with.
2385
+ * note: parameter `engineConfiguration.newSuperAdminAddress` is not used or operated on in this contract.
2386
+ * @param adminACLContract_ Address of admin access control contract, to be
2387
+ * set as contract owner.
2388
+ * @param defaultBaseURIHost Base URI prefix to initialize default base URI with.
2389
+ * @param bytecodeStorageReaderContract_ Address of bytecode storage reader contract.
2390
+ */
2391
+ function _initialize(
2392
+ EngineConfiguration memory engineConfiguration,
2393
+ address adminACLContract_,
2394
+ string memory defaultBaseURIHost,
2395
+ address bytecodeStorageReaderContract_
2396
+ ) internal {
2397
+ // can only be initialized once
2398
+ if (_initialized) {
2399
+ revert GenArt721Error(ErrorCodes.ContractInitialized);
2400
+ }
2401
+ // immediately mark as initialized
2402
+ _initialized = true;
2403
+ // @dev assume renderProviderAddress, randomizer, and AdminACL non-zero
2404
+ // checks on platform provider addresses performed in _updateProviderSalesAddresses
2405
+ // initialize default sales revenue percentages and basis points
2406
+ _renderProviderPrimarySalesPercentage = 10;
2407
+ defaultRenderProviderSecondarySalesBPS = 250;
2408
+ _platformProviderPrimarySalesPercentage = engineConfiguration
2409
+ .nullPlatformProvider
2410
+ ? 0
2411
+ : 10;
2412
+ defaultPlatformProviderSecondarySalesBPS = engineConfiguration
2413
+ .nullPlatformProvider
2414
+ ? 0
2415
+ : 250;
2416
+
2417
+ // set token name and token symbol
2418
+ ERC721_PackedHashSeedV1.initialize(
2419
+ engineConfiguration.tokenName,
2420
+ engineConfiguration.tokenSymbol
2421
+ );
2422
+ // update minter if populated
2423
+ if (engineConfiguration.minterFilterAddress != address(0)) {
2424
+ _updateMinterContract(engineConfiguration.minterFilterAddress);
2425
+ }
2426
+ _updateSplitProvider(engineConfiguration.splitProviderAddress);
2427
+ _updateBytecodeStorageReaderContract(bytecodeStorageReaderContract_);
2428
+ // setup immutable `autoApproveArtistSplitProposals` config
2429
+ autoApproveArtistSplitProposals = engineConfiguration
2430
+ .autoApproveArtistSplitProposals;
2431
+ // setup immutable `nullPlatformProvider` config
2432
+ nullPlatformProvider = engineConfiguration.nullPlatformProvider;
2433
+ // setup immutable `allowArtistProjectActivation` config
2434
+ allowArtistProjectActivation = engineConfiguration
2435
+ .allowArtistProjectActivation;
2436
+ // record contracts starting project ID
2437
+ // casting-up is safe
2438
+ startingProjectId = uint256(engineConfiguration.startingProjectId);
2439
+ // @dev nullPlatformProvider must be set before calling _updateProviderSalesAddresses
2440
+ _updateProviderSalesAddresses(
2441
+ engineConfiguration.renderProviderAddress,
2442
+ engineConfiguration.renderProviderAddress,
2443
+ engineConfiguration.platformProviderAddress,
2444
+ engineConfiguration.platformProviderAddress
2445
+ );
2446
+ _updateRandomizerAddress(engineConfiguration.randomizerContract);
2447
+ // set AdminACL management contract as owner
2448
+ _transferOwnership(adminACLContract_);
2449
+ // initialize default base URI
2450
+ _updateDefaultBaseURI(
2451
+ string.concat(defaultBaseURIHost, address(this).toHexString(), "/")
2452
+ );
2453
+ // initialize next project ID
2454
+ _nextProjectId = engineConfiguration.startingProjectId;
2455
+ emit PlatformUpdated(
2456
+ bytes32(uint256(PlatformUpdatedFields.FIELD_NEXT_PROJECT_ID))
2457
+ );
2458
+ // @dev This contract is registered on the core registry in a
2459
+ // subsequent call by the factory.
2460
+ }
2461
+
2393
2462
  /**
2394
2463
  * @notice Internal function that returns whether a project is unlocked.
2395
2464
  * Projects automatically lock four weeks after they are completed.
@@ -2412,12 +2481,12 @@ contract GenArt721CoreV3_Engine is
2412
2481
  }
2413
2482
 
2414
2483
  /**
2415
- * Helper for calling `BytecodeStorageReader` external library reader method,
2484
+ * @notice Helper for calling bytecodeStorageReaderContract reader method;
2416
2485
  * added for bytecode size reduction purposes.
2417
2486
  */
2418
2487
  function _readFromBytecode(
2419
2488
  address _address
2420
2489
  ) internal view returns (string memory) {
2421
- return BytecodeStorageReader.readFromBytecode(_address);
2490
+ return bytecodeStorageReaderContract.readFromBytecode(_address);
2422
2491
  }
2423
2492
  }