@artblocks/contracts 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +2 -2
  2. package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
  3. package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +97 -10
  4. package/artifacts/contracts/GenArt721CoreV3.sol/GenArt721CoreV3.json +4 -4
  5. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +4 -9
  6. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +4 -9
  7. package/artifacts/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol/GenArt721CoreV3_Engine_Flex_PROOF.json +4 -9
  8. package/artifacts/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol/GenArt721CoreV3_Engine_Flex_PROHIBITION.json +4 -9
  9. package/artifacts/contracts/engine-registry/CoreRegistryV1.sol/CoreRegistryV1.json +12 -12
  10. package/artifacts/contracts/explorations/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +4 -4
  11. package/artifacts/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol/ICoreRegistryV1.json +6 -6
  12. package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +19 -0
  13. package/artifacts/contracts/interfaces/v0.8.x/IMinterFilterV1.sol/IMinterFilterV1.json +22 -22
  14. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAExpSettlementV0.sol/ISharedMinterDAExpSettlementV0.json +8 -101
  15. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAExpV0.sol/ISharedMinterDAExpV0.json +1 -57
  16. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDALinV0.sol/ISharedMinterDALinV0.json +1 -57
  17. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAV0.sol/ISharedMinterDAV0.json +2 -21
  18. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterHolderERC20V0.sol/ISharedMinterHolderERC20V0.json +158 -0
  19. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterHolderV0.sol/ISharedMinterHolderV0.json +15 -90
  20. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterMerkleV0.sol/ISharedMinterMerkleV0.json +10 -36
  21. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterSEAV0.sol/ISharedMinterSEAV0.json +4 -236
  22. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterSimplePurchaseV0.sol/ISharedMinterSimplePurchaseV0.json +5 -5
  23. package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterV0.sol/ISharedMinterV0.json +7 -423
  24. package/artifacts/contracts/interfaces/v0.8.x/ISharedRandomizerV0.sol/ISharedRandomizerV0.json +17 -17
  25. package/artifacts/contracts/libs/v0.8.x/ABHelpers.sol/ABHelpers.json +2 -2
  26. package/artifacts/contracts/libs/v0.8.x/AuthLib.sol/AuthLib.json +2 -2
  27. package/artifacts/contracts/libs/v0.8.x/Bytes32Strings.sol/Bytes32Strings.json +2 -2
  28. package/artifacts/contracts/libs/v0.8.x/minter-libs/DAExpLib.sol/DAExpLib.json +60 -3
  29. package/artifacts/contracts/libs/v0.8.x/minter-libs/DALib.sol/DALib.json +30 -0
  30. package/artifacts/contracts/libs/v0.8.x/minter-libs/DALinLib.sol/DALinLib.json +60 -3
  31. package/artifacts/contracts/libs/v0.8.x/minter-libs/GenericMinterEventsLib.sol/GenericMinterEventsLib.json +346 -0
  32. package/artifacts/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol/MaxInvocationsLib.json +29 -3
  33. package/artifacts/contracts/libs/v0.8.x/minter-libs/MerkleLib.sol/MerkleLib.json +30 -3
  34. package/artifacts/contracts/libs/v0.8.x/minter-libs/PolyptychLib.sol/PolyptychLib.json +2 -2
  35. package/artifacts/contracts/libs/v0.8.x/minter-libs/SEALib.sol/SEALib.json +254 -3
  36. package/artifacts/contracts/libs/v0.8.x/minter-libs/SetPriceLib.sol/SetPriceLib.json +48 -3
  37. package/artifacts/contracts/libs/v0.8.x/minter-libs/SettlementExpLib.sol/SettlementExpLib.json +41 -3
  38. package/artifacts/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol/SplitFundsLib.json +35 -3
  39. package/artifacts/contracts/libs/v0.8.x/minter-libs/TokenHolderLib.sol/TokenHolderLib.json +79 -3
  40. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV1.sol/MinterFilterV1.json +2 -2
  41. package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV2.sol/MinterFilterV2.json +41 -41
  42. package/artifacts/contracts/minter-suite/Minters/MinterDAExpHolderV5.sol/MinterDAExpHolderV5.json +66 -632
  43. package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +2 -20
  44. package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV3.sol/MinterDAExpSettlementV3.json +67 -594
  45. package/artifacts/contracts/minter-suite/Minters/MinterDAExpV5.sol/MinterDAExpV5.json +33 -524
  46. package/artifacts/contracts/minter-suite/Minters/MinterDALinHolderV5.sol/MinterDALinHolderV5.json +66 -632
  47. package/artifacts/contracts/minter-suite/Minters/MinterDALinV5.sol/MinterDALinV5.json +33 -524
  48. package/artifacts/contracts/minter-suite/Minters/MinterSEAV1.sol/MinterSEAV1.json +51 -717
  49. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V5.sol/MinterSetPriceERC20V5.json +58 -454
  50. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceHolderV5.sol/MinterSetPriceHolderV5.json +61 -552
  51. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceMerkleV5.sol/MinterSetPriceMerkleV5.json +55 -497
  52. package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychERC20V5.sol/MinterSetPricePolyptychERC20V5.json +110 -571
  53. package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol/MinterSetPricePolyptychV5.json +69 -560
  54. package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV5.sol/MinterSetPriceV5.json +28 -444
  55. package/artifacts/contracts/mock/DummySharedMinter.sol/DummySharedMinter.json +2 -2
  56. package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +4 -9
  57. package/artifacts/contracts/mock/OriginRegisterMock.sol/OriginRegisterMock.json +2 -2
  58. package/artifacts/contracts/mock/ReentrancyHolderMockShared.sol/ReentrancyHolderMockShared.json +136 -0
  59. package/artifacts/contracts/mock/ReentrancyMerkleMockShared.sol/ReentrancyMerkleMockShared.json +105 -0
  60. package/artifacts/contracts/mock/ReentrancyMockShared.sol/ReentrancyMockShared.json +100 -0
  61. package/artifacts/contracts/mock/ReentrancySEAMockShared.sol/ReentrancySEAAutoBidderMockShared.json +69 -0
  62. package/artifacts/contracts/randomizer/shared/SharedRandomizerV0.sol/SharedRandomizerV0.json +19 -19
  63. package/contracts/DependencyRegistryV0.sol +84 -16
  64. package/contracts/archive/readme.md +16 -0
  65. package/contracts/engine/README.md +21 -0
  66. package/contracts/engine/V3/GenArt721CoreV3_Engine.sol +4 -10
  67. package/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol +4 -10
  68. package/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol +4 -10
  69. package/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol +4 -10
  70. package/contracts/engine-registry/CoreRegistryV1.sol +58 -65
  71. package/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol +6 -8
  72. package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +3 -0
  73. package/contracts/interfaces/v0.8.x/IMinterFilterV1.sol +25 -25
  74. package/contracts/interfaces/v0.8.x/ISharedMinterDAExpSettlementV0.sol +11 -20
  75. package/contracts/interfaces/v0.8.x/ISharedMinterDAExpV0.sol +1 -14
  76. package/contracts/interfaces/v0.8.x/ISharedMinterDALinV0.sol +1 -15
  77. package/contracts/interfaces/v0.8.x/ISharedMinterDAV0.sol +2 -8
  78. package/contracts/interfaces/v0.8.x/ISharedMinterHolderERC20V0.sol +47 -0
  79. package/contracts/interfaces/v0.8.x/ISharedMinterHolderV0.sol +15 -43
  80. package/contracts/interfaces/v0.8.x/ISharedMinterMerkleV0.sol +10 -20
  81. package/contracts/interfaces/v0.8.x/ISharedMinterSEAV0.sol +4 -67
  82. package/contracts/interfaces/v0.8.x/ISharedMinterSimplePurchaseV0.sol +5 -5
  83. package/contracts/interfaces/v0.8.x/ISharedMinterV0.sol +7 -155
  84. package/contracts/interfaces/v0.8.x/ISharedRandomizerV0.sol +37 -37
  85. package/contracts/libs/v0.8.x/ABHelpers.sol +14 -14
  86. package/contracts/libs/v0.8.x/AuthLib.sol +101 -102
  87. package/contracts/libs/v0.8.x/Bytes32Strings.sol +5 -5
  88. package/contracts/libs/v0.8.x/minter-libs/DAExpLib.sol +163 -38
  89. package/contracts/libs/v0.8.x/minter-libs/DALib.sol +26 -0
  90. package/contracts/libs/v0.8.x/minter-libs/DALinLib.sol +144 -37
  91. package/contracts/libs/v0.8.x/minter-libs/GenericMinterEventsLib.sol +171 -0
  92. package/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol +250 -110
  93. package/contracts/libs/v0.8.x/minter-libs/MerkleLib.sol +257 -48
  94. package/contracts/libs/v0.8.x/minter-libs/PolyptychLib.sol +138 -58
  95. package/contracts/libs/v0.8.x/minter-libs/SEALib.sol +778 -103
  96. package/contracts/libs/v0.8.x/minter-libs/SetPriceLib.sol +135 -13
  97. package/contracts/libs/v0.8.x/minter-libs/SettlementExpLib.sol +567 -187
  98. package/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol +480 -322
  99. package/contracts/libs/v0.8.x/minter-libs/TokenHolderLib.sol +214 -76
  100. package/contracts/minter-suite/MinterFilter/MinterFilterV2.sol +347 -304
  101. package/contracts/minter-suite/Minters/MinterDAExpHolderV5.sol +391 -491
  102. package/contracts/minter-suite/Minters/MinterDAExpSettlementV2.sol +1 -54
  103. package/contracts/minter-suite/Minters/MinterDAExpSettlementV3.sol +388 -628
  104. package/contracts/minter-suite/Minters/MinterDAExpV5.sol +212 -273
  105. package/contracts/minter-suite/Minters/MinterDALinHolderV5.sol +393 -488
  106. package/contracts/minter-suite/Minters/MinterDALinV5.sol +220 -277
  107. package/contracts/minter-suite/Minters/MinterSEAV1.sol +327 -664
  108. package/contracts/minter-suite/Minters/MinterSetPriceERC20V5.sol +278 -303
  109. package/contracts/minter-suite/Minters/MinterSetPriceHolderV5.sol +355 -446
  110. package/contracts/minter-suite/Minters/MinterSetPriceMerkleV5.sol +328 -416
  111. package/contracts/minter-suite/Minters/MinterSetPricePolyptychERC20V5.sol +538 -622
  112. package/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol +429 -553
  113. package/contracts/minter-suite/Minters/MinterSetPriceV5.sol +180 -227
  114. package/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol +3 -10
  115. package/contracts/mock/ReentrancyHolderMockShared.sol +59 -0
  116. package/contracts/mock/ReentrancyMerkleMockShared.sol +58 -0
  117. package/contracts/mock/ReentrancyMockShared.sol +48 -0
  118. package/contracts/mock/ReentrancySEAMockShared.sol +40 -0
  119. package/contracts/randomizer/shared/SharedRandomizerV0.sol +78 -70
  120. package/package.json +39 -33
@@ -1,18 +1,20 @@
1
1
  // SPDX-License-Identifier: LGPL-3.0-only
2
2
  // Created By: Art Blocks Inc.
3
3
 
4
- import "../../interfaces/v0.8.x/ISharedMinterSimplePurchaseV0.sol";
5
- import "../../interfaces/v0.8.x/ISharedMinterV0.sol";
6
- import "../../interfaces/v0.8.x/IMinterFilterV1.sol";
4
+ // @dev fixed to specific solidity version for clarity and for more clear
5
+ // source code verification purposes.
6
+ pragma solidity 0.8.19;
7
7
 
8
- import "../../libs/v0.8.x/AuthLib.sol";
9
- import "../../libs/v0.8.x/minter-libs/SplitFundsLib.sol";
10
- import "../../libs/v0.8.x/minter-libs/MaxInvocationsLib.sol";
11
- import "../../libs/v0.8.x/minter-libs/SetPriceLib.sol";
8
+ import {ISharedMinterSimplePurchaseV0} from "../../interfaces/v0.8.x/ISharedMinterSimplePurchaseV0.sol";
9
+ import {ISharedMinterV0} from "../../interfaces/v0.8.x/ISharedMinterV0.sol";
10
+ import {IMinterFilterV1} from "../../interfaces/v0.8.x/IMinterFilterV1.sol";
12
11
 
13
- import "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
12
+ import {AuthLib} from "../../libs/v0.8.x/AuthLib.sol";
13
+ import {SplitFundsLib} from "../../libs/v0.8.x/minter-libs/SplitFundsLib.sol";
14
+ import {MaxInvocationsLib} from "../../libs/v0.8.x/minter-libs/MaxInvocationsLib.sol";
15
+ import {SetPriceLib} from "../../libs/v0.8.x/minter-libs/SetPriceLib.sol";
14
16
 
15
- pragma solidity 0.8.19;
17
+ import {ReentrancyGuard} from "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
16
18
 
17
19
  /**
18
20
  * @title Shared, filtered Minter contract that allows tokens to be minted with
@@ -35,6 +37,13 @@ pragma solidity 0.8.19;
35
37
  * ----------------------------------------------------------------------------
36
38
  * Additional admin and artist privileged roles may be described on other
37
39
  * contracts that this minter integrates with.
40
+ * ----------------------------------------------------------------------------
41
+ * @notice Caution: While Engine projects must be registered on the Art Blocks
42
+ * Core Registry to assign this minter, this minter does not enforce that a
43
+ * project is registered when configured or queried. This is primarily for gas
44
+ * optimization purposes. It is, therefore, possible that fake projects may be
45
+ * configured on this minter, but they will not be able to mint tokens due to
46
+ * checks performed by this minter's Minter Filter.
38
47
  */
39
48
  contract MinterSetPriceV5 is
40
49
  ReentrancyGuard,
@@ -45,7 +54,7 @@ contract MinterSetPriceV5 is
45
54
  address public immutable minterFilterAddress;
46
55
 
47
56
  /// Minter filter this minter may interact with.
48
- IMinterFilterV1 private immutable minterFilter;
57
+ IMinterFilterV1 private immutable _minterFilter;
49
58
 
50
59
  /// minterType for this minter
51
60
  string public constant minterType = "MinterSetPriceV5";
@@ -53,41 +62,6 @@ contract MinterSetPriceV5 is
53
62
  /// minter version for this minter
54
63
  string public constant minterVersion = "v5.0.0";
55
64
 
56
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
57
- // STATE VARIABLES FOR SetPriceLib begin here
58
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
59
-
60
- /// contractAddress => projectId => set price project config
61
- mapping(address => mapping(uint256 => SetPriceLib.SetPriceProjectConfig))
62
- private _setPriceProjectConfigMapping;
63
-
64
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
65
- // STATE VARIABLES FOR SetPriceLib end here
66
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
67
-
68
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
69
- // STATE VARIABLES FOR SplitFundsLib begin here
70
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
71
-
72
- // contractAddress => IsEngineCache
73
- mapping(address => SplitFundsLib.IsEngineCache) private _isEngineCaches;
74
-
75
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
76
- // STATE VARIABLES FOR SplitFundsLib end here
77
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
78
-
79
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
80
- // STATE VARIABLES FOR MaxInvocationsLib begin here
81
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
82
-
83
- // contractAddress => projectId => max invocations specific project config
84
- mapping(address => mapping(uint256 => MaxInvocationsLib.MaxInvocationsProjectConfig))
85
- private _maxInvocationsProjectConfigMapping;
86
-
87
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
88
- // STATE VARIABLES FOR MaxInvocationsLib end here
89
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
90
-
91
65
  // MODIFIERS
92
66
  // @dev contract uses modifier-like internal functions instead of modifiers
93
67
  // to reduce contract bytecode size
@@ -95,171 +69,168 @@ contract MinterSetPriceV5 is
95
69
 
96
70
  /**
97
71
  * @notice Initializes contract to be a Filtered Minter for
98
- * `_minterFilter` minter filter.
99
- * @param _minterFilter Minter filter for which this will be a
72
+ * `minterFilter` minter filter.
73
+ * @param minterFilter Minter filter for which this will be a
100
74
  * filtered minter.
101
75
  */
102
- constructor(address _minterFilter) ReentrancyGuard() {
103
- minterFilterAddress = _minterFilter;
104
- minterFilter = IMinterFilterV1(_minterFilter);
76
+ constructor(address minterFilter) ReentrancyGuard() {
77
+ minterFilterAddress = minterFilter;
78
+ _minterFilter = IMinterFilterV1(minterFilter);
105
79
  }
106
80
 
107
81
  /**
108
- * @notice Manually sets the local maximum invocations of project `_projectId`
109
- * with the provided `_maxInvocations`, checking that `_maxInvocations` is less
110
- * than or equal to the value of project `_project_id`'s maximum invocations that is
82
+ * @notice Manually sets the local maximum invocations of project `projectId`
83
+ * with the provided `maxInvocations`, checking that `maxInvocations` is less
84
+ * than or equal to the value of project `project_id`'s maximum invocations that is
111
85
  * set on the core contract.
112
- * @dev Note that a `_maxInvocations` of 0 can only be set if the current `invocations`
86
+ * @dev Note that a `maxInvocations` of 0 can only be set if the current `invocations`
113
87
  * value is also 0 and this would also set `maxHasBeenInvoked` to true, correctly short-circuiting
114
88
  * this minter's purchase function, avoiding extra gas costs from the core contract's maxInvocations check.
115
- * @param _projectId Project ID to set the maximum invocations for.
116
- * @param _coreContract Core contract address for the given project.
117
- * @param _maxInvocations Maximum invocations to set for the project.
89
+ * @param projectId Project ID to set the maximum invocations for.
90
+ * @param coreContract Core contract address for the given project.
91
+ * @param maxInvocations Maximum invocations to set for the project.
118
92
  */
119
93
  function manuallyLimitProjectMaxInvocations(
120
- uint256 _projectId,
121
- address _coreContract,
122
- uint24 _maxInvocations
94
+ uint256 projectId,
95
+ address coreContract,
96
+ uint24 maxInvocations
123
97
  ) external {
124
98
  AuthLib.onlyArtist({
125
- _projectId: _projectId,
126
- _coreContract: _coreContract,
127
- _sender: msg.sender
99
+ projectId: projectId,
100
+ coreContract: coreContract,
101
+ sender: msg.sender
102
+ });
103
+ MaxInvocationsLib.manuallyLimitProjectMaxInvocations({
104
+ projectId: projectId,
105
+ coreContract: coreContract,
106
+ maxInvocations: maxInvocations
128
107
  });
129
- MaxInvocationsLib.manuallyLimitProjectMaxInvocations(
130
- _projectId,
131
- _coreContract,
132
- _maxInvocations,
133
- _maxInvocationsProjectConfigMapping[_coreContract][_projectId]
134
- );
135
- emit ProjectMaxInvocationsLimitUpdated(
136
- _projectId,
137
- _coreContract,
138
- _maxInvocations
139
- );
140
108
  }
141
109
 
142
110
  /**
143
- * @notice Updates this minter's price per token of project `_projectId`
111
+ * @notice Updates this minter's price per token of project `projectId`
144
112
  * to be '_pricePerTokenInWei`, in Wei.
145
113
  * @dev Note that it is intentionally supported here that the configured
146
114
  * price may be explicitly set to `0`.
147
- * @param _projectId Project ID to set the price per token for.
148
- * @param _coreContract Core contract address for the given project.
149
- * @param _pricePerTokenInWei Price per token to set for the project, in Wei.
115
+ * @param projectId Project ID to set the price per token for.
116
+ * @param coreContract Core contract address for the given project.
117
+ * @param pricePerTokenInWei Price per token to set for the project, in Wei.
150
118
  */
151
119
  function updatePricePerTokenInWei(
152
- uint256 _projectId,
153
- address _coreContract,
154
- uint248 _pricePerTokenInWei
120
+ uint256 projectId,
121
+ address coreContract,
122
+ uint248 pricePerTokenInWei
155
123
  ) external {
156
124
  AuthLib.onlyArtist({
157
- _projectId: _projectId,
158
- _coreContract: _coreContract,
159
- _sender: msg.sender
125
+ projectId: projectId,
126
+ coreContract: coreContract,
127
+ sender: msg.sender
128
+ });
129
+ SetPriceLib.updatePricePerToken({
130
+ projectId: projectId,
131
+ coreContract: coreContract,
132
+ pricePerToken: pricePerTokenInWei
160
133
  });
161
- SetPriceLib.SetPriceProjectConfig
162
- storage _setPriceProjectConfig = _setPriceProjectConfigMapping[
163
- _coreContract
164
- ][_projectId];
165
- SetPriceLib.updatePricePerTokenInWei(
166
- _pricePerTokenInWei,
167
- _setPriceProjectConfig
168
- );
169
- emit PricePerTokenInWeiUpdated(
170
- _projectId,
171
- _coreContract,
172
- _pricePerTokenInWei
173
- );
174
134
 
175
135
  // for convenience, sync local max invocations to the core contract if
176
136
  // and only if max invocations have not already been synced.
177
137
  // @dev do not sync if max invocations have already been synced, as
178
138
  // local max invocations could have been manually set to be
179
139
  // intentionally less than the core contract's max invocations.
180
- MaxInvocationsLib.MaxInvocationsProjectConfig
181
- storage _maxInvocationsProjectConfig = _maxInvocationsProjectConfigMapping[
182
- _coreContract
183
- ][_projectId];
184
140
  // @dev if local maxInvocations and maxHasBeenInvoked are both
185
141
  // initial values, we know they have not been populated on this minter
186
142
  if (
187
- MaxInvocationsLib.maxInvocationsIsUnconfigured(
188
- _maxInvocationsProjectConfig
189
- )
143
+ MaxInvocationsLib.maxInvocationsIsUnconfigured({
144
+ projectId: projectId,
145
+ coreContract: coreContract
146
+ })
190
147
  ) {
191
- syncProjectMaxInvocationsToCore(_projectId, _coreContract);
148
+ syncProjectMaxInvocationsToCore({
149
+ projectId: projectId,
150
+ coreContract: coreContract
151
+ });
192
152
  }
193
153
  }
194
154
 
195
155
  /**
196
- * @notice Purchases a token from project `_projectId`.
197
- * @param _projectId Project ID to mint a token on.
198
- * @param _coreContract Core contract address for the given project.
156
+ * @notice Purchases a token from project `projectId`.
157
+ * @param projectId Project ID to mint a token on.
158
+ * @param coreContract Core contract address for the given project.
199
159
  * @return tokenId Token ID of minted token
200
160
  */
201
161
  function purchase(
202
- uint256 _projectId,
203
- address _coreContract
162
+ uint256 projectId,
163
+ address coreContract
204
164
  ) external payable returns (uint256 tokenId) {
205
- tokenId = purchaseTo(msg.sender, _projectId, _coreContract);
165
+ tokenId = purchaseTo({
166
+ to: msg.sender,
167
+ projectId: projectId,
168
+ coreContract: coreContract
169
+ });
206
170
  return tokenId;
207
171
  }
208
172
 
209
173
  // public getter functions
210
174
  /**
211
175
  * @notice Gets the maximum invocations project configuration.
212
- * @param _projectId The ID of the project whose data needs to be fetched.
213
- * @param _coreContract The address of the core contract.
176
+ * @param projectId The ID of the project whose data needs to be fetched.
177
+ * @param coreContract The address of the core contract.
214
178
  * @return MaxInvocationsLib.MaxInvocationsProjectConfig instance with the
215
179
  * configuration data.
216
180
  */
217
181
  function maxInvocationsProjectConfig(
218
- uint256 _projectId,
219
- address _coreContract
182
+ uint256 projectId,
183
+ address coreContract
220
184
  )
221
185
  external
222
186
  view
223
187
  returns (MaxInvocationsLib.MaxInvocationsProjectConfig memory)
224
188
  {
225
- return _maxInvocationsProjectConfigMapping[_coreContract][_projectId];
189
+ return
190
+ MaxInvocationsLib.getMaxInvocationsProjectConfig({
191
+ projectId: projectId,
192
+ coreContract: coreContract
193
+ });
226
194
  }
227
195
 
228
196
  /**
229
197
  * @notice Gets the set price project configuration.
230
- * @param _projectId The ID of the project whose data needs to be fetched.
231
- * @param _coreContract The address of the core contract.
198
+ * @param projectId The ID of the project whose data needs to be fetched.
199
+ * @param coreContract The address of the core contract.
232
200
  * @return SetPriceProjectConfig struct with the fixed price project
233
201
  * configuration data.
234
202
  */
235
203
  function setPriceProjectConfig(
236
- uint256 _projectId,
237
- address _coreContract
204
+ uint256 projectId,
205
+ address coreContract
238
206
  ) external view returns (SetPriceLib.SetPriceProjectConfig memory) {
239
- return _setPriceProjectConfigMapping[_coreContract][_projectId];
207
+ return
208
+ SetPriceLib.getSetPriceProjectConfig({
209
+ projectId: projectId,
210
+ coreContract: coreContract
211
+ });
240
212
  }
241
213
 
242
214
  /**
243
- * @notice Checks if the specified `_coreContract` is a valid engine contract.
244
- * @dev This function retrieves the cached value of `_isEngine` from
215
+ * @notice Checks if the specified `coreContract` is a valid engine contract.
216
+ * @dev This function retrieves the cached value of `isEngine` from
245
217
  * the `isEngineCache` mapping. If the cached value is already set, it
246
- * returns the cached value. Otherwise, it calls the `getV3CoreIsEngine`
247
- * function from the `SplitFundsLib` library to check if `_coreContract`
218
+ * returns the cached value. Otherwise, it calls the `getV3CoreIsEngineView`
219
+ * function from the `SplitFundsLib` library to check if `coreContract`
248
220
  * is a valid engine contract.
249
- * @dev This function will revert if the provided `_coreContract` is not
221
+ * @dev This function will revert if the provided `coreContract` is not
250
222
  * a valid Engine or V3 Flagship contract.
251
- * @param _coreContract The address of the contract to check.
252
- * @return bool indicating if `_coreContract` is a valid engine contract.
223
+ * @param coreContract The address of the contract to check.
224
+ * @return bool indicating if `coreContract` is a valid engine contract.
253
225
  */
254
- function isEngineView(address _coreContract) external view returns (bool) {
255
- SplitFundsLib.IsEngineCache storage isEngineCache = _isEngineCaches[
256
- _coreContract
257
- ];
226
+ function isEngineView(address coreContract) external view returns (bool) {
227
+ SplitFundsLib.IsEngineCache storage isEngineCache = SplitFundsLib
228
+ .getIsEngineCacheConfig(coreContract);
258
229
  if (isEngineCache.isCached) {
259
230
  return isEngineCache.isEngine;
260
231
  } else {
261
- // @dev this calls the non-modifying variant of getV3CoreIsEngine
262
- return SplitFundsLib.getV3CoreIsEngineView(_coreContract);
232
+ // @dev this calls the non-state-modifying variant of isEngine
233
+ return SplitFundsLib.getV3CoreIsEngineView(coreContract);
263
234
  }
264
235
  }
265
236
 
@@ -274,17 +245,18 @@ contract MinterSetPriceV5 is
274
245
  * possible because the V3 core contract only allows maximum invocations
275
246
  * to be reduced, not increased. Based on this rationale, we intentionally
276
247
  * do not do input validation in this method as to whether or not the input
277
- * @param `_projectId` is an existing project ID.
278
- * @param `_coreContract` is an existing core contract address.
248
+ * @param projectId is an existing project ID.
249
+ * @param coreContract is an existing core contract address.
279
250
  */
280
251
  function projectMaxHasBeenInvoked(
281
- uint256 _projectId,
282
- address _coreContract
252
+ uint256 projectId,
253
+ address coreContract
283
254
  ) external view returns (bool) {
284
255
  return
285
- MaxInvocationsLib.getMaxHasBeenInvoked(
286
- _maxInvocationsProjectConfigMapping[_coreContract][_projectId]
287
- );
256
+ MaxInvocationsLib.getMaxHasBeenInvoked({
257
+ projectId: projectId,
258
+ coreContract: coreContract
259
+ });
288
260
  }
289
261
 
290
262
  /**
@@ -303,26 +275,27 @@ contract MinterSetPriceV5 is
303
275
  * increased. When this happens, the minter will enable minting, allowing
304
276
  * the core contract to enforce the max invocations check. Based on this
305
277
  * rationale, we intentionally do not do input validation in this method as
306
- * to whether or not the input `_projectId` is an existing project ID.
307
- * @param `_projectId` is an existing project ID.
308
- * @param `_coreContract` is an existing core contract address.
278
+ * to whether or not the input `projectId` is an existing project ID.
279
+ * @param projectId is an existing project ID.
280
+ * @param coreContract is an existing core contract address.
309
281
  */
310
282
  function projectMaxInvocations(
311
- uint256 _projectId,
312
- address _coreContract
283
+ uint256 projectId,
284
+ address coreContract
313
285
  ) external view returns (uint256) {
314
286
  return
315
- MaxInvocationsLib.getMaxInvocations(
316
- _maxInvocationsProjectConfigMapping[_coreContract][_projectId]
317
- );
287
+ MaxInvocationsLib.getMaxInvocations({
288
+ projectId: projectId,
289
+ coreContract: coreContract
290
+ });
318
291
  }
319
292
 
320
293
  /**
321
294
  * @notice Gets if price of token is configured, price of minting a
322
- * token on project `_projectId`, and currency symbol and address to be
295
+ * token on project `projectId`, and currency symbol and address to be
323
296
  * used as payment.
324
- * @param _projectId Project ID to get price information for
325
- * @param _coreContract Contract address of the core contract
297
+ * @param projectId Project ID to get price information for
298
+ * @param coreContract Contract address of the core contract
326
299
  * @return isConfigured true only if token price has been configured on
327
300
  * this minter
328
301
  * @return tokenPriceInWei current price of token on this minter - invalid
@@ -333,8 +306,8 @@ contract MinterSetPriceV5 is
333
306
  * this minter. This minter always returns null address, reserved for ether
334
307
  */
335
308
  function getPriceInfo(
336
- uint256 _projectId,
337
- address _coreContract
309
+ uint256 projectId,
310
+ address coreContract
338
311
  )
339
312
  external
340
313
  view
@@ -346,114 +319,94 @@ contract MinterSetPriceV5 is
346
319
  )
347
320
  {
348
321
  SetPriceLib.SetPriceProjectConfig
349
- storage _setPriceProjectConfig = _setPriceProjectConfigMapping[
350
- _coreContract
351
- ][_projectId];
352
- isConfigured = _setPriceProjectConfig.priceIsConfigured;
353
- tokenPriceInWei = _setPriceProjectConfig.pricePerTokenInWei;
322
+ storage setPriceProjectConfig_ = SetPriceLib
323
+ .getSetPriceProjectConfig({
324
+ projectId: projectId,
325
+ coreContract: coreContract
326
+ });
327
+ isConfigured = setPriceProjectConfig_.priceIsConfigured;
328
+ tokenPriceInWei = setPriceProjectConfig_.pricePerToken;
354
329
  currencySymbol = "ETH";
355
330
  currencyAddress = address(0);
356
331
  }
357
332
 
358
333
  /**
359
- * @notice Syncs local maximum invocations of project `_projectId` based on
334
+ * @notice Syncs local maximum invocations of project `projectId` based on
360
335
  * the value currently defined in the core contract.
361
- * @param _projectId Project ID to set the maximum invocations for.
362
- * @param _coreContract Core contract address for the given project.
336
+ * @param projectId Project ID to set the maximum invocations for.
337
+ * @param coreContract Core contract address for the given project.
363
338
  * @dev this enables gas reduction after maxInvocations have been reached -
364
339
  * core contracts shall still enforce a maxInvocation check during mint.
365
340
  */
366
341
  function syncProjectMaxInvocationsToCore(
367
- uint256 _projectId,
368
- address _coreContract
342
+ uint256 projectId,
343
+ address coreContract
369
344
  ) public {
370
345
  AuthLib.onlyArtist({
371
- _projectId: _projectId,
372
- _coreContract: _coreContract,
373
- _sender: msg.sender
346
+ projectId: projectId,
347
+ coreContract: coreContract,
348
+ sender: msg.sender
374
349
  });
375
350
 
376
- uint256 maxInvocations = MaxInvocationsLib
377
- .syncProjectMaxInvocationsToCore(
378
- _projectId,
379
- _coreContract,
380
- _maxInvocationsProjectConfigMapping[_coreContract][_projectId]
381
- );
382
- emit ProjectMaxInvocationsLimitUpdated(
383
- _projectId,
384
- _coreContract,
385
- maxInvocations
386
- );
351
+ MaxInvocationsLib.syncProjectMaxInvocationsToCore({
352
+ projectId: projectId,
353
+ coreContract: coreContract
354
+ });
387
355
  }
388
356
 
389
357
  /**
390
- * @notice Purchases a token from project `_projectId` and sets
391
- * the token's owner to `_to`.
392
- * @param _to Address to be the new token's owner.
393
- * @param _projectId Project ID to mint a token on.
394
- * @param _coreContract Core contract address for the given project.
358
+ * @notice Purchases a token from project `projectId` and sets
359
+ * the token's owner to `to`.
360
+ * @param to Address to be the new token's owner.
361
+ * @param projectId Project ID to mint a token on.
362
+ * @param coreContract Core contract address for the given project.
395
363
  * @return tokenId Token ID of minted token
396
364
  */
397
365
  function purchaseTo(
398
- address _to,
399
- uint256 _projectId,
400
- address _coreContract
366
+ address to,
367
+ uint256 projectId,
368
+ address coreContract
401
369
  ) public payable nonReentrant returns (uint256 tokenId) {
402
370
  // CHECKS
403
- SetPriceLib.SetPriceProjectConfig
404
- storage _setPriceProjectConfig = _setPriceProjectConfigMapping[
405
- _coreContract
406
- ][_projectId];
407
- MaxInvocationsLib.MaxInvocationsProjectConfig
408
- storage _maxInvocationsProjectConfig = _maxInvocationsProjectConfigMapping[
409
- _coreContract
410
- ][_projectId];
411
-
371
+ // pre-mint MaxInvocationsLib checks
412
372
  // Note that `maxHasBeenInvoked` is only checked here to reduce gas
413
373
  // consumption after a project has been fully minted.
414
- // `_maxInvocationsProjectConfig.maxHasBeenInvoked` is locally cached to reduce
374
+ // `maxInvocationsProjectConfig.maxHasBeenInvoked` is locally cached to reduce
415
375
  // gas consumption, but if not in sync with the core contract's value,
416
376
  // the core contract also enforces its own max invocation check during
417
377
  // minting.
418
- require(
419
- !_maxInvocationsProjectConfig.maxHasBeenInvoked,
420
- "Max invocations reached"
421
- );
422
-
423
- // require artist to have configured price of token on this minter
424
- require(
425
- _setPriceProjectConfig.priceIsConfigured,
426
- "Price not configured"
427
- );
378
+ MaxInvocationsLib.preMintChecks({
379
+ projectId: projectId,
380
+ coreContract: coreContract
381
+ });
428
382
 
429
- // load price of token into memory
430
- uint256 pricePerTokenInWei = _setPriceProjectConfig.pricePerTokenInWei;
383
+ // pre-mint checks for set price lib, and get price per token in wei
384
+ // @dev price per token is loaded into memory here for gas efficiency
385
+ uint256 pricePerTokenInWei = SetPriceLib.preMintChecksAndGetPrice({
386
+ projectId: projectId,
387
+ coreContract: coreContract
388
+ });
431
389
 
432
390
  require(msg.value >= pricePerTokenInWei, "Min value to mint req.");
433
391
 
434
392
  // EFFECTS
435
- tokenId = minterFilter.mint_joo(
436
- _to,
437
- _projectId,
438
- _coreContract,
439
- msg.sender
440
- );
393
+ tokenId = _minterFilter.mint_joo({
394
+ to: to,
395
+ projectId: projectId,
396
+ coreContract: coreContract,
397
+ sender: msg.sender
398
+ });
441
399
 
442
- MaxInvocationsLib.validatePurchaseEffectsInvocations(
443
- tokenId,
444
- _maxInvocationsProjectConfigMapping[_coreContract][_projectId]
445
- );
400
+ MaxInvocationsLib.validatePurchaseEffectsInvocations({
401
+ tokenId: tokenId,
402
+ coreContract: coreContract
403
+ });
446
404
 
447
405
  // INTERACTIONS
448
- bool isEngine = SplitFundsLib.isEngine(
449
- _coreContract,
450
- _isEngineCaches[_coreContract]
451
- );
452
- SplitFundsLib.splitFundsETH({
453
- _projectId: _projectId,
454
- _pricePerTokenInWei: pricePerTokenInWei,
455
- _coreContract: _coreContract,
456
- _isEngine: isEngine
406
+ SplitFundsLib.splitFundsETHRefundSender({
407
+ projectId: projectId,
408
+ pricePerTokenInWei: pricePerTokenInWei,
409
+ coreContract: coreContract
457
410
  });
458
411
 
459
412
  return tokenId;
@@ -5,7 +5,6 @@ pragma solidity 0.8.19;
5
5
 
6
6
  import "../interfaces/v0.8.x/IRandomizerV2.sol";
7
7
  import "../interfaces/v0.8.x/IAdminACLV0.sol";
8
- import "../interfaces/v0.8.x/IEngineRegistryV0.sol";
9
8
  import "../interfaces/v0.8.x/IGenArt721CoreContractV3_Engine.sol";
10
9
  import "../interfaces/v0.8.x/IDependencyRegistryCompatibleV0.sol";
11
10
  import "../interfaces/v0.8.x/IManifold.sol";
@@ -310,8 +309,7 @@ contract GenArt721CoreV3_Engine_IncorrectCoreType is
310
309
  address _randomizerContract,
311
310
  address _adminACLContract,
312
311
  uint248 _startingProjectId,
313
- bool _autoApproveArtistSplitProposals,
314
- address _engineRegistryContract
312
+ bool _autoApproveArtistSplitProposals
315
313
  )
316
314
  ERC721_PackedHashSeed(_tokenName, _tokenSymbol)
317
315
  onlyNonZeroAddress(_renderProviderAddress)
@@ -343,13 +341,8 @@ contract GenArt721CoreV3_Engine_IncorrectCoreType is
343
341
  );
344
342
  // initialize next project ID
345
343
  _nextProjectId = _startingProjectId;
346
- // emit PlatformUpdated(FIELD_NEXT_PROJECT_ID);
347
- // register contract as an Engine contract
348
- IEngineRegistryV0(_engineRegistryContract).registerContract(
349
- address(this),
350
- CORE_VERSION,
351
- CORE_TYPE
352
- );
344
+ // @dev follow-on action: This contract does not self-register. A core
345
+ // registry owner must register contract in a subsequent call.
353
346
  }
354
347
 
355
348
  /**