@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,21 +1,23 @@
1
1
  // SPDX-License-Identifier: LGPL-3.0-only
2
2
  // Created By: Art Blocks Inc.
3
3
 
4
- import "../../interfaces/v0.8.x/IDelegationRegistry.sol";
5
- import "../../interfaces/v0.8.x/ISharedMinterV0.sol";
6
- import "../../interfaces/v0.8.x/ISharedMinterHolderV0.sol";
7
- 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;
8
7
 
9
- import "../../libs/v0.8.x/AuthLib.sol";
10
- import "../../libs/v0.8.x/minter-libs/SplitFundsLib.sol";
11
- import "../../libs/v0.8.x/minter-libs/MaxInvocationsLib.sol";
12
- import "../../libs/v0.8.x/minter-libs/TokenHolderLib.sol";
13
- import "../../libs/v0.8.x/minter-libs/SetPriceLib.sol";
8
+ import {IDelegationRegistry} from "../../interfaces/v0.8.x/IDelegationRegistry.sol";
9
+ import {ISharedMinterV0} from "../../interfaces/v0.8.x/ISharedMinterV0.sol";
10
+ import {ISharedMinterHolderV0} from "../../interfaces/v0.8.x/ISharedMinterHolderV0.sol";
11
+ import {IMinterFilterV1} from "../../interfaces/v0.8.x/IMinterFilterV1.sol";
14
12
 
15
- import "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
16
- import "@openzeppelin-4.5/contracts/utils/structs/EnumerableSet.sol";
13
+ import {AuthLib} from "../../libs/v0.8.x/AuthLib.sol";
14
+ import {SplitFundsLib} from "../../libs/v0.8.x/minter-libs/SplitFundsLib.sol";
15
+ import {MaxInvocationsLib} from "../../libs/v0.8.x/minter-libs/MaxInvocationsLib.sol";
16
+ import {TokenHolderLib} from "../../libs/v0.8.x/minter-libs/TokenHolderLib.sol";
17
+ import {SetPriceLib} from "../../libs/v0.8.x/minter-libs/SetPriceLib.sol";
17
18
 
18
- pragma solidity 0.8.19;
19
+ import {ReentrancyGuard} from "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
20
+ import {EnumerableSet} from "@openzeppelin-4.5/contracts/utils/structs/EnumerableSet.sol";
19
21
 
20
22
  /**
21
23
  * @title Shared, filtered Minter contract that allows tokens to be minted with
@@ -59,6 +61,13 @@ pragma solidity 0.8.19;
59
61
  * delegation types include token-level, contract-level (via genArt721CoreAddress), or
60
62
  * wallet-level delegation. Contract-level delegations must be configured for the core
61
63
  * token contract as returned by the public immutable variable `genArt721CoreAddress`.
64
+ * ----------------------------------------------------------------------------
65
+ * @notice Caution: While Engine projects must be registered on the Art Blocks
66
+ * Core Registry to assign this minter, this minter does not enforce that a
67
+ * project is registered when configured or queried. This is primarily for gas
68
+ * optimization purposes. It is, therefore, possible that fake projects may be
69
+ * configured on this minter, but they will not be able to mint tokens due to
70
+ * checks performed by this minter's Minter Filter.
62
71
  */
63
72
  contract MinterSetPriceHolderV5 is
64
73
  ReentrancyGuard,
@@ -72,13 +81,13 @@ contract MinterSetPriceHolderV5 is
72
81
  address public immutable minterFilterAddress;
73
82
 
74
83
  /// Minter filter this minter may interact with.
75
- IMinterFilterV1 private immutable minterFilter;
84
+ IMinterFilterV1 private immutable _minterFilter;
76
85
 
77
86
  /// Delegation registry address
78
87
  address public immutable delegationRegistryAddress;
79
88
 
80
89
  /// Delegation registry address
81
- IDelegationRegistry private immutable delegationRegistryContract;
90
+ IDelegationRegistry private immutable _delegationRegistryContract;
82
91
 
83
92
  /// minterType for this minter
84
93
  string public constant minterType = "MinterSetPriceHolderV5";
@@ -86,56 +95,6 @@ contract MinterSetPriceHolderV5 is
86
95
  /// minter version for this minter
87
96
  string public constant minterVersion = "v5.0.0";
88
97
 
89
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
90
- // STATE VARIABLES FOR SetPriceLib begin here
91
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
92
-
93
- /// contractAddress => projectId => set price project config
94
- mapping(address => mapping(uint256 => SetPriceLib.SetPriceProjectConfig))
95
- private _setPriceProjectConfigMapping;
96
-
97
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
98
- // STATE VARIABLES FOR SetPriceLib end here
99
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
100
-
101
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
102
- // STATE VARIABLES FOR SplitFundsLib begin here
103
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
104
-
105
- // contractAddress => IsEngineCache
106
- mapping(address => SplitFundsLib.IsEngineCache) private _isEngineCaches;
107
-
108
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
109
- // STATE VARIABLES FOR SplitFundsLib end here
110
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
111
-
112
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
113
- // STATE VARIABLES FOR MaxInvocationsLib begin here
114
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
115
-
116
- // contractAddress => projectId => max invocations specific project config
117
- mapping(address => mapping(uint256 => MaxInvocationsLib.MaxInvocationsProjectConfig))
118
- private _maxInvocationsProjectConfigMapping;
119
-
120
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
121
- // STATE VARIABLES FOR MaxInvocationsLib end here
122
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
123
-
124
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
125
- // STATE VARIABLES FOR TokenHolderLib begin here
126
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
127
-
128
- /**
129
- * coreContract => projectId => ownedNFTAddress => ownedNFTProjectIds => bool
130
- * projects whose holders are allowed to purchase a token on `projectId`
131
- */
132
- mapping(address => mapping(uint256 => TokenHolderLib.HolderProjectConfig))
133
- private _allowedProjectHoldersMapping;
134
-
135
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
136
- // STATE VARIABLES FOR TokenHolderLib end here
137
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
138
-
139
98
  // MODIFIERS
140
99
  // @dev contract uses modifier-like internal functions instead of modifiers
141
100
  // to reduce contract bytecode size
@@ -143,429 +102,393 @@ contract MinterSetPriceHolderV5 is
143
102
 
144
103
  /**
145
104
  * @notice Initializes contract to be a Filtered Minter for
146
- * `_minterFilter` minter filter.
147
- * @param _minterFilter Minter filter for which this will be a
105
+ * `minterFilter` minter filter.
106
+ * @param minterFilter Minter filter for which this will be a
148
107
  * filtered minter.
149
- * @param _delegationRegistryAddress Delegation registry contract address.
108
+ * @param delegationRegistryAddress_ Delegation registry contract address.
150
109
  */
151
110
  constructor(
152
- address _minterFilter,
153
- address _delegationRegistryAddress
111
+ address minterFilter,
112
+ address delegationRegistryAddress_
154
113
  ) ReentrancyGuard() {
155
- minterFilterAddress = _minterFilter;
156
- minterFilter = IMinterFilterV1(_minterFilter);
114
+ minterFilterAddress = minterFilter;
115
+ _minterFilter = IMinterFilterV1(minterFilter);
157
116
 
158
- delegationRegistryAddress = _delegationRegistryAddress;
159
- delegationRegistryContract = IDelegationRegistry(
160
- _delegationRegistryAddress
117
+ delegationRegistryAddress = delegationRegistryAddress_;
118
+ _delegationRegistryContract = IDelegationRegistry(
119
+ delegationRegistryAddress_
120
+ );
121
+ emit TokenHolderLib.DelegationRegistryUpdated(
122
+ delegationRegistryAddress_
161
123
  );
162
- emit DelegationRegistryUpdated(_delegationRegistryAddress);
163
124
  }
164
125
 
165
126
  /**
166
- * @notice Manually sets the local maximum invocations of project `_projectId`
167
- * with the provided `_maxInvocations`, checking that `_maxInvocations` is less
168
- * than or equal to the value of project `_project_id`'s maximum invocations that is
127
+ * @notice Manually sets the local maximum invocations of project `projectId`
128
+ * with the provided `maxInvocations`, checking that `maxInvocations` is less
129
+ * than or equal to the value of project `project_id`'s maximum invocations that is
169
130
  * set on the core contract.
170
- * @dev Note that a `_maxInvocations` of 0 can only be set if the current `invocations`
131
+ * @dev Note that a `maxInvocations` of 0 can only be set if the current `invocations`
171
132
  * value is also 0 and this would also set `maxHasBeenInvoked` to true, correctly short-circuiting
172
133
  * this minter's purchase function, avoiding extra gas costs from the core contract's maxInvocations check.
173
- * @param _projectId Project ID to set the maximum invocations for.
174
- * @param _coreContract Core contract address for the given project.
175
- * @param _maxInvocations Maximum invocations to set for the project.
134
+ * @param projectId Project ID to set the maximum invocations for.
135
+ * @param coreContract Core contract address for the given project.
136
+ * @param maxInvocations Maximum invocations to set for the project.
176
137
  */
177
138
  function manuallyLimitProjectMaxInvocations(
178
- uint256 _projectId,
179
- address _coreContract,
180
- uint24 _maxInvocations
139
+ uint256 projectId,
140
+ address coreContract,
141
+ uint24 maxInvocations
181
142
  ) external {
182
143
  AuthLib.onlyArtist({
183
- _projectId: _projectId,
184
- _coreContract: _coreContract,
185
- _sender: msg.sender
144
+ projectId: projectId,
145
+ coreContract: coreContract,
146
+ sender: msg.sender
147
+ });
148
+ MaxInvocationsLib.manuallyLimitProjectMaxInvocations({
149
+ projectId: projectId,
150
+ coreContract: coreContract,
151
+ maxInvocations: maxInvocations
186
152
  });
187
- MaxInvocationsLib.manuallyLimitProjectMaxInvocations(
188
- _projectId,
189
- _coreContract,
190
- _maxInvocations,
191
- _maxInvocationsProjectConfigMapping[_coreContract][_projectId]
192
- );
193
- emit ProjectMaxInvocationsLimitUpdated(
194
- _projectId,
195
- _coreContract,
196
- _maxInvocations
197
- );
198
153
  }
199
154
 
200
155
  /**
201
- * @notice Updates this minter's price per token of project `_projectId`
156
+ * @notice Updates this minter's price per token of project `projectId`
202
157
  * to be '_pricePerTokenInWei`, in Wei.
203
158
  * @dev Note that it is intentionally supported here that the configured
204
159
  * price may be explicitly set to `0`.
205
- * @param _projectId Project ID to set the price per token for.
206
- * @param _coreContract Core contract address for the given project.
207
- * @param _pricePerTokenInWei Price per token to set for the project, in Wei.
160
+ * @param projectId Project ID to set the price per token for.
161
+ * @param coreContract Core contract address for the given project.
162
+ * @param pricePerTokenInWei Price per token to set for the project, in Wei.
208
163
  */
209
164
  function updatePricePerTokenInWei(
210
- uint256 _projectId,
211
- address _coreContract,
212
- uint248 _pricePerTokenInWei
165
+ uint256 projectId,
166
+ address coreContract,
167
+ uint248 pricePerTokenInWei
213
168
  ) external {
214
169
  AuthLib.onlyArtist({
215
- _projectId: _projectId,
216
- _coreContract: _coreContract,
217
- _sender: msg.sender
170
+ projectId: projectId,
171
+ coreContract: coreContract,
172
+ sender: msg.sender
173
+ });
174
+ SetPriceLib.updatePricePerToken({
175
+ projectId: projectId,
176
+ coreContract: coreContract,
177
+ pricePerToken: pricePerTokenInWei
218
178
  });
219
- SetPriceLib.SetPriceProjectConfig
220
- storage _setPriceProjectConfig = _setPriceProjectConfigMapping[
221
- _coreContract
222
- ][_projectId];
223
- SetPriceLib.updatePricePerTokenInWei(
224
- _pricePerTokenInWei,
225
- _setPriceProjectConfig
226
- );
227
- emit PricePerTokenInWeiUpdated(
228
- _projectId,
229
- _coreContract,
230
- _pricePerTokenInWei
231
- );
232
179
 
233
180
  // for convenience, sync local max invocations to the core contract if
234
181
  // and only if max invocations have not already been synced.
235
182
  // @dev do not sync if max invocations have already been synced, as
236
183
  // local max invocations could have been manually set to be
237
184
  // intentionally less than the core contract's max invocations.
238
- MaxInvocationsLib.MaxInvocationsProjectConfig
239
- storage _maxInvocationsProjectConfig = _maxInvocationsProjectConfigMapping[
240
- _coreContract
241
- ][_projectId];
242
185
  // @dev if local maxInvocations and maxHasBeenInvoked are both
243
186
  // initial values, we know they have not been populated on this minter
244
187
  if (
245
- MaxInvocationsLib.maxInvocationsIsUnconfigured(
246
- _maxInvocationsProjectConfig
247
- )
188
+ MaxInvocationsLib.maxInvocationsIsUnconfigured({
189
+ projectId: projectId,
190
+ coreContract: coreContract
191
+ })
248
192
  ) {
249
- syncProjectMaxInvocationsToCore(_projectId, _coreContract);
193
+ syncProjectMaxInvocationsToCore({
194
+ projectId: projectId,
195
+ coreContract: coreContract
196
+ });
250
197
  }
251
198
  }
252
199
 
253
200
  /**
254
- * @notice Allows holders of NFTs at addresses `_ownedNFTAddresses`,
255
- * project IDs `_ownedNFTProjectIds` to mint on project `_projectId`.
256
- * `_ownedNFTAddresses` assumed to be aligned with `_ownedNFTProjectIds`.
257
- * e.g. Allows holders of project `_ownedNFTProjectIds[0]` on token
258
- * contract `_ownedNFTAddresses[0]` to mint `_projectId`.
201
+ * @notice Allows holders of NFTs at addresses `ownedNFTAddresses`,
202
+ * project IDs `ownedNFTProjectIds` to mint on project `projectId`.
203
+ * `ownedNFTAddresses` assumed to be aligned with `ownedNFTProjectIds`.
204
+ * e.g. Allows holders of project `ownedNFTProjectIds[0]` on token
205
+ * contract `ownedNFTAddresses[0]` to mint `projectId`.
259
206
  * WARNING: Only Art Blocks Core contracts are compatible with holder allowlisting,
260
207
  * due to assumptions about tokenId and projectId relationships.
261
- * @param _projectId Project ID to enable minting on.
262
- * @param _coreContract Core contract address for the given project.
263
- * @param _ownedNFTAddresses NFT core addresses of projects to be
264
- * allowlisted. Indexes must align with `_ownedNFTProjectIds`.
265
- * @param _ownedNFTProjectIds Project IDs on `_ownedNFTAddresses` whose
266
- * holders shall be allowlisted to mint project `_projectId`. Indexes must
267
- * align with `_ownedNFTAddresses`.
208
+ * @param projectId Project ID to enable minting on.
209
+ * @param coreContract Core contract address for the given project.
210
+ * @param ownedNFTAddresses NFT core addresses of projects to be
211
+ * allowlisted. Indexes must align with `ownedNFTProjectIds`.
212
+ * @param ownedNFTProjectIds Project IDs on `ownedNFTAddresses` whose
213
+ * holders shall be allowlisted to mint project `projectId`. Indexes must
214
+ * align with `ownedNFTAddresses`.
268
215
  */
269
216
  function allowHoldersOfProjects(
270
- uint256 _projectId,
271
- address _coreContract,
272
- address[] memory _ownedNFTAddresses,
273
- uint256[] memory _ownedNFTProjectIds
217
+ uint256 projectId,
218
+ address coreContract,
219
+ address[] calldata ownedNFTAddresses,
220
+ uint256[] calldata ownedNFTProjectIds
274
221
  ) external {
275
222
  AuthLib.onlyArtist({
276
- _projectId: _projectId,
277
- _coreContract: _coreContract,
278
- _sender: msg.sender
223
+ projectId: projectId,
224
+ coreContract: coreContract,
225
+ sender: msg.sender
279
226
  });
280
227
  TokenHolderLib.allowHoldersOfProjects({
281
- holderProjectConfig: _allowedProjectHoldersMapping[_coreContract][
282
- _projectId
283
- ],
284
- _ownedNFTAddresses: _ownedNFTAddresses,
285
- _ownedNFTProjectIds: _ownedNFTProjectIds
228
+ projectId: projectId,
229
+ coreContract: coreContract,
230
+ ownedNFTAddresses: ownedNFTAddresses,
231
+ ownedNFTProjectIds: ownedNFTProjectIds
286
232
  });
287
-
288
- // emit approve event
289
- emit AllowedHoldersOfProjects(
290
- _projectId,
291
- _coreContract,
292
- _ownedNFTAddresses,
293
- _ownedNFTProjectIds
294
- );
295
233
  }
296
234
 
297
235
  /**
298
- * @notice Removes holders of NFTs at addresses `_ownedNFTAddresses`,
299
- * project IDs `_ownedNFTProjectIds` to mint on project `_projectId`. If
236
+ * @notice Removes holders of NFTs at addresses `ownedNFTAddresses`,
237
+ * project IDs `ownedNFTProjectIds` to mint on project `projectId`. If
300
238
  * other projects owned by a holder are still allowed to mint, holder will
301
239
  * maintain ability to purchase.
302
- * `_ownedNFTAddresses` assumed to be aligned with `_ownedNFTProjectIds`.
303
- * e.g. Removes holders of project `_ownedNFTProjectIds[0]` on token
304
- * contract `_ownedNFTAddresses[0]` from mint allowlist of `_projectId`.
305
- * @param _projectId Project ID to enable minting on.
306
- * @param _coreContract Core contract address for the given project.
307
- * @param _ownedNFTAddresses NFT core addresses of projects to be removed
308
- * from allowlist. Indexes must align with `_ownedNFTProjectIds`.
309
- * @param _ownedNFTProjectIds Project IDs on `_ownedNFTAddresses` whose
310
- * holders will be removed from allowlist to mint project `_projectId`.
311
- * Indexes must align with `_ownedNFTAddresses`.
240
+ * `ownedNFTAddresses` assumed to be aligned with `ownedNFTProjectIds`.
241
+ * e.g. Removes holders of project `ownedNFTProjectIds[0]` on token
242
+ * contract `ownedNFTAddresses[0]` from mint allowlist of `projectId`.
243
+ * @param projectId Project ID to enable minting on.
244
+ * @param coreContract Core contract address for the given project.
245
+ * @param ownedNFTAddresses NFT core addresses of projects to be removed
246
+ * from allowlist. Indexes must align with `ownedNFTProjectIds`.
247
+ * @param ownedNFTProjectIds Project IDs on `ownedNFTAddresses` whose
248
+ * holders will be removed from allowlist to mint project `projectId`.
249
+ * Indexes must align with `ownedNFTAddresses`.
312
250
  */
313
251
  function removeHoldersOfProjects(
314
- uint256 _projectId,
315
- address _coreContract,
316
- address[] memory _ownedNFTAddresses,
317
- uint256[] memory _ownedNFTProjectIds
252
+ uint256 projectId,
253
+ address coreContract,
254
+ address[] calldata ownedNFTAddresses,
255
+ uint256[] calldata ownedNFTProjectIds
318
256
  ) external {
319
257
  AuthLib.onlyArtist({
320
- _projectId: _projectId,
321
- _coreContract: _coreContract,
322
- _sender: msg.sender
258
+ projectId: projectId,
259
+ coreContract: coreContract,
260
+ sender: msg.sender
323
261
  });
324
- // require same length arrays
325
262
  TokenHolderLib.removeHoldersOfProjects({
326
- holderProjectConfig: _allowedProjectHoldersMapping[_coreContract][
327
- _projectId
328
- ],
329
- _ownedNFTAddresses: _ownedNFTAddresses,
330
- _ownedNFTProjectIds: _ownedNFTProjectIds
263
+ projectId: projectId,
264
+ coreContract: coreContract,
265
+ ownedNFTAddresses: ownedNFTAddresses,
266
+ ownedNFTProjectIds: ownedNFTProjectIds
331
267
  });
332
-
333
- // emit removed event
334
- emit RemovedHoldersOfProjects(
335
- _projectId,
336
- _coreContract,
337
- _ownedNFTAddresses,
338
- _ownedNFTProjectIds
339
- );
340
268
  }
341
269
 
342
270
  /**
343
- * @notice Allows holders of NFTs at addresses `_ownedNFTAddressesAdd`,
344
- * project IDs `_ownedNFTProjectIdsAdd` to mint on project `_projectId`.
345
- * Also removes holders of NFTs at addresses `_ownedNFTAddressesRemove`,
346
- * project IDs `_ownedNFTProjectIdsRemove` from minting on project
347
- * `_projectId`.
348
- * `_ownedNFTAddressesAdd` assumed to be aligned with
349
- * `_ownedNFTProjectIdsAdd`.
350
- * e.g. Allows holders of project `_ownedNFTProjectIdsAdd[0]` on token
351
- * contract `_ownedNFTAddressesAdd[0]` to mint `_projectId`.
352
- * `_ownedNFTAddressesRemove` also assumed to be aligned with
353
- * `_ownedNFTProjectIdsRemove`.
271
+ * @notice Allows holders of NFTs at addresses `ownedNFTAddressesAdd`,
272
+ * project IDs `ownedNFTProjectIdsAdd` to mint on project `projectId`.
273
+ * Also removes holders of NFTs at addresses `ownedNFTAddressesRemove`,
274
+ * project IDs `ownedNFTProjectIdsRemove` from minting on project
275
+ * `projectId`.
276
+ * `ownedNFTAddressesAdd` assumed to be aligned with
277
+ * `ownedNFTProjectIdsAdd`.
278
+ * e.g. Allows holders of project `ownedNFTProjectIdsAdd[0]` on token
279
+ * contract `ownedNFTAddressesAdd[0]` to mint `projectId`.
280
+ * `ownedNFTAddressesRemove` also assumed to be aligned with
281
+ * `ownedNFTProjectIdsRemove`.
354
282
  * WARNING: Only Art Blocks Core contracts are compatible with holder allowlisting,
355
283
  * due to assumptions about tokenId and projectId relationships.
356
- * @param _projectId Project ID to enable minting on.
357
- * @param _coreContract Core contract address for the given project.
358
- * @param _ownedNFTAddressesAdd NFT core addresses of projects to be
359
- * allowlisted. Indexes must align with `_ownedNFTProjectIdsAdd`.
360
- * @param _ownedNFTProjectIdsAdd Project IDs on `_ownedNFTAddressesAdd`
361
- * whose holders shall be allowlisted to mint project `_projectId`. Indexes
362
- * must align with `_ownedNFTAddressesAdd`.
363
- * @param _ownedNFTAddressesRemove NFT core addresses of projects to be
284
+ * @param projectId Project ID to enable minting on.
285
+ * @param coreContract Core contract address for the given project.
286
+ * @param ownedNFTAddressesAdd NFT core addresses of projects to be
287
+ * allowlisted. Indexes must align with `ownedNFTProjectIdsAdd`.
288
+ * @param ownedNFTProjectIdsAdd Project IDs on `ownedNFTAddressesAdd`
289
+ * whose holders shall be allowlisted to mint project `projectId`. Indexes
290
+ * must align with `ownedNFTAddressesAdd`.
291
+ * @param ownedNFTAddressesRemove NFT core addresses of projects to be
364
292
  * removed from allowlist. Indexes must align with
365
- * `_ownedNFTProjectIdsRemove`.
366
- * @param _ownedNFTProjectIdsRemove Project IDs on
367
- * `_ownedNFTAddressesRemove` whose holders will be removed from allowlist
368
- * to mint project `_projectId`. Indexes must align with
369
- * `_ownedNFTAddressesRemove`.
293
+ * `ownedNFTProjectIdsRemove`.
294
+ * @param ownedNFTProjectIdsRemove Project IDs on
295
+ * `ownedNFTAddressesRemove` whose holders will be removed from allowlist
296
+ * to mint project `projectId`. Indexes must align with
297
+ * `ownedNFTAddressesRemove`.
370
298
  * @dev if a project is included in both add and remove arrays, it will be
371
299
  * removed.
372
300
  */
373
301
  function allowAndRemoveHoldersOfProjects(
374
- uint256 _projectId,
375
- address _coreContract,
376
- address[] memory _ownedNFTAddressesAdd,
377
- uint256[] memory _ownedNFTProjectIdsAdd,
378
- address[] memory _ownedNFTAddressesRemove,
379
- uint256[] memory _ownedNFTProjectIdsRemove
302
+ uint256 projectId,
303
+ address coreContract,
304
+ address[] calldata ownedNFTAddressesAdd,
305
+ uint256[] calldata ownedNFTProjectIdsAdd,
306
+ address[] calldata ownedNFTAddressesRemove,
307
+ uint256[] calldata ownedNFTProjectIdsRemove
380
308
  ) external {
381
309
  AuthLib.onlyArtist({
382
- _projectId: _projectId,
383
- _coreContract: _coreContract,
384
- _sender: msg.sender
310
+ projectId: projectId,
311
+ coreContract: coreContract,
312
+ sender: msg.sender
385
313
  });
386
314
  TokenHolderLib.allowAndRemoveHoldersOfProjects({
387
- holderProjectConfig: _allowedProjectHoldersMapping[_coreContract][
388
- _projectId
389
- ],
390
- _ownedNFTAddressesAdd: _ownedNFTAddressesAdd,
391
- _ownedNFTProjectIdsAdd: _ownedNFTProjectIdsAdd,
392
- _ownedNFTAddressesRemove: _ownedNFTAddressesRemove,
393
- _ownedNFTProjectIdsRemove: _ownedNFTProjectIdsRemove
315
+ projectId: projectId,
316
+ coreContract: coreContract,
317
+ ownedNFTAddressesAdd: ownedNFTAddressesAdd,
318
+ ownedNFTProjectIdsAdd: ownedNFTProjectIdsAdd,
319
+ ownedNFTAddressesRemove: ownedNFTAddressesRemove,
320
+ ownedNFTProjectIdsRemove: ownedNFTProjectIdsRemove
394
321
  });
395
-
396
- // emit events
397
- emit AllowedHoldersOfProjects(
398
- _projectId,
399
- _coreContract,
400
- _ownedNFTAddressesAdd,
401
- _ownedNFTProjectIdsAdd
402
- );
403
- emit RemovedHoldersOfProjects(
404
- _projectId,
405
- _coreContract,
406
- _ownedNFTAddressesRemove,
407
- _ownedNFTProjectIdsRemove
408
- );
409
322
  }
410
323
 
411
324
  /**
412
- * @notice Purchases a token from project `_projectId`.
413
- * @param _projectId Project ID to mint a token on.
414
- * @param _coreContract Core contract address for the given project.
415
- * @param _ownedNFTAddress ERC-721 NFT address holding the project token
325
+ * @notice Purchases a token from project `projectId`.
326
+ * @param projectId Project ID to mint a token on.
327
+ * @param coreContract Core contract address for the given project.
328
+ * @param ownedNFTAddress ERC-721 NFT address holding the project token
416
329
  * owned by msg.sender being used to prove right to purchase.
417
- * @param _ownedNFTTokenId ERC-721 NFT token ID owned by msg.sender being used
330
+ * @param ownedNFTTokenId ERC-721 NFT token ID owned by msg.sender being used
418
331
  * to prove right to purchase.
419
332
  * @return tokenId Token ID of minted token
420
333
  */
421
334
  function purchase(
422
- uint256 _projectId,
423
- address _coreContract,
424
- address _ownedNFTAddress,
425
- uint256 _ownedNFTTokenId
335
+ uint256 projectId,
336
+ address coreContract,
337
+ address ownedNFTAddress,
338
+ uint256 ownedNFTTokenId
426
339
  ) external payable returns (uint256 tokenId) {
427
- tokenId = purchaseTo(
428
- msg.sender,
429
- _projectId,
430
- _coreContract,
431
- _ownedNFTAddress,
432
- _ownedNFTTokenId,
433
- address(0)
434
- );
340
+ tokenId = purchaseTo({
341
+ to: msg.sender,
342
+ projectId: projectId,
343
+ coreContract: coreContract,
344
+ ownedNFTAddress: ownedNFTAddress,
345
+ ownedNFTTokenId: ownedNFTTokenId,
346
+ vault: address(0)
347
+ });
435
348
  return tokenId;
436
349
  }
437
350
 
438
351
  /**
439
- * @notice Purchases a token from project `_projectId` and sets
440
- * the token's owner to `_to`.
441
- * @param _to Address to be the new token's owner.
442
- * @param _projectId Project ID to mint a token on.
443
- * @param _coreContract Core contract address for the given project.
444
- * @param _ownedNFTAddress ERC-721 NFT holding the project token owned by
352
+ * @notice Purchases a token from project `projectId` and sets
353
+ * the token's owner to `to`.
354
+ * @param to Address to be the new token's owner.
355
+ * @param projectId Project ID to mint a token on.
356
+ * @param coreContract Core contract address for the given project.
357
+ * @param ownedNFTAddress ERC-721 NFT holding the project token owned by
445
358
  * msg.sender being used to claim right to purchase.
446
- * @param _ownedNFTTokenId ERC-721 NFT token ID owned by msg.sender being used
359
+ * @param ownedNFTTokenId ERC-721 NFT token ID owned by msg.sender being used
447
360
  * to claim right to purchase.
448
361
  * @return tokenId Token ID of minted token
449
362
  */
450
363
  function purchaseTo(
451
- address _to,
452
- uint256 _projectId,
453
- address _coreContract,
454
- address _ownedNFTAddress,
455
- uint256 _ownedNFTTokenId
364
+ address to,
365
+ uint256 projectId,
366
+ address coreContract,
367
+ address ownedNFTAddress,
368
+ uint256 ownedNFTTokenId
456
369
  ) external payable returns (uint256 tokenId) {
457
370
  return
458
- purchaseTo(
459
- _to,
460
- _projectId,
461
- _coreContract,
462
- _ownedNFTAddress,
463
- _ownedNFTTokenId,
464
- address(0)
465
- );
371
+ purchaseTo({
372
+ to: to,
373
+ projectId: projectId,
374
+ coreContract: coreContract,
375
+ ownedNFTAddress: ownedNFTAddress,
376
+ ownedNFTTokenId: ownedNFTTokenId,
377
+ vault: address(0)
378
+ });
466
379
  }
467
380
 
468
381
  // public getter functions
469
382
  /**
470
383
  * @notice Gets the maximum invocations project configuration.
471
- * @param _projectId The ID of the project whose data needs to be fetched.
472
- * @param _coreContract The address of the core contract.
384
+ * @param projectId The ID of the project whose data needs to be fetched.
385
+ * @param coreContract The address of the core contract.
473
386
  * @return MaxInvocationsLib.MaxInvocationsProjectConfig instance with the
474
387
  * configuration data.
475
388
  */
476
389
  function maxInvocationsProjectConfig(
477
- uint256 _projectId,
478
- address _coreContract
390
+ uint256 projectId,
391
+ address coreContract
479
392
  )
480
393
  external
481
394
  view
482
395
  returns (MaxInvocationsLib.MaxInvocationsProjectConfig memory)
483
396
  {
484
- return _maxInvocationsProjectConfigMapping[_coreContract][_projectId];
397
+ return
398
+ MaxInvocationsLib.getMaxInvocationsProjectConfig({
399
+ projectId: projectId,
400
+ coreContract: coreContract
401
+ });
485
402
  }
486
403
 
487
404
  /**
488
405
  * @notice Gets the set price project configuration.
489
- * @param _projectId The ID of the project whose data needs to be fetched.
490
- * @param _coreContract The address of the core contract.
406
+ * @param projectId The ID of the project whose data needs to be fetched.
407
+ * @param coreContract The address of the core contract.
491
408
  * @return SetPriceProjectConfig struct with the fixed price project
492
409
  * configuration data.
493
410
  */
494
411
  function setPriceProjectConfig(
495
- uint256 _projectId,
496
- address _coreContract
412
+ uint256 projectId,
413
+ address coreContract
497
414
  ) external view returns (SetPriceLib.SetPriceProjectConfig memory) {
498
- return _setPriceProjectConfigMapping[_coreContract][_projectId];
415
+ return
416
+ SetPriceLib.getSetPriceProjectConfig({
417
+ projectId: projectId,
418
+ coreContract: coreContract
419
+ });
499
420
  }
500
421
 
501
422
  /**
502
423
  * @notice Checks if a specific NFT owner is allowed in a given project.
503
424
  * @dev This function retrieves the allowance status of an NFT owner
504
425
  * within a specific project from the allowedProjectHoldersMapping.
505
- * @param _projectId The ID of the project to check.
506
- * @param _coreContract Core contract address for the given project.
507
- * @param _ownedNFTAddress The address of the owned NFT contract.
508
- * @param _ownedNFTProjectId The ID of the owned NFT project.
426
+ * @param projectId The ID of the project to check.
427
+ * @param coreContract Core contract address for the given project.
428
+ * @param ownedNFTAddress The address of the owned NFT contract.
429
+ * @param ownedNFTProjectId The ID of the owned NFT project.
509
430
  * @return bool True if the NFT owner is allowed in the given project, False otherwise.
510
431
  */
511
432
  function allowedProjectHolders(
512
- uint256 _projectId,
513
- address _coreContract,
514
- address _ownedNFTAddress,
515
- uint256 _ownedNFTProjectId
433
+ uint256 projectId,
434
+ address coreContract,
435
+ address ownedNFTAddress,
436
+ uint256 ownedNFTProjectId
516
437
  ) external view returns (bool) {
517
438
  return
518
- _allowedProjectHoldersMapping[_coreContract][_projectId]
519
- .allowedProjectHolders[_ownedNFTAddress][_ownedNFTProjectId];
439
+ TokenHolderLib
440
+ .getHolderProjectConfig({
441
+ projectId: projectId,
442
+ coreContract: coreContract
443
+ })
444
+ .allowedProjectHolders[ownedNFTAddress][ownedNFTProjectId];
520
445
  }
521
446
 
522
447
  /**
523
- * @notice Returns if token is an allowlisted NFT for project `_projectId`.
524
- * @param _projectId Project ID to be checked.
525
- * @param _coreContract Core contract address for the given project.
526
- * @param _ownedNFTAddress ERC-721 NFT token address to be checked.
527
- * @param _ownedNFTTokenId ERC-721 NFT token ID to be checked.
448
+ * @notice Returns if token is an allowlisted NFT for project `projectId`.
449
+ * @param projectId Project ID to be checked.
450
+ * @param coreContract Core contract address for the given project.
451
+ * @param ownedNFTAddress ERC-721 NFT token address to be checked.
452
+ * @param ownedNFTTokenId ERC-721 NFT token ID to be checked.
528
453
  * @return bool Token is allowlisted
529
454
  * @dev does not check if token has been used to purchase
530
455
  * @dev assumes project ID can be derived from tokenId / 1_000_000
531
456
  */
532
457
  function isAllowlistedNFT(
533
- uint256 _projectId,
534
- address _coreContract,
535
- address _ownedNFTAddress,
536
- uint256 _ownedNFTTokenId
458
+ uint256 projectId,
459
+ address coreContract,
460
+ address ownedNFTAddress,
461
+ uint256 ownedNFTTokenId
537
462
  ) external view returns (bool) {
538
463
  return
539
464
  TokenHolderLib.isAllowlistedNFT({
540
- holderProjectConfig: _allowedProjectHoldersMapping[
541
- _coreContract
542
- ][_projectId],
543
- _ownedNFTAddress: _ownedNFTAddress,
544
- _ownedNFTTokenId: _ownedNFTTokenId
465
+ projectId: projectId,
466
+ coreContract: coreContract,
467
+ ownedNFTAddress: ownedNFTAddress,
468
+ ownedNFTTokenId: ownedNFTTokenId
545
469
  });
546
470
  }
547
471
 
548
472
  /**
549
- * @notice Checks if the specified `_coreContract` is a valid engine contract.
550
- * @dev This function retrieves the cached value of `_isEngine` from
473
+ * @notice Checks if the specified `coreContract` is a valid engine contract.
474
+ * @dev This function retrieves the cached value of `isEngine` from
551
475
  * the `isEngineCache` mapping. If the cached value is already set, it
552
- * returns the cached value. Otherwise, it calls the `getV3CoreIsEngine`
553
- * function from the `SplitFundsLib` library to check if `_coreContract`
476
+ * returns the cached value. Otherwise, it calls the `getV3CoreIsEngineView`
477
+ * function from the `SplitFundsLib` library to check if `coreContract`
554
478
  * is a valid engine contract.
555
- * @dev This function will revert if the provided `_coreContract` is not
479
+ * @dev This function will revert if the provided `coreContract` is not
556
480
  * a valid Engine or V3 Flagship contract.
557
- * @param _coreContract The address of the contract to check.
558
- * @return bool indicating if `_coreContract` is a valid engine contract.
481
+ * @param coreContract The address of the contract to check.
482
+ * @return bool indicating if `coreContract` is a valid engine contract.
559
483
  */
560
- function isEngineView(address _coreContract) external view returns (bool) {
561
- SplitFundsLib.IsEngineCache storage isEngineCache = _isEngineCaches[
562
- _coreContract
563
- ];
484
+ function isEngineView(address coreContract) external view returns (bool) {
485
+ SplitFundsLib.IsEngineCache storage isEngineCache = SplitFundsLib
486
+ .getIsEngineCacheConfig(coreContract);
564
487
  if (isEngineCache.isCached) {
565
488
  return isEngineCache.isEngine;
566
489
  } else {
567
- // @dev this calls the non-modifying variant of getV3CoreIsEngine
568
- return SplitFundsLib.getV3CoreIsEngineView(_coreContract);
490
+ // @dev this calls the non-state-modifying variant of isEngine
491
+ return SplitFundsLib.getV3CoreIsEngineView(coreContract);
569
492
  }
570
493
  }
571
494
 
@@ -580,17 +503,18 @@ contract MinterSetPriceHolderV5 is
580
503
  * possible because the V3 core contract only allows maximum invocations
581
504
  * to be reduced, not increased. Based on this rationale, we intentionally
582
505
  * do not do input validation in this method as to whether or not the input
583
- * @param `_projectId` is an existing project ID.
584
- * @param `_coreContract` is an existing core contract address.
506
+ * @param projectId is an existing project ID.
507
+ * @param coreContract is an existing core contract address.
585
508
  */
586
509
  function projectMaxHasBeenInvoked(
587
- uint256 _projectId,
588
- address _coreContract
510
+ uint256 projectId,
511
+ address coreContract
589
512
  ) external view returns (bool) {
590
513
  return
591
- MaxInvocationsLib.getMaxHasBeenInvoked(
592
- _maxInvocationsProjectConfigMapping[_coreContract][_projectId]
593
- );
514
+ MaxInvocationsLib.getMaxHasBeenInvoked({
515
+ projectId: projectId,
516
+ coreContract: coreContract
517
+ });
594
518
  }
595
519
 
596
520
  /**
@@ -609,26 +533,27 @@ contract MinterSetPriceHolderV5 is
609
533
  * increased. When this happens, the minter will enable minting, allowing
610
534
  * the core contract to enforce the max invocations check. Based on this
611
535
  * rationale, we intentionally do not do input validation in this method as
612
- * to whether or not the input `_projectId` is an existing project ID.
613
- * @param `_projectId` is an existing project ID.
614
- * @param `_coreContract` is an existing core contract address.
536
+ * to whether or not the input `projectId` is an existing project ID.
537
+ * @param projectId is an existing project ID.
538
+ * @param coreContract is an existing core contract address.
615
539
  */
616
540
  function projectMaxInvocations(
617
- uint256 _projectId,
618
- address _coreContract
541
+ uint256 projectId,
542
+ address coreContract
619
543
  ) external view returns (uint256) {
620
544
  return
621
- MaxInvocationsLib.getMaxInvocations(
622
- _maxInvocationsProjectConfigMapping[_coreContract][_projectId]
623
- );
545
+ MaxInvocationsLib.getMaxInvocations({
546
+ projectId: projectId,
547
+ coreContract: coreContract
548
+ });
624
549
  }
625
550
 
626
551
  /**
627
552
  * @notice Gets if price of token is configured, price of minting a
628
- * token on project `_projectId`, and currency symbol and address to be
553
+ * token on project `projectId`, and currency symbol and address to be
629
554
  * used as payment.
630
- * @param _projectId Project ID to get price information for
631
- * @param _coreContract Contract address of the core contract
555
+ * @param projectId Project ID to get price information for
556
+ * @param coreContract Contract address of the core contract
632
557
  * @return isConfigured true only if token price has been configured on
633
558
  * this minter
634
559
  * @return tokenPriceInWei current price of token on this minter - invalid
@@ -639,8 +564,8 @@ contract MinterSetPriceHolderV5 is
639
564
  * this minter. This minter always returns null address, reserved for ether
640
565
  */
641
566
  function getPriceInfo(
642
- uint256 _projectId,
643
- address _coreContract
567
+ uint256 projectId,
568
+ address coreContract
644
569
  )
645
570
  external
646
571
  view
@@ -652,107 +577,91 @@ contract MinterSetPriceHolderV5 is
652
577
  )
653
578
  {
654
579
  SetPriceLib.SetPriceProjectConfig
655
- storage _setPriceProjectConfig = _setPriceProjectConfigMapping[
656
- _coreContract
657
- ][_projectId];
658
- isConfigured = _setPriceProjectConfig.priceIsConfigured;
659
- tokenPriceInWei = _setPriceProjectConfig.pricePerTokenInWei;
580
+ storage setPriceProjectConfig_ = SetPriceLib
581
+ .getSetPriceProjectConfig({
582
+ projectId: projectId,
583
+ coreContract: coreContract
584
+ });
585
+ isConfigured = setPriceProjectConfig_.priceIsConfigured;
586
+ tokenPriceInWei = setPriceProjectConfig_.pricePerToken;
660
587
  currencySymbol = "ETH";
661
588
  currencyAddress = address(0);
662
589
  }
663
590
 
664
591
  /**
665
- * @notice Syncs local maximum invocations of project `_projectId` based on
592
+ * @notice Syncs local maximum invocations of project `projectId` based on
666
593
  * the value currently defined in the core contract.
667
- * @param _projectId Project ID to set the maximum invocations for.
668
- * @param _coreContract Core contract address for the given project.
594
+ * @param projectId Project ID to set the maximum invocations for.
595
+ * @param coreContract Core contract address for the given project.
669
596
  * @dev this enables gas reduction after maxInvocations have been reached -
670
597
  * core contracts shall still enforce a maxInvocation check during mint.
671
598
  */
672
599
  function syncProjectMaxInvocationsToCore(
673
- uint256 _projectId,
674
- address _coreContract
600
+ uint256 projectId,
601
+ address coreContract
675
602
  ) public {
676
603
  AuthLib.onlyArtist({
677
- _projectId: _projectId,
678
- _coreContract: _coreContract,
679
- _sender: msg.sender
604
+ projectId: projectId,
605
+ coreContract: coreContract,
606
+ sender: msg.sender
680
607
  });
681
608
 
682
- uint256 maxInvocations = MaxInvocationsLib
683
- .syncProjectMaxInvocationsToCore(
684
- _projectId,
685
- _coreContract,
686
- _maxInvocationsProjectConfigMapping[_coreContract][_projectId]
687
- );
688
- emit ProjectMaxInvocationsLimitUpdated(
689
- _projectId,
690
- _coreContract,
691
- maxInvocations
692
- );
609
+ MaxInvocationsLib.syncProjectMaxInvocationsToCore({
610
+ projectId: projectId,
611
+ coreContract: coreContract
612
+ });
693
613
  }
694
614
 
695
615
  /**
696
- * @notice Purchases a token from project `_projectId` and sets
697
- * the token's owner to `_to`.
698
- * @param _to Address to be the new token's owner.
699
- * @param _projectId Project ID to mint a token on.
700
- * @param _coreContract Core contract address for the given project.
701
- * @param _ownedNFTAddress ERC-721 NFT address holding the project token owned by _vault
616
+ * @notice Purchases a token from project `projectId` and sets
617
+ * the token's owner to `to`.
618
+ * @param to Address to be the new token's owner.
619
+ * @param projectId Project ID to mint a token on.
620
+ * @param coreContract Core contract address for the given project.
621
+ * @param ownedNFTAddress ERC-721 NFT address holding the project token owned by _vault
702
622
  * (or msg.sender if no _vault is provided) being used to claim right to purchase.
703
- * @param _ownedNFTTokenId ERC-721 NFT token ID owned by _vault (or msg.sender if
623
+ * @param ownedNFTTokenId ERC-721 NFT token ID owned by _vault (or msg.sender if
704
624
  * no _vault is provided) being used to claim right to purchase.
705
- * @param _vault Vault being purchased on behalf of. Acceptable to be `address(0)` if no vault.
625
+ * @param vault Vault being purchased on behalf of. Acceptable to be `address(0)` if no vault.
706
626
  * @return tokenId Token ID of minted token
707
627
  */
708
628
  function purchaseTo(
709
- address _to,
710
- uint256 _projectId,
711
- address _coreContract,
712
- address _ownedNFTAddress,
713
- uint256 _ownedNFTTokenId,
714
- address _vault
629
+ address to,
630
+ uint256 projectId,
631
+ address coreContract,
632
+ address ownedNFTAddress,
633
+ uint256 ownedNFTTokenId,
634
+ address vault
715
635
  ) public payable nonReentrant returns (uint256 tokenId) {
716
636
  // CHECKS
717
- SetPriceLib.SetPriceProjectConfig
718
- storage _setPriceProjectConfig = _setPriceProjectConfigMapping[
719
- _coreContract
720
- ][_projectId];
721
- MaxInvocationsLib.MaxInvocationsProjectConfig
722
- storage _maxInvocationsProjectConfig = _maxInvocationsProjectConfigMapping[
723
- _coreContract
724
- ][_projectId];
725
-
637
+ // pre-mint MaxInvocationsLib checks
726
638
  // Note that `maxHasBeenInvoked` is only checked here to reduce gas
727
639
  // consumption after a project has been fully minted.
728
- // `_maxInvocationsProjectConfig.maxHasBeenInvoked` is locally cached to reduce
640
+ // `maxInvocationsProjectConfig.maxHasBeenInvoked` is locally cached to reduce
729
641
  // gas consumption, but if not in sync with the core contract's value,
730
642
  // the core contract also enforces its own max invocation check during
731
643
  // minting.
732
- require(
733
- !_maxInvocationsProjectConfig.maxHasBeenInvoked,
734
- "Max invocations reached"
735
- );
736
-
737
- // require artist to have configured price of token on this minter
738
- require(
739
- _setPriceProjectConfig.priceIsConfigured,
740
- "Price not configured"
741
- );
644
+ MaxInvocationsLib.preMintChecks({
645
+ projectId: projectId,
646
+ coreContract: coreContract
647
+ });
742
648
 
743
- // load price of token into memory
744
- uint256 pricePerTokenInWei = _setPriceProjectConfig.pricePerTokenInWei;
649
+ // pre-mint checks for set price lib, and get price per token in wei
650
+ // @dev price per token is loaded into memory here for gas efficiency
651
+ uint256 pricePerTokenInWei = SetPriceLib.preMintChecksAndGetPrice({
652
+ projectId: projectId,
653
+ coreContract: coreContract
654
+ });
745
655
 
746
656
  require(msg.value >= pricePerTokenInWei, "Min value to mint req.");
747
657
 
748
658
  // require token used to claim to be in set of allowlisted NFTs
749
659
  require(
750
660
  TokenHolderLib.isAllowlistedNFT({
751
- holderProjectConfig: _allowedProjectHoldersMapping[
752
- _coreContract
753
- ][_projectId],
754
- _ownedNFTAddress: _ownedNFTAddress,
755
- _ownedNFTTokenId: _ownedNFTTokenId
661
+ projectId: projectId,
662
+ coreContract: coreContract,
663
+ ownedNFTAddress: ownedNFTAddress,
664
+ ownedNFTTokenId: ownedNFTTokenId
756
665
  }),
757
666
  "Only allowlisted NFTs"
758
667
  );
@@ -760,34 +669,39 @@ contract MinterSetPriceHolderV5 is
760
669
  // NOTE: delegate-vault handling **begins here**.
761
670
 
762
671
  // handle that the vault may be either the `msg.sender` in the case
763
- // that there is not a true vault, or may be `_vault` if one is
672
+ // that there is not a true vault, or may be `vault` if one is
764
673
  // provided explicitly (and it is valid).
765
- address vault = msg.sender;
766
- if (_vault != address(0)) {
674
+ address vault_ = msg.sender;
675
+ if (vault != address(0)) {
767
676
  // If a vault is provided, it must be valid, otherwise throw rather
768
677
  // than optimistically-minting with original `msg.sender`.
769
678
  // Note, we do not check `checkDelegateForAll` or `checkDelegateForContract` as well,
770
679
  // as they are known to be implicitly checked by calling `checkDelegateForToken`.
771
- bool isValidVault = delegationRegistryContract
772
- .checkDelegateForToken(
773
- msg.sender, // delegate
774
- _vault, // vault
775
- _coreContract, // contract
776
- _ownedNFTTokenId // tokenId
777
- );
680
+ bool isValidVault = _delegationRegistryContract
681
+ .checkDelegateForToken({
682
+ delegate: msg.sender,
683
+ vault: vault,
684
+ contract_: coreContract,
685
+ tokenId: ownedNFTTokenId
686
+ });
778
687
  require(isValidVault, "Invalid delegate-vault pairing");
779
- vault = _vault;
688
+ vault_ = vault;
780
689
  }
781
690
 
782
691
  // EFFECTS
783
- tokenId = minterFilter.mint_joo(_to, _projectId, _coreContract, vault);
692
+ tokenId = _minterFilter.mint_joo({
693
+ to: to,
694
+ projectId: projectId,
695
+ coreContract: coreContract,
696
+ sender: vault_
697
+ });
784
698
 
785
699
  // NOTE: delegate-vault handling **ends here**.
786
700
 
787
- MaxInvocationsLib.validatePurchaseEffectsInvocations(
788
- tokenId,
789
- _maxInvocationsProjectConfigMapping[_coreContract][_projectId]
790
- );
701
+ MaxInvocationsLib.validatePurchaseEffectsInvocations({
702
+ tokenId: tokenId,
703
+ coreContract: coreContract
704
+ });
791
705
 
792
706
  // INTERACTIONS
793
707
  // require vault to own NFT used to redeem
@@ -798,22 +712,17 @@ contract MinterSetPriceHolderV5 is
798
712
  * function is non-reentrant, so this is extra cautious.
799
713
  */
800
714
  TokenHolderLib.validateNFTOwnership({
801
- _ownedNFTAddress: _ownedNFTAddress,
802
- _ownedNFTTokenId: _ownedNFTTokenId,
803
- _targetOwner: vault
715
+ ownedNFTAddress: ownedNFTAddress,
716
+ ownedNFTTokenId: ownedNFTTokenId,
717
+ targetOwner: vault_
804
718
  });
805
719
 
806
720
  // INTERACTIONS
807
721
  // split funds
808
- bool isEngine = SplitFundsLib.isEngine(
809
- _coreContract,
810
- _isEngineCaches[_coreContract]
811
- );
812
- SplitFundsLib.splitFundsETH({
813
- _projectId: _projectId,
814
- _pricePerTokenInWei: pricePerTokenInWei,
815
- _coreContract: _coreContract,
816
- _isEngine: isEngine
722
+ SplitFundsLib.splitFundsETHRefundSender({
723
+ projectId: projectId,
724
+ pricePerTokenInWei: pricePerTokenInWei,
725
+ coreContract: coreContract
817
726
  });
818
727
 
819
728
  return tokenId;