@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,373 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ import {Base64} from "@openzeppelin-5.0/contracts/utils/Base64.sol";
5
+ import {Strings} from "@openzeppelin-5.0/contracts/utils/Strings.sol";
6
+
7
+ pragma solidity ^0.8.22;
8
+
9
+ /**
10
+ * @title Art Blocks Json Library
11
+ * @author Art Blocks Inc.
12
+ * @notice UNAUDITED
13
+ * A library for helping write static JSON metadata for Art Blocks projects.
14
+ * The library writes JSON data to a string within solidity, while remaining O(n) in gas and memory complexity,
15
+ * where n is the number of elements in an array or key:value pairs in an object. The library is O(m^2)
16
+ * in gas and memory complexity, where m is the depth of nested objects or arrays.
17
+ * When used in memory, the library only supports arrays and objects of fixed, pre-allocated size,
18
+ * in order to avoid dynamic memory allocation.
19
+ * The library supports an optional flag to write input string values as base64 encoded strings, in
20
+ * order to avoid the need for escaping characters in JSON strings.
21
+ * Keys are assumed to be valid key names in JSON.
22
+ * The library supports writing JSON objects, arrays, strings, uints, booleans, and null values.
23
+ * The library does not support writing floating point numbers.
24
+ */
25
+ library JsonStatic {
26
+ using Strings for uint256;
27
+ using JsonStatic for JsonStatic.Json;
28
+
29
+ enum JsonType {
30
+ OBJECT,
31
+ ARRAY,
32
+ ELEMENT_STRING,
33
+ ELEMENT_UINT,
34
+ ELEMENT_BOOLEAN,
35
+ ELEMENT_NULL
36
+ }
37
+
38
+ enum StringEncodingFlag {
39
+ NONE,
40
+ BASE64
41
+ }
42
+
43
+ struct Json {
44
+ JsonType jsonType;
45
+ string[] objectKeys; // array of keys if type is OBJECT
46
+ Json[] values; // array of values if type is OBJECT, or array values if type is ARRAY
47
+ StringEncodingFlag stringEncodingFlag;
48
+ string elementValueString; // value if type is ELEMENT_STRING
49
+ uint256 elementValueUintOrBool; // value if type is ELEMENT_UINT, 0/1 if type is ELEMENT_BOOLEAN
50
+ // implied null if type is ELEMENT_NULL
51
+ }
52
+
53
+ /**
54
+ * Convenience function to create a new values array.
55
+ * @param length the length of the values array.
56
+ * @return the new values array.
57
+ */
58
+ function newValuesArray(
59
+ uint256 length
60
+ ) internal pure returns (Json[] memory) {
61
+ return new Json[](length);
62
+ }
63
+
64
+ /**
65
+ * Convenience function to create a new keys array.
66
+ * @param length the length of the keys array.
67
+ * @return the new keys array.
68
+ */
69
+ function newKeysArray(
70
+ uint256 length
71
+ ) internal pure returns (string[] memory) {
72
+ return new string[](length);
73
+ }
74
+
75
+ /**
76
+ * Convenience function to create a new object element.
77
+ * @param keys the keys of the object element.
78
+ * @param values the values of the object element.
79
+ * @return the new object element.
80
+ */
81
+ function newObjectElement(
82
+ string[] memory keys,
83
+ Json[] memory values
84
+ ) internal pure returns (Json memory) {
85
+ return
86
+ Json({
87
+ jsonType: JsonType.OBJECT, // type
88
+ objectKeys: keys, // input
89
+ values: values, // input
90
+ stringEncodingFlag: StringEncodingFlag.NONE, // default
91
+ elementValueString: "", // default
92
+ elementValueUintOrBool: 0 // default
93
+ });
94
+ }
95
+
96
+ /**
97
+ * Convenience function to create a new array element.
98
+ * @param values the values of the array element.
99
+ * @return the new array element.
100
+ */
101
+ function newArrayElement(
102
+ Json[] memory values
103
+ ) internal pure returns (Json memory) {
104
+ return
105
+ Json({
106
+ jsonType: JsonType.ARRAY, // type
107
+ objectKeys: new string[](0), // default
108
+ values: values, // input
109
+ stringEncodingFlag: StringEncodingFlag.NONE, // default
110
+ elementValueString: "", // default
111
+ elementValueUintOrBool: 0 // default
112
+ });
113
+ }
114
+
115
+ /**
116
+ * Convenience function to create a new string element.
117
+ * If base64 encoding is set as the encoding flag, the passed value will be encoded on WRITE and
118
+ * should NOT already be encoded. Passing an already encoded value will result in double encoding.
119
+ * @param value the string value of the element.
120
+ * @param stringEncodingFlag the string encoding flag for the element.
121
+ * @return the new string element.
122
+ */
123
+ function newStringElement(
124
+ string memory value,
125
+ StringEncodingFlag stringEncodingFlag
126
+ ) internal pure returns (Json memory) {
127
+ return
128
+ Json({
129
+ jsonType: JsonType.ELEMENT_STRING, // type
130
+ objectKeys: new string[](0), // default
131
+ values: new Json[](0), // default
132
+ stringEncodingFlag: stringEncodingFlag, // input
133
+ elementValueString: value, // input
134
+ elementValueUintOrBool: 0 // default
135
+ });
136
+ }
137
+
138
+ /**
139
+ * Convenience function to create a new uint element.
140
+ * @param value the uint value of the element.
141
+ * @return the new uint element.
142
+ */
143
+ function newUintElement(uint256 value) internal pure returns (Json memory) {
144
+ return
145
+ Json({
146
+ jsonType: JsonType.ELEMENT_UINT, // type
147
+ objectKeys: new string[](0), // default
148
+ values: new Json[](0), // default
149
+ stringEncodingFlag: StringEncodingFlag.NONE, // default
150
+ elementValueString: "", // default
151
+ elementValueUintOrBool: value // input
152
+ });
153
+ }
154
+
155
+ /**
156
+ * Convenience function to create a new boolean element.
157
+ * @param value the boolean value of the element.
158
+ * @return the new boolean element.
159
+ */
160
+ function newBooleanElement(bool value) internal pure returns (Json memory) {
161
+ return
162
+ Json({
163
+ jsonType: JsonType.ELEMENT_BOOLEAN, // type
164
+ objectKeys: new string[](0), // default
165
+ values: new Json[](0), // default
166
+ stringEncodingFlag: StringEncodingFlag.NONE, // default
167
+ elementValueString: "", // default
168
+ elementValueUintOrBool: value ? 1 : 0 // input
169
+ });
170
+ }
171
+
172
+ /**
173
+ * @notice writes a json struct to a string
174
+ * @param json the json struct to write
175
+ * @return the json string
176
+ */
177
+ function write(Json memory json) internal pure returns (string memory) {
178
+ if (json.jsonType == JsonType.OBJECT) {
179
+ return _writeObject(json);
180
+ } else if (json.jsonType == JsonType.ARRAY) {
181
+ return _writeArray(json);
182
+ } else if (json.jsonType == JsonType.ELEMENT_STRING) {
183
+ return
184
+ _writeString(json.elementValueString, json.stringEncodingFlag);
185
+ } else if (json.jsonType == JsonType.ELEMENT_UINT) {
186
+ return _writeUint(json.elementValueUintOrBool);
187
+ } else if (json.jsonType == JsonType.ELEMENT_BOOLEAN) {
188
+ return _writeBoolean(json.elementValueUintOrBool);
189
+ } else {
190
+ return _writeNull();
191
+ }
192
+ }
193
+
194
+ /**
195
+ * @notice writes a json struct of type JsonType.OBJECT to a string
196
+ * @param json the json struct of type JsonType.OBJECT to write
197
+ * @return the json string
198
+ */
199
+ function _writeObject(
200
+ Json memory json
201
+ ) private pure returns (string memory) {
202
+ // pre-allocate string array to avoid dynamic memory allocation
203
+ uint256 keysLength = json.objectKeys.length;
204
+ string[] memory valueStrings = new string[](keysLength);
205
+ for (uint256 i = 0; i < keysLength; i++) {
206
+ // only trailing comma if not last child, per JSON spec
207
+ string memory trailingChar = i < keysLength - 1 ? "," : "";
208
+ valueStrings[i] = string.concat(
209
+ '"',
210
+ json.objectKeys[i], // keys assumed to be valid JSON keys
211
+ '":',
212
+ json.values[i].write(),
213
+ trailingChar
214
+ );
215
+ }
216
+ // concat all valueStrings and return
217
+ return string.concat("{", _concatenateStrings(valueStrings), "}");
218
+ }
219
+
220
+ /**
221
+ * @notice writes a json struct of type JsonType.ARRAY to a string
222
+ * @param json the json struct of type JsonType.ARRAY to write
223
+ * @return the json string
224
+ */
225
+ function _writeArray(
226
+ Json memory json
227
+ ) private pure returns (string memory) {
228
+ // pre-allocate string array to avoid dynamic memory allocation
229
+ uint256 valuesLength = json.values.length;
230
+ string[] memory valueStrings = new string[](valuesLength);
231
+ for (uint256 i = 0; i < valuesLength; i++) {
232
+ // only trailing comma if not last child, per JSON spec
233
+ string memory trailingChar = i < valuesLength - 1 ? "," : "";
234
+ valueStrings[i] = string.concat(
235
+ json.values[i].write(),
236
+ trailingChar
237
+ );
238
+ }
239
+ // concat all valueStrings and return
240
+ return string.concat("[", _concatenateStrings(valueStrings), "]");
241
+ }
242
+
243
+ /**
244
+ * @notice writes a string value to a valid json string.
245
+ * If the string encoding flag is set to BASE64, the written value will be base64 encoded.
246
+ * @param value the string value to write
247
+ * @param stringEncodingFlag the string encoding flag for the value
248
+ * @return the json string
249
+ */
250
+ function _writeString(
251
+ string memory value,
252
+ StringEncodingFlag stringEncodingFlag
253
+ ) private pure returns (string memory) {
254
+ if (stringEncodingFlag == StringEncodingFlag.BASE64) {
255
+ return _writeBase64(value);
256
+ } else {
257
+ return _writePlainString(value);
258
+ }
259
+ }
260
+
261
+ /**
262
+ * @notice writes a string value to a valid json string
263
+ * @param value the string value to write
264
+ * @return the json string
265
+ */
266
+ function _writePlainString(
267
+ string memory value
268
+ ) private pure returns (string memory) {
269
+ return string.concat('"', value, '"');
270
+ }
271
+
272
+ /**
273
+ * @notice writes a base64 encoded string value to a valid json string
274
+ * @param value the string value to write
275
+ * @return the json string
276
+ */
277
+ function _writeBase64(
278
+ string memory value
279
+ ) private pure returns (string memory) {
280
+ return string.concat('"', Base64.encode(bytes(value)), '"');
281
+ }
282
+
283
+ /**
284
+ * @notice writes a uint value to a valid json string
285
+ * @param value the uint value to write
286
+ * @return the json string
287
+ */
288
+ function _writeUint(uint256 value) private pure returns (string memory) {
289
+ // @dev no quotes around numbers
290
+ return value.toString();
291
+ }
292
+
293
+ /**
294
+ * @notice writes a boolean value to a valid json string.
295
+ * If the value is equal to zero, it is written as false, otherwise it is written as true.
296
+ * @dev Booleans are written as true or false without quotes.
297
+ * @param value the value to write
298
+ * @return the json string
299
+ */
300
+ function _writeBoolean(uint256 value) private pure returns (string memory) {
301
+ // @dev no quotes around booleans
302
+ return (value > 0) ? "true" : "false";
303
+ }
304
+
305
+ /**
306
+ * @notice writes a null value to a valid json string
307
+ * @return the json string
308
+ */
309
+ function _writeNull() private pure returns (string memory) {
310
+ return "null";
311
+ }
312
+
313
+ /**
314
+ * @notice Helper function to efficiently concatenate an array of strings.
315
+ * @dev portions of code generated with AI Assistance, modified and tested by human developers.
316
+ * @param strings The array of strings to concatenate.
317
+ * @return The concatenated string.
318
+ */
319
+ function _concatenateStrings(
320
+ string[] memory strings
321
+ ) private pure returns (string memory) {
322
+ uint totalLength = 0;
323
+
324
+ // Step 1: Calculate the total length of the result string
325
+ for (uint i = 0; i < strings.length; i++) {
326
+ totalLength += bytes(strings[i]).length;
327
+ }
328
+
329
+ // Step 2: Allocate memory for the resulting string
330
+ string memory result = new string(totalLength); // Allocate memory for the result, also defining its length
331
+ uint resultPtr;
332
+ assembly {
333
+ resultPtr := add(result, 0x20) // Point to the start of the string's data in memory
334
+ }
335
+
336
+ // Step 3: Copy each string into the result using assembly
337
+ for (uint i = 0; i < strings.length; i++) {
338
+ bytes memory currentString = bytes(strings[i]);
339
+ uint currentLength = currentString.length;
340
+ uint currentPtr;
341
+
342
+ assembly {
343
+ currentPtr := add(currentString, 0x20) // Start of current string's data
344
+ }
345
+
346
+ // Copy the full 32-byte chunks
347
+ uint chunks = currentLength / 32;
348
+ uint remainder = currentLength % 32;
349
+
350
+ for (uint j = 0; j < chunks; j++) {
351
+ assembly {
352
+ let chunk := mload(currentPtr) // Load 32 bytes of the current string
353
+ mstore(resultPtr, chunk) // Store the 32 bytes into the result
354
+ resultPtr := add(resultPtr, 0x20) // Move the result pointer forward by 32 bytes
355
+ currentPtr := add(currentPtr, 0x20) // Move the current string pointer forward by 32 bytes
356
+ }
357
+ }
358
+
359
+ // Handle remaining bytes (less than 32)
360
+ if (remainder > 0) {
361
+ assembly {
362
+ let chunk := mload(currentPtr) // Load 32 bytes
363
+ let mask := sub(shl(mul(8, sub(0x20, remainder)), 1), 1) // Create mask for the remainder
364
+ let lastChunk := and(chunk, not(mask)) // Mask out the excess bits
365
+ mstore(resultPtr, lastChunk) // Store the remaining bytes into the result
366
+ resultPtr := add(resultPtr, remainder) // Move the result pointer forward by the remainder length
367
+ }
368
+ }
369
+ }
370
+
371
+ return result;
372
+ }
373
+ }
@@ -4,8 +4,9 @@
4
4
  pragma solidity ^0.8.0;
5
5
 
6
6
  import {IGenArt721CoreContractV3_Engine_Flex} from "../../interfaces/v0.8.x/IGenArt721CoreContractV3_Engine_Flex.sol";
7
+ import {IBytecodeStorageReader_Base} from "../../interfaces/v0.8.x/IBytecodeStorageReader_Base.sol";
7
8
 
8
- import {BytecodeStorageWriter, BytecodeStorageReader} from "./BytecodeStorageV2.sol";
9
+ import {BytecodeStorageWriter} from "./BytecodeStorageV2.sol";
9
10
 
10
11
  /**
11
12
  * @title Art Blocks V3 Engine Flex - External Helper Library
@@ -502,10 +503,15 @@ library V3FlexLib {
502
503
  * If the dependencyType is ONCHAIN, the `data` field will contain the extrated bytecode data and `cid`
503
504
  * will be an empty string. Conversly, for any other dependencyType, the `data` field will be an empty string
504
505
  * and the `bytecodeAddress` will point to the zero address.
506
+ * @param _projectId Project to get external asset dependency for.
507
+ * @param _index Index of the external asset dependency.
508
+ * @param _bytecodeStorageReaderContract The bytecode storage reader contract to use for reading on-chain
509
+ * dependencies; only used if the dependency is of type ONCHAIN.
505
510
  */
506
511
  function projectExternalAssetDependencyByIndex(
507
512
  uint256 _projectId,
508
- uint256 _index
513
+ uint256 _index,
514
+ IBytecodeStorageReader_Base _bytecodeStorageReaderContract
509
515
  )
510
516
  external
511
517
  view
@@ -533,7 +539,7 @@ library V3FlexLib {
533
539
  IGenArt721CoreContractV3_Engine_Flex
534
540
  .ExternalAssetDependencyType
535
541
  .ONCHAIN)
536
- ? BytecodeStorageReader.readFromBytecode(
542
+ ? _bytecodeStorageReaderContract.readFromBytecode(
537
543
  _bytecodeAddress
538
544
  )
539
545
  : ""
@@ -0,0 +1,64 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ pragma solidity ^0.8.0;
5
+
6
+ /**
7
+ * @title Art Blocks Min Price Library
8
+ * @notice This library is designed for the Art Blocks platform. It includes
9
+ * events to assist with minters that implement a minimum mint fee.
10
+ * @author Art Blocks Inc.
11
+ */
12
+
13
+ library MinPriceLib {
14
+ /**
15
+ * @notice Min mint fee, in wei, was updated to be the
16
+ * provided value.
17
+ * @param minMintFee Min mint fee, in wei
18
+ */
19
+ event MinMintFeeUpdated(uint256 minMintFee);
20
+
21
+ // position of MinPrice Lib storage, using a diamond storage pattern
22
+ // for this library
23
+ bytes32 constant MIN_PRICE_LIB_STORAGE_POSITION =
24
+ keccak256("minpricelib.storage");
25
+
26
+ // Diamond storage pattern is used in this library
27
+ struct MinPriceLibStorage {
28
+ uint256 minMintFee;
29
+ }
30
+
31
+ /**
32
+ * @notice Update the minimum mint fee for the minter, and emit
33
+ * an event.
34
+ * @param newMinMintFee New minimum mint fee, in wei
35
+ */
36
+ function updateMinMintFee(uint256 newMinMintFee) internal {
37
+ MinPriceLibStorage storage minPriceLibStorage_ = s();
38
+ minPriceLibStorage_.minMintFee = newMinMintFee;
39
+ emit MinMintFeeUpdated(newMinMintFee);
40
+ }
41
+
42
+ /**
43
+ * @notice Loads the min mint fee from storage.
44
+ */
45
+ function getMinMintFee() internal view returns (uint256 minMintFee) {
46
+ return s().minMintFee;
47
+ }
48
+
49
+ /**
50
+ * @notice Return the storage struct for reading and writing. This library
51
+ * uses a diamond storage pattern when managing storage.
52
+ * @return storageStruct The MinPriceLibStorage struct.
53
+ */
54
+ function s()
55
+ internal
56
+ pure
57
+ returns (MinPriceLibStorage storage storageStruct)
58
+ {
59
+ bytes32 position = MIN_PRICE_LIB_STORAGE_POSITION;
60
+ assembly ("memory-safe") {
61
+ storageStruct.slot := position
62
+ }
63
+ }
64
+ }
@@ -96,6 +96,44 @@ library SplitFundsLib {
96
96
  }
97
97
  }
98
98
 
99
+ /**
100
+ * @notice pays ETH funds to sender (if refund), with all of token price
101
+ * being sent to the render provider for a token purchased on project
102
+ * `projectId`.
103
+ * WARNING: This function uses msg.value and msg.sender to determine
104
+ * refund amounts, and therefore may not be applicable to all use cases
105
+ * (e.g. do not use with Dutch Auctions with on-chain settlement).
106
+ * @dev This function relies on msg.sender and msg.value, so it must be
107
+ * called directly from the contract that is receiving the payment.
108
+ * @dev possible DoS during splits is acknowledged, and mitigated by
109
+ * business practices, including end-to-end testing on mainnet, and
110
+ * admin-accepted artist payment addresses.
111
+ * @param projectId Project ID for which funds shall be split.
112
+ * @param pricePerTokenInWei Current price of token, in Wei.
113
+ * @param coreContract Address of the GenArt721CoreContract associated
114
+ * with the project.
115
+ */
116
+ function sendAllToRenderProviderETHRefundSender(
117
+ uint256 projectId,
118
+ uint256 pricePerTokenInWei,
119
+ address coreContract
120
+ ) internal {
121
+ if (msg.value > 0) {
122
+ // send refund to sender
123
+ uint256 refund = msg.value - pricePerTokenInWei;
124
+ if (refund > 0) {
125
+ (bool success_, ) = msg.sender.call{value: refund}("");
126
+ require(success_, "Refund failed");
127
+ }
128
+ // send remaining to render provider
129
+ sendAllToRenderProviderETHNoRefund({
130
+ projectId: projectId,
131
+ valueInWei: pricePerTokenInWei,
132
+ coreContract: coreContract
133
+ });
134
+ }
135
+ }
136
+
99
137
  /**
100
138
  * @notice Splits ETH revenues between providers, artist, and artist's
101
139
  * additional payee for revenue generated by project `projectId`.
@@ -185,6 +223,75 @@ library SplitFundsLib {
185
223
  });
186
224
  }
187
225
 
226
+ /**
227
+ * @notice Sends all revenue generated by project `projectId` to render
228
+ * provider.
229
+ * This function does NOT refund msg.sender, and does NOT use msg.value
230
+ * when determining the value to be split.
231
+ * @dev possible DoS during splits is acknowledged, and mitigated by
232
+ * business practices, including end-to-end testing on mainnet, and
233
+ * admin-accepted payment addresses.
234
+ * @param projectId Project ID for which funds shall be sent.
235
+ * @param valueInWei Value to be sent, in Wei.
236
+ * @param coreContract Address of the GenArt721CoreContract
237
+ * associated with the project.
238
+ */
239
+ function sendAllToRenderProviderETHNoRefund(
240
+ uint256 projectId,
241
+ uint256 valueInWei,
242
+ address coreContract
243
+ ) internal {
244
+ if (valueInWei == 0) {
245
+ return; // return early
246
+ }
247
+ // split funds between platforms, artist, and artist's
248
+ // additional payee
249
+ bool isEngine_ = isEngine(coreContract);
250
+ address payable renderProviderAddress;
251
+ if (isEngine_) {
252
+ // get engine splits
253
+ (
254
+ ,
255
+ renderProviderAddress,
256
+ ,
257
+ ,
258
+ ,
259
+ ,
260
+ ,
261
+
262
+ ) = IGenArt721CoreContractV3_Engine(coreContract)
263
+ .getPrimaryRevenueSplits({
264
+ _projectId: projectId,
265
+ _price: valueInWei
266
+ });
267
+ } else {
268
+ // get flagship splits
269
+ // @dev note that platformProviderAddress and
270
+ // platformProviderRevenue remain 0 for flagship
271
+ (
272
+ ,
273
+ // artblocks revenue
274
+ renderProviderAddress, // artblocks address
275
+ ,
276
+ ,
277
+ ,
278
+
279
+ ) = IGenArt721CoreContractV3(coreContract).getPrimaryRevenueSplits({
280
+ _projectId: projectId,
281
+ _price: valueInWei
282
+ });
283
+ }
284
+ require(
285
+ renderProviderAddress != address(0),
286
+ "Render Provider address not set"
287
+ );
288
+ // distribute revenue
289
+ // Render Provider / Art Blocks payment
290
+ // @dev previous conditional ensures valueInWei is non-zero
291
+ (bool success, ) = renderProviderAddress.call{value: valueInWei}("");
292
+ require(success, "Render Provider payment failed");
293
+ }
294
+
188
295
  /**
189
296
  * @notice Splits ERC20 funds between providers, artist, and artist's
190
297
  * additional payee, for a token purchased on project `projectId`.