@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,21 @@
1
1
  // SPDX-License-Identifier: LGPL-3.0-only
2
2
  // Created By: Art Blocks Inc.
3
3
 
4
+ // @dev fixed to specific solidity version for clarity and for more clear
5
+ // source code verification purposes.
4
6
  pragma solidity 0.8.19;
5
7
 
6
- import "../../interfaces/v0.8.x/IMinterFilterV1.sol";
7
- import "../../interfaces/v0.8.x/ISharedMinterV0.sol";
8
- import "../../interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol";
9
- import "../../interfaces/v0.8.x/ICoreRegistryV1.sol";
8
+ import {IMinterFilterV1} from "../../interfaces/v0.8.x/IMinterFilterV1.sol";
9
+ import {ISharedMinterV0} from "../../interfaces/v0.8.x/ISharedMinterV0.sol";
10
+ import {IGenArt721CoreContractV3_Base} from "../../interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol";
11
+ import {ICoreRegistryV1} from "../../interfaces/v0.8.x/ICoreRegistryV1.sol";
12
+ import {IAdminACLV0} from "../../interfaces/v0.8.x/IAdminACLV0.sol";
10
13
 
11
- import "../../libs/v0.8.x/Bytes32Strings.sol";
14
+ import {Bytes32Strings} from "../../libs/v0.8.x/Bytes32Strings.sol";
12
15
 
13
- import "@openzeppelin-4.7/contracts/access/Ownable.sol";
14
- import "@openzeppelin-4.7/contracts/utils/structs/EnumerableMap.sol";
15
- import "@openzeppelin-4.7/contracts/utils/structs/EnumerableSet.sol";
16
+ import {Ownable} from "@openzeppelin-4.7/contracts/access/Ownable.sol";
17
+ import {EnumerableMap} from "@openzeppelin-4.7/contracts/utils/structs/EnumerableMap.sol";
18
+ import {EnumerableSet} from "@openzeppelin-4.7/contracts/utils/structs/EnumerableSet.sol";
16
19
 
17
20
  /**
18
21
  * @title MinterFilterV2
@@ -36,7 +39,6 @@ import "@openzeppelin-4.7/contracts/utils/structs/EnumerableSet.sol";
36
39
  * - updateCoreRegistry
37
40
  * - approveMinterGlobally
38
41
  * - revokeMinterGlobally
39
- * - removeMintersForProjectsOnContracts
40
42
  * ----------------------------------------------------------------------------
41
43
  * The following functions are restricted as allowed by each core contract's
42
44
  * Admin ACL contract:
@@ -53,26 +55,21 @@ import "@openzeppelin-4.7/contracts/utils/structs/EnumerableSet.sol";
53
55
  * registries, and other contracts that may interact with this contract.
54
56
  */
55
57
  contract MinterFilterV2 is Ownable, IMinterFilterV1 {
56
- // add Enumerable Map methods
58
+ // add Enumerable Map, Enumerable Set methods
57
59
  using EnumerableMap for EnumerableMap.UintToAddressMap;
58
60
  using EnumerableSet for EnumerableSet.AddressSet;
59
61
  // add Bytes32Strings methods
60
62
  using Bytes32Strings for bytes32;
61
63
 
62
- /// version & type of this core contract
64
+ /// @notice Version of this minter filter contract
65
+ // @dev use function minterFilterVersion to get this as a string
63
66
  bytes32 constant MINTER_FILTER_VERSION = "v2.0.0";
64
67
 
65
- function minterFilterVersion() external pure returns (string memory) {
66
- return MINTER_FILTER_VERSION.toString();
67
- }
68
-
68
+ /// @notice Type of this minter filter contract
69
+ // @dev use function minterFilterType to get this as a string
69
70
  bytes32 constant MINTER_FILTER_TYPE = "MinterFilterV2";
70
71
 
71
- function minterFilterType() external pure returns (string memory) {
72
- return MINTER_FILTER_TYPE.toString();
73
- }
74
-
75
- /// Admin ACL contract for this minter filter
72
+ /// @notice Admin ACL contract for this minter filter
76
73
  IAdminACLV0 public adminACLContract;
77
74
 
78
75
  /**
@@ -80,48 +77,54 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
80
77
  */
81
78
  ICoreRegistryV1 public coreRegistry;
82
79
 
83
- /// minter address => qty projects across all core contracts currently
80
+ /// @notice Minter address => qty projects across all core contracts currently
84
81
  /// using the minter
85
- mapping(address => uint256) public numProjectsUsingMinter;
82
+ mapping(address minterAddress => uint256 numProjects)
83
+ public numProjectsUsingMinter;
86
84
 
87
85
  /**
88
- * Enumerable Set of globally approved minters.
86
+ * @notice Enumerable Set of globally approved minters.
89
87
  * This is a Set of addresses that are approved to mint on any
90
88
  * project, for any core contract.
91
89
  * @dev note that contract admins can extend a separate Set of minters for
92
90
  * their core contract via the `approveMinterForContract` function.
93
91
  */
94
- EnumerableSet.AddressSet private globallyApprovedMinters;
92
+ EnumerableSet.AddressSet private _globallyApprovedMinters;
95
93
 
96
94
  /**
97
- * Mapping of core contract addresses to Enumerable Sets of approved
95
+ * @notice Mapping of core contract addresses to Enumerable Sets of approved
98
96
  * minters for that core contract.
99
97
  * @dev note that contract admins can extend this Set for their core
100
98
  * contract by via the `approveMinterForContract` function, and can remove
101
99
  * minters from this Set via the `revokeMinterForContract` function.
102
100
  */
103
- mapping(address => EnumerableSet.AddressSet)
104
- private contractApprovedMinters;
101
+ mapping(address coreContract => EnumerableSet.AddressSet approvedMintersForContract)
102
+ private _contractApprovedMinters;
105
103
 
106
104
  /**
107
- * Mapping of core contract addresses to Enumerable Maps of project IDs to
105
+ * @notice Mapping of core contract addresses to Enumerable Maps of project IDs to
108
106
  * minter addresses.
109
107
  */
110
- mapping(address => EnumerableMap.UintToAddressMap) private minterForProject;
108
+ mapping(address coreContract => EnumerableMap.UintToAddressMap projectIdToMinterAddress)
109
+ private _minterForProject;
111
110
 
112
- function _onlyNonZeroAddress(address _address) internal pure {
113
- require(_address != address(0), "Only non-zero address");
111
+ /**
112
+ * @notice Function to validate an address is non-zero.
113
+ * @param address_ Address to validate
114
+ */
115
+ function _onlyNonZeroAddress(address address_) internal pure {
116
+ require(address_ != address(0), "Only non-zero address");
114
117
  }
115
118
 
116
119
  /**
117
120
  * @notice Function to restrict access to only AdminACL allowed calls
118
121
  * on a given core contract.
119
122
  * @dev defers to the ACL contract used by the core contract
120
- * @param _selector function selector to be checked
123
+ * @param selector function selector to be checked
121
124
  */
122
- function _onlyAdminACL(bytes4 _selector) internal {
125
+ function _onlyAdminACL(bytes4 selector) internal {
123
126
  require(
124
- adminACLAllowed(msg.sender, address(this), _selector),
127
+ adminACLAllowed(msg.sender, address(this), selector),
125
128
  "Only Admin ACL allowed"
126
129
  );
127
130
  }
@@ -130,225 +133,253 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
130
133
  * @notice Function to restrict access to only AdminACL allowed calls
131
134
  * on a given core contract.
132
135
  * @dev defers to the ACL contract used by the core contract
133
- * @param _coreContract core contract address
134
- * @param _selector function selector to be checked
136
+ * @param coreContract core contract address
137
+ * @param selector function selector to be checked
135
138
  */
136
- function _onlyCoreAdminACL(
137
- address _coreContract,
138
- bytes4 _selector
139
- ) internal {
139
+ function _onlyCoreAdminACL(address coreContract, bytes4 selector) internal {
140
140
  require(
141
- IGenArt721CoreContractV3_Base(_coreContract).adminACLAllowed(
142
- msg.sender,
143
- address(this),
144
- _selector
145
- ),
141
+ IGenArt721CoreContractV3_Base(coreContract).adminACLAllowed({
142
+ _sender: msg.sender,
143
+ _contract: address(this),
144
+ _selector: selector
145
+ }),
146
146
  "Only Core AdminACL allowed"
147
147
  );
148
148
  }
149
149
 
150
- // function to restrict access to only core AdminACL or the project artist
150
+ /**
151
+ * @notice Function to restrict access to only core AdminACL or the project artist.
152
+ * @dev Defers to the ACL contract used by the core contract
153
+ * @param coreContract core contract address
154
+ * @param selector function selector to be checked
155
+ */
151
156
  function _onlyCoreAdminACLOrArtist(
152
- uint256 _projectId,
153
- address _coreContract,
154
- bytes4 _selector
157
+ uint256 projectId,
158
+ address coreContract,
159
+ bytes4 selector
155
160
  ) internal {
156
161
  IGenArt721CoreContractV3_Base genArtCoreContract_Base = IGenArt721CoreContractV3_Base(
157
- _coreContract
162
+ coreContract
158
163
  );
159
164
  require(
160
165
  (msg.sender ==
161
- genArtCoreContract_Base.projectIdToArtistAddress(_projectId)) ||
166
+ genArtCoreContract_Base.projectIdToArtistAddress(projectId)) ||
162
167
  (
163
- genArtCoreContract_Base.adminACLAllowed(
164
- msg.sender,
165
- address(this),
166
- _selector
167
- )
168
+ genArtCoreContract_Base.adminACLAllowed({
169
+ _sender: msg.sender,
170
+ _contract: address(this),
171
+ _selector: selector
172
+ })
168
173
  ),
169
174
  "Only Artist or Core Admin ACL"
170
175
  );
171
176
  }
172
177
 
173
- // function to restrict access to only core contracts registered with the
174
- // currently configured core registry. This is used to prevent
175
- // non-registered core contracts from being used with this minter filter.
176
- function _onlyRegisteredCoreContract(address _coreContract) internal view {
178
+ /**
179
+ * @notice Function to restrict access to only core contracts registered with the
180
+ * currently configured core registry. This is used to prevent non-registered core
181
+ * contracts from being used with this minter filter.
182
+ * @param coreContract core contract address
183
+ */
184
+ function _onlyRegisteredCoreContract(address coreContract) internal view {
177
185
  // @dev use core registry to check if core contract is registered
178
186
  require(
179
- coreRegistry.isRegisteredContract(_coreContract),
187
+ coreRegistry.isRegisteredContract(coreContract),
180
188
  "Only registered core contract"
181
189
  );
182
190
  }
183
191
 
184
- // function to restrict access to only valid project IDs
192
+ /**
193
+ * @notice Function to restrict access to only valid project IDs.
194
+ * @param projectId Project ID to validate.
195
+ * @param coreContract core contract address
196
+ */
185
197
  function _onlyValidProjectId(
186
- uint256 _projectId,
187
- address _coreContract
198
+ uint256 projectId,
199
+ address coreContract
188
200
  ) internal view {
189
201
  IGenArt721CoreContractV3_Base genArtCoreContract = IGenArt721CoreContractV3_Base(
190
- _coreContract
202
+ coreContract
191
203
  );
192
204
  require(
193
- (_projectId >= genArtCoreContract.startingProjectId()) &&
194
- (_projectId < genArtCoreContract.nextProjectId()),
205
+ (projectId >= genArtCoreContract.startingProjectId()) &&
206
+ (projectId < genArtCoreContract.nextProjectId()),
195
207
  "Only valid project ID"
196
208
  );
197
209
  }
198
210
 
199
- // checks if minter is globally approved or approved for a core contract
211
+ /**
212
+ * @notice Function to check if minter is globally approved or approved for a core contract.
213
+ * @param coreContract core contract address
214
+ * @param minter Minter to validate.
215
+ */
200
216
  function _onlyApprovedMinter(
201
- address _coreContract,
202
- address _minter
217
+ address coreContract,
218
+ address minter
203
219
  ) internal view {
204
220
  require(
205
- isApprovedMinterForContract(_coreContract, _minter),
221
+ isApprovedMinterForContract({
222
+ coreContract: coreContract,
223
+ minter: minter
224
+ }),
206
225
  "Only approved minters"
207
226
  );
208
227
  }
209
228
 
210
229
  /**
211
- * @notice Initializes contract to be a Minter for `_genArt721Address`.
212
- * @param _adminACLContract Address of admin access control contract, to be
230
+ * @notice Initializes contract to be a Minter for `genArt721Address`.
231
+ * @param adminACLContract_ Address of admin access control contract, to be
213
232
  * set as contract owner.
214
- * @param _coreRegistry Address of core registry contract.
233
+ * @param coreRegistry_ Address of core registry contract.
215
234
  */
216
- constructor(address _adminACLContract, address _coreRegistry) {
235
+ constructor(address adminACLContract_, address coreRegistry_) {
217
236
  // set AdminACL management contract as owner
218
- _transferOwnership(_adminACLContract);
237
+ _transferOwnership(adminACLContract_);
219
238
  // set core registry contract
220
- _updateCoreRegistry(_coreRegistry);
239
+ _updateCoreRegistry(coreRegistry_);
221
240
  emit Deployed();
222
241
  }
223
242
 
224
- /// @dev override to prevent renouncing ownership
225
- /// @dev not permission gated since this immediately reverts
226
- function renounceOwnership() public pure override {
227
- revert("Cannot renounce ownership");
243
+ /**
244
+ * @notice returns the version of this minter filter contract
245
+ */
246
+ function minterFilterVersion() external pure returns (string memory) {
247
+ return MINTER_FILTER_VERSION.toString();
248
+ }
249
+
250
+ /**
251
+ * @notice returns the type of this minter filter contract
252
+ */
253
+ function minterFilterType() external pure returns (string memory) {
254
+ return MINTER_FILTER_TYPE.toString();
228
255
  }
229
256
 
230
257
  /**
231
258
  * @notice Updates the core registry contract to be used by this contract.
232
259
  * Only callable as allowed by AdminACL of this contract.
233
- * @param _coreRegistry Address of the new core registry contract.
260
+ * @param coreRegistry_ Address of the new core registry contract.
234
261
  */
235
- function updateCoreRegistry(address _coreRegistry) external {
262
+ function updateCoreRegistry(address coreRegistry_) external {
236
263
  _onlyAdminACL(this.updateCoreRegistry.selector);
237
- _updateCoreRegistry(_coreRegistry);
264
+ _updateCoreRegistry(coreRegistry_);
238
265
  }
239
266
 
240
267
  /**
241
- * @notice Globally approves minter `_minter` to be available for
268
+ * @notice Globally approves minter `minter` to be available for
242
269
  * minting on any project, for any core contract.
243
270
  * Only callable as allowed by AdminACL of this contract.
244
271
  * @dev Reverts if minter is already globally approved, or does not
245
272
  * implement minterType().
246
- * @param _minter Minter to be approved.
273
+ * @param minter Minter to be approved.
247
274
  */
248
- function approveMinterGlobally(address _minter) external {
275
+ function approveMinterGlobally(address minter) external {
249
276
  _onlyAdminACL(this.approveMinterGlobally.selector);
250
- // @dev add() returns true only if the value was not already in the Set
277
+ // @dev add() return true if the value was removed from the set
251
278
  require(
252
- globallyApprovedMinters.add(_minter),
279
+ _globallyApprovedMinters.add(minter),
253
280
  "Minter already approved"
254
281
  );
255
- emit MinterApprovedGlobally(
256
- _minter,
257
- ISharedMinterV0(_minter).minterType()
258
- );
282
+ emit MinterApprovedGlobally({
283
+ minter: minter,
284
+ minterType: ISharedMinterV0(minter).minterType()
285
+ });
259
286
  }
260
287
 
261
288
  /**
262
- * @notice Removes previously globally approved minter `_minter`
289
+ * @notice Removes previously globally approved minter `minter`
263
290
  * from the list of globally approved minters.
264
291
  * Only callable as allowed by AdminACL of this contract.
265
- * Reverts if minter is not globally approved, or if minter is still
266
- * in use by any project.
292
+ * Reverts if minter is not globally approved.
267
293
  * @dev intentionally do not check if minter is still in use by any
268
294
  * project, meaning that any projects currently using the minter will
269
295
  * continue to be able to use it. If existing projects should be forced
270
296
  * to discontinue using a minter, the minter may be removed by the minter
271
- * filter admin in bulk via the `TODO` function.
272
- * @param _minter Minter to remove.
297
+ * filter admin in bulk via the `removeMintersForProjectsOnContract`
298
+ * function.
299
+ * @param minter Minter to remove.
273
300
  */
274
- function revokeMinterGlobally(address _minter) external {
301
+ function revokeMinterGlobally(address minter) external {
275
302
  _onlyAdminACL(this.revokeMinterGlobally.selector);
276
303
  // @dev remove() returns true only if the value was already in the Set
277
304
  require(
278
- globallyApprovedMinters.remove(_minter),
305
+ _globallyApprovedMinters.remove(minter),
279
306
  "Only previously approved minter"
280
307
  );
281
- emit MinterRevokedGlobally(_minter);
308
+ emit MinterRevokedGlobally(minter);
282
309
  }
283
310
 
284
311
  /**
285
- * @notice Approves minter `_minter` to be available for minting on
286
- * any project on core contarct `_coreContract`.
287
- * Only callable as allowed by AdminACL of core contract `_coreContract`.
312
+ * @notice Approves minter `minter` to be available for minting on
313
+ * any project on core contarct `coreContract`.
314
+ * Only callable as allowed by AdminACL of core contract `coreContract`.
288
315
  * Reverts if core contract is not registered, if minter is already
289
316
  * approved for the contract, or if minter does not implement minterType().
290
- * @param _coreContract Core contract to approve minter for.
291
- * @param _minter Minter to be approved.
317
+ * @param coreContract Core contract to approve minter for.
318
+ * @param minter Minter to be approved.
292
319
  */
293
320
  function approveMinterForContract(
294
- address _coreContract,
295
- address _minter
321
+ address coreContract,
322
+ address minter
296
323
  ) external {
297
- _onlyRegisteredCoreContract(_coreContract);
298
- _onlyCoreAdminACL(
299
- _coreContract,
300
- this.approveMinterForContract.selector
301
- );
302
- // @dev add() returns true only if the value was not already in the Set
324
+ _onlyRegisteredCoreContract(coreContract);
325
+ _onlyCoreAdminACL({
326
+ coreContract: coreContract,
327
+ selector: this.approveMinterForContract.selector
328
+ });
329
+ // @dev add() returns true if the value was removed from the Set
303
330
  require(
304
- contractApprovedMinters[_coreContract].add(_minter),
331
+ _contractApprovedMinters[coreContract].add(minter),
305
332
  "Minter already approved"
306
333
  );
307
334
  emit MinterApprovedForContract({
308
- coreContract: _coreContract,
309
- minter: _minter,
310
- minterType: ISharedMinterV0(_minter).minterType()
335
+ coreContract: coreContract,
336
+ minter: minter,
337
+ minterType: ISharedMinterV0(minter).minterType()
311
338
  });
312
339
  }
313
340
 
314
341
  /**
315
- * @notice Removes previously approved minter `_minter` from the
316
- * list of approved minters on core contract `_coreContract`.
317
- * Only callable as allowed by AdminACL of core contract `_coreContract`.
342
+ * @notice Removes previously approved minter `minter` from the
343
+ * list of approved minters on core contract `coreContract`.
344
+ * Only callable as allowed by AdminACL of core contract `coreContract`.
318
345
  * Reverts if core contract is not registered, or if minter is not approved
319
346
  * on contract.
320
347
  * @dev intentionally does not check if minter is still in use by any
321
348
  * project, meaning that any projects currently using the minter will
322
349
  * continue to be able to use it. If existing projects should be forced
323
350
  * to discontinue using a minter, the minter may be removed by the contract
324
- * admin in bulk via the `TODO` function.
325
- * @param _minter Minter to remove.
351
+ * admin in bulk via the `removeMintersForProjectsOnContract` function.
352
+ * @param coreContract Core contract to remove minter from.
353
+ * @param minter Minter to remove.
326
354
  */
327
355
  function revokeMinterForContract(
328
- address _coreContract,
329
- address _minter
356
+ address coreContract,
357
+ address minter
330
358
  ) external {
331
- _onlyRegisteredCoreContract(_coreContract);
332
- _onlyCoreAdminACL(_coreContract, this.revokeMinterForContract.selector);
359
+ _onlyRegisteredCoreContract(coreContract);
360
+ _onlyCoreAdminACL({
361
+ coreContract: coreContract,
362
+ selector: this.revokeMinterForContract.selector
363
+ });
333
364
  // @dev intentionally do not check if minter is still in use by any
334
365
  // project, since it is possible that a different contract's project is
335
366
  // using the minter
336
367
  // @dev remove() returns true only if the value was already in the Set
337
368
  require(
338
- contractApprovedMinters[_coreContract].remove(_minter),
369
+ _contractApprovedMinters[coreContract].remove(minter),
339
370
  "Only previously approved minter"
340
371
  );
341
372
  emit MinterRevokedForContract({
342
- coreContract: _coreContract,
343
- minter: _minter
373
+ coreContract: coreContract,
374
+ minter: minter
344
375
  });
345
376
  }
346
377
 
347
378
  /**
348
- * @notice Sets minter for project `_projectId` on contract `_coreContract`
349
- * to minter `_minter`.
379
+ * @notice Sets minter for project `projectId` on contract `coreContract`
380
+ * to minter `minter`.
350
381
  * Only callable by the project's artist or as allowed by AdminACL of
351
- * core contract `_coreContract`.
382
+ * core contract `coreContract`.
352
383
  * Reverts if:
353
384
  * - core contract is not registered
354
385
  * - minter is not approved globally on this minter filter or for the
@@ -357,91 +388,98 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
357
388
  * - function is called by an address other than the project's artist
358
389
  * or a sender allowed by the core contract's admin ACL
359
390
  * - minter does not implement minterType()
360
- * @param _projectId Project ID to set minter for.
361
- * @param _coreContract Core contract of project.
362
- * @param _minter Minter to be the project's minter.
391
+ * @param projectId Project ID to set minter for.
392
+ * @param coreContract Core contract of project.
393
+ * @param minter Minter to be the project's minter.
363
394
  */
364
395
  function setMinterForProject(
365
- uint256 _projectId,
366
- address _coreContract,
367
- address _minter
396
+ uint256 projectId,
397
+ address coreContract,
398
+ address minter
368
399
  ) external {
369
400
  /// CHECKS
370
- _onlyRegisteredCoreContract(_coreContract);
371
- _onlyCoreAdminACLOrArtist(
372
- _projectId,
373
- _coreContract,
374
- this.setMinterForProject.selector
375
- );
376
- _onlyApprovedMinter(_coreContract, _minter);
377
- _onlyValidProjectId(_projectId, _coreContract);
401
+ _onlyRegisteredCoreContract(coreContract);
402
+ _onlyCoreAdminACLOrArtist({
403
+ projectId: projectId,
404
+ coreContract: coreContract,
405
+ selector: this.setMinterForProject.selector
406
+ });
407
+ _onlyApprovedMinter({coreContract: coreContract, minter: minter});
408
+ _onlyValidProjectId({projectId: projectId, coreContract: coreContract});
378
409
  /// EFFECTS
379
410
  // decrement number of projects using a previous minter
380
- (bool hasPreviousMinter, address previousMinter) = minterForProject[
381
- _coreContract
382
- ].tryGet(_projectId);
411
+ (bool hasPreviousMinter, address previousMinter) = _minterForProject[
412
+ coreContract
413
+ ].tryGet(projectId);
383
414
  if (hasPreviousMinter) {
384
415
  numProjectsUsingMinter[previousMinter]--;
385
416
  }
386
417
  // assign new minter
387
- numProjectsUsingMinter[_minter]++;
388
- minterForProject[_coreContract].set(_projectId, _minter);
418
+ numProjectsUsingMinter[minter]++;
419
+ _minterForProject[coreContract].set(projectId, minter);
389
420
  emit ProjectMinterRegistered({
390
- projectId: _projectId,
391
- coreContract: _coreContract,
392
- minter: _minter,
393
- minterType: ISharedMinterV0(_minter).minterType()
421
+ projectId: projectId,
422
+ coreContract: coreContract,
423
+ minter: minter,
424
+ minterType: ISharedMinterV0(minter).minterType()
394
425
  });
395
426
  }
396
427
 
397
428
  /**
398
- * @notice Updates project `_projectId` on contract `_coreContract` to have
429
+ * @notice Updates project `projectId` on contract `coreContract` to have
399
430
  * no configured minter.
400
431
  * Only callable by the project's artist or as allowed by AdminACL of
401
- * core contract `_coreContract`.
432
+ * core contract `coreContract`.
402
433
  * Reverts if:
403
434
  * - core contract is not registered
404
435
  * - project does not already have a minter assigned
405
436
  * - function is called by an address other than the project's artist
406
437
  * or a sender allowed by the core contract's admin ACL
407
- * @param _projectId Project ID to remove minter for.
408
- * @param _coreContract Core contract of project.
438
+ * @param projectId Project ID to remove minter for.
439
+ * @param coreContract Core contract of project.
409
440
  * @dev requires project to have an assigned minter
410
441
  */
411
442
  function removeMinterForProject(
412
- uint256 _projectId,
413
- address _coreContract
443
+ uint256 projectId,
444
+ address coreContract
414
445
  ) external {
415
- _onlyRegisteredCoreContract(_coreContract);
416
- _onlyCoreAdminACLOrArtist(
417
- _projectId,
418
- _coreContract,
419
- this.removeMinterForProject.selector
420
- );
446
+ _onlyRegisteredCoreContract(coreContract);
447
+ _onlyCoreAdminACLOrArtist({
448
+ projectId: projectId,
449
+ coreContract: coreContract,
450
+ selector: this.removeMinterForProject.selector
451
+ });
421
452
  // @dev this will revert if project does not have a minter
422
- _removeMinterForProject(_projectId, _coreContract);
453
+ _removeMinterForProject({
454
+ projectId: projectId,
455
+ coreContract: coreContract
456
+ });
423
457
  }
424
458
 
425
459
  /**
426
460
  * @notice Updates an array of project IDs to have no configured minter.
427
- * Only callable as allowed by AdminACL of core contract `_coreContract`.
461
+ * Only callable as allowed by AdminACL of core contract `coreContract`.
428
462
  * Reverts if the core contract is not registered, or if any project does
429
463
  * not already have a minter assigned.
430
- * @param _projectIds Array of project IDs to remove minters for.
464
+ * @param projectIds Array of project IDs to remove minters for.
465
+ * @param coreContract Core contract of projects.
431
466
  * @dev caution with respect to single tx gas limits
432
467
  */
433
468
  function removeMintersForProjectsOnContract(
434
- uint256[] calldata _projectIds,
435
- address _coreContract
469
+ uint256[] calldata projectIds,
470
+ address coreContract
436
471
  ) external {
437
- _onlyRegisteredCoreContract(_coreContract);
438
- _onlyCoreAdminACL(
439
- _coreContract,
440
- this.removeMintersForProjectsOnContract.selector
441
- );
442
- uint256 numProjects = _projectIds.length;
472
+ _onlyRegisteredCoreContract(coreContract);
473
+ _onlyCoreAdminACL({
474
+ coreContract: coreContract,
475
+ selector: this.removeMintersForProjectsOnContract.selector
476
+ });
477
+ uint256 numProjects = projectIds.length;
443
478
  for (uint256 i; i < numProjects; ) {
444
- _removeMinterForProject(_projectIds[i], _coreContract);
479
+ _removeMinterForProject({
480
+ projectId: projectIds[i],
481
+ coreContract: coreContract
482
+ });
445
483
  unchecked {
446
484
  ++i;
447
485
  }
@@ -449,12 +487,12 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
449
487
  }
450
488
 
451
489
  /**
452
- * @notice Mint a token from project `_projectId` on contract
453
- * `_coreContract` to `_to`, originally purchased by `sender`.
454
- * @param _to The new token's owner.
455
- * @param _projectId Project ID to mint a new token on.
456
- * @param _sender Address purchasing a new token.
457
- * @param _coreContract Core contract of project.
490
+ * @notice Mint a token from project `projectId` on contract
491
+ * `coreContract` to `to`, originally purchased by `sender`.
492
+ * @param to The new token's owner.
493
+ * @param projectId Project ID to mint a new token on.
494
+ * @param sender Address purchasing a new token.
495
+ * @param coreContract Core contract of project.
458
496
  * @return tokenId Token ID of minted token
459
497
  * @dev reverts w/nonexistent key error when project has no assigned minter
460
498
  * @dev does not check if core contract is registered, for gas efficiency
@@ -465,32 +503,32 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
465
503
  * @dev function name is optimized for gas.
466
504
  */
467
505
  function mint_joo(
468
- address _to,
469
- uint256 _projectId,
470
- address _coreContract,
471
- address _sender
506
+ address to,
507
+ uint256 projectId,
508
+ address coreContract,
509
+ address sender
472
510
  ) external returns (uint256 tokenId) {
473
511
  // CHECKS
474
512
  // minter is the project's minter
475
513
  require(
476
- msg.sender == minterForProject[_coreContract].get(_projectId),
514
+ msg.sender == _minterForProject[coreContract].get(projectId),
477
515
  "Only assigned minter"
478
516
  );
479
517
  // INTERACTIONS
480
- tokenId = IGenArt721CoreContractV3_Base(_coreContract).mint_Ecf(
481
- _to,
482
- _projectId,
483
- _sender
484
- );
518
+ tokenId = IGenArt721CoreContractV3_Base(coreContract).mint_Ecf({
519
+ _to: to,
520
+ _projectId: projectId,
521
+ _by: sender
522
+ });
485
523
  return tokenId;
486
524
  }
487
525
 
488
526
  /**
489
- * @notice Gets the assigned minter for project `_projectId` on core
490
- * contract `_coreContract`.
527
+ * @notice Gets the assigned minter for project `projectId` on core
528
+ * contract `coreContract`.
491
529
  * Reverts if project does not have an assigned minter.
492
- * @param _projectId Project ID to query.
493
- * @param _coreContract Core contract of project.
530
+ * @param projectId Project ID to query.
531
+ * @param coreContract Core contract of project.
494
532
  * @return address Minter address assigned to project
495
533
  * @dev requires project to have an assigned minter
496
534
  * @dev this function intentionally does not check that the core contract
@@ -498,21 +536,21 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
498
536
  * project was assigned a minter
499
537
  */
500
538
  function getMinterForProject(
501
- uint256 _projectId,
502
- address _coreContract
539
+ uint256 projectId,
540
+ address coreContract
503
541
  ) external view returns (address) {
504
- (bool hasMinter, address currentMinter) = minterForProject[
505
- _coreContract
506
- ].tryGet(_projectId);
542
+ (bool hasMinter, address currentMinter) = _minterForProject[
543
+ coreContract
544
+ ].tryGet(projectId);
507
545
  require(hasMinter, "No minter assigned");
508
546
  return currentMinter;
509
547
  }
510
548
 
511
549
  /**
512
- * @notice Queries if project `_projectId` on core contract `_coreContract`
550
+ * @notice Queries if project `projectId` on core contract `coreContract`
513
551
  * has an assigned minter.
514
- * @param _projectId Project ID to query.
515
- * @param _coreContract Core contract of project.
552
+ * @param projectId Project ID to query.
553
+ * @param coreContract Core contract of project.
516
554
  * @return bool true if project has an assigned minter, else false
517
555
  * @dev requires project to have an assigned minter
518
556
  * @dev this function intentionally does not check that the core contract
@@ -520,35 +558,35 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
520
558
  * project was assigned a minter
521
559
  */
522
560
  function projectHasMinter(
523
- uint256 _projectId,
524
- address _coreContract
561
+ uint256 projectId,
562
+ address coreContract
525
563
  ) external view returns (bool) {
526
- (bool hasMinter, ) = minterForProject[_coreContract].tryGet(_projectId);
564
+ (bool hasMinter, ) = _minterForProject[coreContract].tryGet(projectId);
527
565
  return hasMinter;
528
566
  }
529
567
 
530
568
  /**
531
569
  * @notice Gets quantity of projects on a given core contract that have
532
570
  * assigned minters.
533
- * @param _coreContract Core contract to query.
571
+ * @param coreContract Core contract to query.
534
572
  * @return uint256 quantity of projects that have assigned minters
535
573
  * @dev this function intentionally does not check that the core contract
536
574
  * is registered, since it must have been registered at the time the
537
575
  * project was assigned a minter
538
576
  */
539
577
  function getNumProjectsOnContractWithMinters(
540
- address _coreContract
578
+ address coreContract
541
579
  ) external view returns (uint256) {
542
- return minterForProject[_coreContract].length();
580
+ return _minterForProject[coreContract].length();
543
581
  }
544
582
 
545
583
  /**
546
- * @notice Get project ID and minter address at index `_index` of
584
+ * @notice Get project ID and minter address at index `index` of
547
585
  * enumerable map.
548
- * @param _coreContract Core contract to query.
549
- * @param _index enumerable map index to query.
550
- * @return projectId project ID at index `_index`
551
- * @return minterAddress minter address for project at index `_index`
586
+ * @param coreContract Core contract to query.
587
+ * @param index enumerable map index to query.
588
+ * @return projectId project ID at index `index`
589
+ * @return minterAddress minter address for project at index `index`
552
590
  * @return minterType minter type of minter at minterAddress
553
591
  * @dev index must be < quantity of projects that have assigned minters,
554
592
  * otherwise reverts
@@ -558,8 +596,8 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
558
596
  * project was assigned a minter
559
597
  */
560
598
  function getProjectAndMinterInfoOnContractAt(
561
- address _coreContract,
562
- uint256 _index
599
+ address coreContract,
600
+ uint256 index
563
601
  )
564
602
  external
565
603
  view
@@ -570,65 +608,60 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
570
608
  )
571
609
  {
572
610
  // @dev at() reverts if index is out of bounds
573
- (projectId, minterAddress) = minterForProject[_coreContract].at(_index);
611
+ (projectId, minterAddress) = _minterForProject[coreContract].at(index);
574
612
  minterType = ISharedMinterV0(minterAddress).minterType();
575
- return (projectId, minterAddress, minterType);
576
613
  }
577
614
 
578
615
  /**
579
616
  * @notice View that returns if a core contract is registered with the
580
617
  * core registry, allowing this minter filter to service it.
581
- * @param _coreContract core contract address to be checked
618
+ * @param coreContract core contract address to be checked
582
619
  * @return bool true if core contract is registered, else false
583
620
  */
584
621
  function isRegisteredCoreContract(
585
- address _coreContract
622
+ address coreContract
586
623
  ) external view override returns (bool) {
587
- return coreRegistry.isRegisteredContract(_coreContract);
624
+ return coreRegistry.isRegisteredContract(coreContract);
588
625
  }
589
626
 
590
627
  /**
591
- * @notice Gets all projects on core contract `_coreContract` that are
592
- * using minter `_minter`.
628
+ * @notice Gets all projects on core contract `coreContract` that are
629
+ * using minter `minter`.
593
630
  * Warning: Unbounded gas limit. This function is gas-intensive and should
594
631
  * only be used for off-chain queries. Alternatively, the subgraph indexing
595
632
  * layer may be used to query these values.
596
- * @param _coreContract core contract to query
597
- * @param _minter minter to query
633
+ * @param coreContract core contract to query
634
+ * @param minter minter to query
598
635
  */
599
636
  function getProjectsOnContractUsingMinter(
600
- address _coreContract,
601
- address _minter
637
+ address coreContract,
638
+ address minter
602
639
  ) external view returns (uint256[] memory projectIds) {
603
640
  // initialize arrays with maximum potential length
604
641
  // @dev use num projects using minter across all contracts since it the
605
642
  // maximum length of this array
606
- uint256 maxNumProjects = numProjectsUsingMinter[_minter];
643
+ uint256 maxNumProjects = numProjectsUsingMinter[minter];
607
644
  projectIds = new uint256[](maxNumProjects);
608
645
  // iterate over all projects on contract, adding to array if using
609
- // `_minter`
610
- EnumerableMap.UintToAddressMap storage minterMap = minterForProject[
611
- _coreContract
646
+ // `minter`
647
+ EnumerableMap.UintToAddressMap storage minterMap = _minterForProject[
648
+ coreContract
612
649
  ];
613
650
  uint256 numProjects = minterMap.length();
614
651
  uint256 numProjectsOnContractUsingMinter;
615
652
  for (uint256 i; i < numProjects; ) {
616
- (uint256 projectId, address minter) = minterMap.at(i);
617
- if (minter == _minter) {
618
- projectIds[numProjectsOnContractUsingMinter++] = projectId;
619
- }
653
+ (uint256 projectId, address minter_) = minterMap.at(i);
620
654
  unchecked {
655
+ if (minter_ == minter) {
656
+ projectIds[numProjectsOnContractUsingMinter++] = projectId;
657
+ }
621
658
  ++i;
622
659
  }
623
660
  }
624
661
  // trim array if necessary
625
662
  if (maxNumProjects > numProjectsOnContractUsingMinter) {
626
- assembly {
627
- let decrease := sub(
628
- maxNumProjects,
629
- numProjectsOnContractUsingMinter
630
- )
631
- mstore(projectIds, sub(mload(projectIds), decrease))
663
+ assembly ("memory-safe") {
664
+ mstore(projectIds, numProjectsOnContractUsingMinter)
632
665
  }
633
666
  }
634
667
  return projectIds;
@@ -651,11 +684,11 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
651
684
  returns (MinterWithType[] memory mintersWithTypes)
652
685
  {
653
686
  // initialize arrays with appropriate length
654
- uint256 numMinters = globallyApprovedMinters.length();
687
+ uint256 numMinters = _globallyApprovedMinters.length();
655
688
  mintersWithTypes = new MinterWithType[](numMinters);
656
689
  // iterate over all globally approved minters, adding to array
657
690
  for (uint256 i; i < numMinters; ) {
658
- address minterAddress = globallyApprovedMinters.at(i);
691
+ address minterAddress = _globallyApprovedMinters.at(i);
659
692
  // @dev we know minterType() does not revert, because it was called
660
693
  // when globally approving the minter
661
694
  string memory minterType = ISharedMinterV0(minterAddress)
@@ -676,24 +709,24 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
676
709
  * address and minter type.
677
710
  * This function has unbounded gas, and should only be used for off-chain
678
711
  * queries.
679
- * @param _coreContract Core contract to query.
712
+ * @param coreContract Core contract to query.
680
713
  * @return mintersWithTypes Array of MinterWithType structs, which contain
681
714
  * the minter address and minter type.
682
715
  */
683
716
  function getAllContractApprovedMinters(
684
- address _coreContract
717
+ address coreContract
685
718
  ) external view returns (MinterWithType[] memory mintersWithTypes) {
686
719
  // initialize arrays with appropriate length
687
720
  EnumerableSet.AddressSet
688
- storage _contractApprovedMinters = contractApprovedMinters[
689
- _coreContract
721
+ storage contractApprovedMinters = _contractApprovedMinters[
722
+ coreContract
690
723
  ];
691
- uint256 numMinters = _contractApprovedMinters.length();
724
+ uint256 numMinters = contractApprovedMinters.length();
692
725
  mintersWithTypes = new MinterWithType[](numMinters);
693
726
  // iterate over all minters approved for a given contract, adding to
694
727
  // array
695
728
  for (uint256 i; i < numMinters; ) {
696
- address minterAddress = _contractApprovedMinters.at(i);
729
+ address minterAddress = contractApprovedMinters.at(i);
697
730
  // @dev we know minterType() does not revert, because it was called
698
731
  // when approving the minter for a contract
699
732
  string memory minterType = ISharedMinterV0(minterAddress)
@@ -709,58 +742,61 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
709
742
  }
710
743
 
711
744
  /**
712
- * @notice Convenience function that returns whether `_sender` is allowed
713
- * to call function with selector `_selector` on contract `_contract`, as
745
+ * @notice Convenience function that returns whether `sender` is allowed
746
+ * to call function with selector `selector` on contract `contract`, as
714
747
  * determined by this contract's current Admin ACL contract. Expected use
715
748
  * cases include minter contracts checking if caller is allowed to call
716
749
  * admin-gated functions on minter contracts.
717
- * @param _sender Address of the sender calling function with selector
718
- * `_selector` on contract `_contract`.
719
- * @param _contract Address of the contract being called by `_sender`.
720
- * @param _selector Function selector of the function being called by
721
- * `_sender`.
722
- * @return bool Whether `_sender` is allowed to call function with selector
723
- * `_selector` on contract `_contract`.
750
+ * @param sender Address of the sender calling function with selector
751
+ * `selector` on contract `contract`.
752
+ * @param contract_ Address of the contract being called by `sender`.
753
+ * @param selector Function selector of the function being called by
754
+ * `sender`.
755
+ * @return bool Whether `sender` is allowed to call function with selector
756
+ * `selector` on contract `contract`.
724
757
  * @dev assumes the Admin ACL contract is the owner of this contract, which
725
758
  * is expected to always be true.
726
- * @dev adminACLContract is expected to either be null address (if owner
727
- * has renounced ownership), or conform to IAdminACLV0 interface. Check for
728
- * null address first to avoid revert when admin has renounced ownership.
759
+ * @dev adminACLContract is expected to not be null address (owner cannot
760
+ * renounce ownership on this contract), and conform to IAdminACLV0
761
+ * interface.
729
762
  */
730
763
  function adminACLAllowed(
731
- address _sender,
732
- address _contract,
733
- bytes4 _selector
764
+ address sender,
765
+ address contract_,
766
+ bytes4 selector
734
767
  ) public returns (bool) {
735
768
  return
736
- owner() != address(0) &&
737
- adminACLContract.allowed(_sender, _contract, _selector);
769
+ adminACLContract.allowed({
770
+ _sender: sender,
771
+ _contract: contract_,
772
+ _selector: selector
773
+ });
738
774
  }
739
775
 
740
776
  /**
741
- * @notice Returns whether `_minter` is globally approved to mint tokens
777
+ * @notice Returns whether `minter` is globally approved to mint tokens
742
778
  * on any contract.
743
- * @param _minter Address of minter to check.
779
+ * @param minter Address of minter to check.
744
780
  */
745
781
  function isGloballyApprovedMinter(
746
- address _minter
782
+ address minter
747
783
  ) public view returns (bool) {
748
- return globallyApprovedMinters.contains(_minter);
784
+ return _globallyApprovedMinters.contains(minter);
749
785
  }
750
786
 
751
787
  /**
752
- * @notice Returns whether `_minter` is approved to mint tokens on
753
- * core contract `_coreContract`.
754
- * @param _coreContract Address of core contract to check.
755
- * @param _minter Address of minter to check.
788
+ * @notice Returns whether `minter` is approved to mint tokens on
789
+ * core contract `coreContract`.
790
+ * @param coreContract Address of core contract to check.
791
+ * @param minter Address of minter to check.
756
792
  */
757
793
  function isApprovedMinterForContract(
758
- address _coreContract,
759
- address _minter
794
+ address coreContract,
795
+ address minter
760
796
  ) public view returns (bool) {
761
797
  return
762
- isGloballyApprovedMinter(_minter) ||
763
- contractApprovedMinters[_coreContract].contains(_minter);
798
+ isGloballyApprovedMinter(minter) ||
799
+ _contractApprovedMinters[coreContract].contains(minter);
764
800
  }
765
801
 
766
802
  /**
@@ -779,52 +815,59 @@ contract MinterFilterV2 is Ownable, IMinterFilterV1 {
779
815
  return Ownable.owner();
780
816
  }
781
817
 
818
+ /// @dev override to prevent renouncing ownership
819
+ /// @dev not permission gated since this immediately reverts
820
+ function renounceOwnership() public pure override {
821
+ revert("Cannot renounce ownership");
822
+ }
823
+
782
824
  /**
783
- * @notice Updates project `_projectId` to have no configured minter
825
+ * @notice Updates project `projectId` to have no configured minter
784
826
  * Reverts if project does not already have an assigned minter.
785
- * @param _projectId Project ID to remove minter.
827
+ * @param projectId Project ID to remove minter.
828
+ * @param coreContract Core contract of project.
786
829
  * @dev requires project to have an assigned minter
787
830
  * @dev this function intentionally does not check that the core contract
788
831
  * is registered, since it must have been registered at the time the
789
832
  * project was assigned a minter
790
833
  */
791
834
  function _removeMinterForProject(
792
- uint256 _projectId,
793
- address _coreContract
835
+ uint256 projectId,
836
+ address coreContract
794
837
  ) internal {
795
838
  // remove minter for project and emit
796
839
  // @dev `minterForProject.get()` reverts tx if no minter set for project
797
840
  numProjectsUsingMinter[
798
- minterForProject[_coreContract].get(
799
- _projectId,
800
- "No minter assigned"
801
- )
841
+ _minterForProject[coreContract].get(projectId, "No minter assigned")
802
842
  ]--;
803
- minterForProject[_coreContract].remove(_projectId);
804
- emit ProjectMinterRemoved(_projectId, _coreContract);
843
+ _minterForProject[coreContract].remove(projectId);
844
+ emit ProjectMinterRemoved({
845
+ projectId: projectId,
846
+ coreContract: coreContract
847
+ });
805
848
  }
806
849
 
807
850
  /**
808
- * @notice Transfers ownership of the contract to a new account (`_owner`).
851
+ * @notice Transfers ownership of the contract to a new account (`owner`).
809
852
  * Internal function without access restriction.
810
- * @param _owner New owner.
853
+ * @param owner_ New owner.
811
854
  * @dev owner role was called `admin` prior to V3 core contract.
812
855
  * @dev Overrides and wraps OpenZeppelin's _transferOwnership function to
813
856
  * also update adminACLContract for improved introspection.
814
857
  */
815
- function _transferOwnership(address _owner) internal override {
816
- Ownable._transferOwnership(_owner);
817
- adminACLContract = IAdminACLV0(_owner);
858
+ function _transferOwnership(address owner_) internal override {
859
+ Ownable._transferOwnership(owner_);
860
+ adminACLContract = IAdminACLV0(owner_);
818
861
  }
819
862
 
820
863
  /**
821
864
  * @notice Updates this contract's core registry contract to
822
- * `_coreRegistry`.
823
- * @param _coreRegistry New core registry contract address.
865
+ * `coreRegistry`.
866
+ * @param coreRegistry_ New core registry contract address.
824
867
  */
825
- function _updateCoreRegistry(address _coreRegistry) internal {
826
- _onlyNonZeroAddress(_coreRegistry);
827
- coreRegistry = ICoreRegistryV1(_coreRegistry);
828
- emit CoreRegistryUpdated(_coreRegistry);
868
+ function _updateCoreRegistry(address coreRegistry_) internal {
869
+ _onlyNonZeroAddress(coreRegistry_);
870
+ coreRegistry = ICoreRegistryV1(coreRegistry_);
871
+ emit CoreRegistryUpdated(coreRegistry_);
829
872
  }
830
873
  }