@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.
- package/README.md +2 -2
- package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
- package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +97 -10
- package/artifacts/contracts/GenArt721CoreV3.sol/GenArt721CoreV3.json +4 -4
- package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +4 -9
- package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +4 -9
- package/artifacts/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol/GenArt721CoreV3_Engine_Flex_PROOF.json +4 -9
- package/artifacts/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol/GenArt721CoreV3_Engine_Flex_PROHIBITION.json +4 -9
- package/artifacts/contracts/engine-registry/CoreRegistryV1.sol/CoreRegistryV1.json +12 -12
- package/artifacts/contracts/explorations/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +4 -4
- package/artifacts/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol/ICoreRegistryV1.json +6 -6
- package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +19 -0
- package/artifacts/contracts/interfaces/v0.8.x/IMinterFilterV1.sol/IMinterFilterV1.json +22 -22
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAExpSettlementV0.sol/ISharedMinterDAExpSettlementV0.json +8 -101
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAExpV0.sol/ISharedMinterDAExpV0.json +1 -57
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDALinV0.sol/ISharedMinterDALinV0.json +1 -57
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterDAV0.sol/ISharedMinterDAV0.json +2 -21
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterHolderERC20V0.sol/ISharedMinterHolderERC20V0.json +158 -0
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterHolderV0.sol/ISharedMinterHolderV0.json +15 -90
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterMerkleV0.sol/ISharedMinterMerkleV0.json +10 -36
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterSEAV0.sol/ISharedMinterSEAV0.json +4 -236
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterSimplePurchaseV0.sol/ISharedMinterSimplePurchaseV0.json +5 -5
- package/artifacts/contracts/interfaces/v0.8.x/ISharedMinterV0.sol/ISharedMinterV0.json +7 -423
- package/artifacts/contracts/interfaces/v0.8.x/ISharedRandomizerV0.sol/ISharedRandomizerV0.json +17 -17
- package/artifacts/contracts/libs/v0.8.x/ABHelpers.sol/ABHelpers.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/AuthLib.sol/AuthLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/Bytes32Strings.sol/Bytes32Strings.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/DAExpLib.sol/DAExpLib.json +60 -3
- package/artifacts/contracts/libs/v0.8.x/minter-libs/DALib.sol/DALib.json +30 -0
- package/artifacts/contracts/libs/v0.8.x/minter-libs/DALinLib.sol/DALinLib.json +60 -3
- package/artifacts/contracts/libs/v0.8.x/minter-libs/GenericMinterEventsLib.sol/GenericMinterEventsLib.json +346 -0
- package/artifacts/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol/MaxInvocationsLib.json +29 -3
- package/artifacts/contracts/libs/v0.8.x/minter-libs/MerkleLib.sol/MerkleLib.json +30 -3
- package/artifacts/contracts/libs/v0.8.x/minter-libs/PolyptychLib.sol/PolyptychLib.json +2 -2
- package/artifacts/contracts/libs/v0.8.x/minter-libs/SEALib.sol/SEALib.json +254 -3
- package/artifacts/contracts/libs/v0.8.x/minter-libs/SetPriceLib.sol/SetPriceLib.json +48 -3
- package/artifacts/contracts/libs/v0.8.x/minter-libs/SettlementExpLib.sol/SettlementExpLib.json +41 -3
- package/artifacts/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol/SplitFundsLib.json +35 -3
- package/artifacts/contracts/libs/v0.8.x/minter-libs/TokenHolderLib.sol/TokenHolderLib.json +79 -3
- package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV1.sol/MinterFilterV1.json +2 -2
- package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV2.sol/MinterFilterV2.json +41 -41
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpHolderV5.sol/MinterDAExpHolderV5.json +66 -632
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +2 -20
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV3.sol/MinterDAExpSettlementV3.json +67 -594
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpV5.sol/MinterDAExpV5.json +33 -524
- package/artifacts/contracts/minter-suite/Minters/MinterDALinHolderV5.sol/MinterDALinHolderV5.json +66 -632
- package/artifacts/contracts/minter-suite/Minters/MinterDALinV5.sol/MinterDALinV5.json +33 -524
- package/artifacts/contracts/minter-suite/Minters/MinterSEAV1.sol/MinterSEAV1.json +51 -717
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V5.sol/MinterSetPriceERC20V5.json +58 -454
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceHolderV5.sol/MinterSetPriceHolderV5.json +61 -552
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceMerkleV5.sol/MinterSetPriceMerkleV5.json +55 -497
- package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychERC20V5.sol/MinterSetPricePolyptychERC20V5.json +110 -571
- package/artifacts/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol/MinterSetPricePolyptychV5.json +69 -560
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV5.sol/MinterSetPriceV5.json +28 -444
- package/artifacts/contracts/mock/DummySharedMinter.sol/DummySharedMinter.json +2 -2
- package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +4 -9
- package/artifacts/contracts/mock/OriginRegisterMock.sol/OriginRegisterMock.json +2 -2
- package/artifacts/contracts/mock/ReentrancyHolderMockShared.sol/ReentrancyHolderMockShared.json +136 -0
- package/artifacts/contracts/mock/ReentrancyMerkleMockShared.sol/ReentrancyMerkleMockShared.json +105 -0
- package/artifacts/contracts/mock/ReentrancyMockShared.sol/ReentrancyMockShared.json +100 -0
- package/artifacts/contracts/mock/ReentrancySEAMockShared.sol/ReentrancySEAAutoBidderMockShared.json +69 -0
- package/artifacts/contracts/randomizer/shared/SharedRandomizerV0.sol/SharedRandomizerV0.json +19 -19
- package/contracts/DependencyRegistryV0.sol +84 -16
- package/contracts/archive/readme.md +16 -0
- package/contracts/engine/README.md +21 -0
- package/contracts/engine/V3/GenArt721CoreV3_Engine.sol +4 -10
- package/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol +4 -10
- package/contracts/engine/V3/forks/GenArt721CoreV3_Engine_Flex_PROOF.sol +4 -10
- package/contracts/engine/V3/forks/PROHIBITION/GenArt721CoreV3_Engine_Flex_PROHIBITION.sol +4 -10
- package/contracts/engine-registry/CoreRegistryV1.sol +58 -65
- package/contracts/interfaces/v0.8.x/ICoreRegistryV1.sol +6 -8
- package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +3 -0
- package/contracts/interfaces/v0.8.x/IMinterFilterV1.sol +25 -25
- package/contracts/interfaces/v0.8.x/ISharedMinterDAExpSettlementV0.sol +11 -20
- package/contracts/interfaces/v0.8.x/ISharedMinterDAExpV0.sol +1 -14
- package/contracts/interfaces/v0.8.x/ISharedMinterDALinV0.sol +1 -15
- package/contracts/interfaces/v0.8.x/ISharedMinterDAV0.sol +2 -8
- package/contracts/interfaces/v0.8.x/ISharedMinterHolderERC20V0.sol +47 -0
- package/contracts/interfaces/v0.8.x/ISharedMinterHolderV0.sol +15 -43
- package/contracts/interfaces/v0.8.x/ISharedMinterMerkleV0.sol +10 -20
- package/contracts/interfaces/v0.8.x/ISharedMinterSEAV0.sol +4 -67
- package/contracts/interfaces/v0.8.x/ISharedMinterSimplePurchaseV0.sol +5 -5
- package/contracts/interfaces/v0.8.x/ISharedMinterV0.sol +7 -155
- package/contracts/interfaces/v0.8.x/ISharedRandomizerV0.sol +37 -37
- package/contracts/libs/v0.8.x/ABHelpers.sol +14 -14
- package/contracts/libs/v0.8.x/AuthLib.sol +101 -102
- package/contracts/libs/v0.8.x/Bytes32Strings.sol +5 -5
- package/contracts/libs/v0.8.x/minter-libs/DAExpLib.sol +163 -38
- package/contracts/libs/v0.8.x/minter-libs/DALib.sol +26 -0
- package/contracts/libs/v0.8.x/minter-libs/DALinLib.sol +144 -37
- package/contracts/libs/v0.8.x/minter-libs/GenericMinterEventsLib.sol +171 -0
- package/contracts/libs/v0.8.x/minter-libs/MaxInvocationsLib.sol +250 -110
- package/contracts/libs/v0.8.x/minter-libs/MerkleLib.sol +257 -48
- package/contracts/libs/v0.8.x/minter-libs/PolyptychLib.sol +138 -58
- package/contracts/libs/v0.8.x/minter-libs/SEALib.sol +778 -103
- package/contracts/libs/v0.8.x/minter-libs/SetPriceLib.sol +135 -13
- package/contracts/libs/v0.8.x/minter-libs/SettlementExpLib.sol +567 -187
- package/contracts/libs/v0.8.x/minter-libs/SplitFundsLib.sol +480 -322
- package/contracts/libs/v0.8.x/minter-libs/TokenHolderLib.sol +214 -76
- package/contracts/minter-suite/MinterFilter/MinterFilterV2.sol +347 -304
- package/contracts/minter-suite/Minters/MinterDAExpHolderV5.sol +391 -491
- package/contracts/minter-suite/Minters/MinterDAExpSettlementV2.sol +1 -54
- package/contracts/minter-suite/Minters/MinterDAExpSettlementV3.sol +388 -628
- package/contracts/minter-suite/Minters/MinterDAExpV5.sol +212 -273
- package/contracts/minter-suite/Minters/MinterDALinHolderV5.sol +393 -488
- package/contracts/minter-suite/Minters/MinterDALinV5.sol +220 -277
- package/contracts/minter-suite/Minters/MinterSEAV1.sol +327 -664
- package/contracts/minter-suite/Minters/MinterSetPriceERC20V5.sol +278 -303
- package/contracts/minter-suite/Minters/MinterSetPriceHolderV5.sol +355 -446
- package/contracts/minter-suite/Minters/MinterSetPriceMerkleV5.sol +328 -416
- package/contracts/minter-suite/Minters/MinterSetPricePolyptychERC20V5.sol +538 -622
- package/contracts/minter-suite/Minters/MinterSetPricePolyptychV5.sol +429 -553
- package/contracts/minter-suite/Minters/MinterSetPriceV5.sol +180 -227
- package/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol +3 -10
- package/contracts/mock/ReentrancyHolderMockShared.sol +59 -0
- package/contracts/mock/ReentrancyMerkleMockShared.sol +58 -0
- package/contracts/mock/ReentrancyMockShared.sol +48 -0
- package/contracts/mock/ReentrancySEAMockShared.sol +40 -0
- package/contracts/randomizer/shared/SharedRandomizerV0.sol +78 -70
- package/package.json +39 -33
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
2
|
// Created By: Art Blocks Inc.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import "../../interfaces/v0.8.x/ISharedMinterV0.sol";
|
|
7
|
-
import "../../interfaces/v0.8.x/ISharedMinterHolderV0.sol";
|
|
8
|
-
import "../../interfaces/v0.8.x/IMinterFilterV1.sol";
|
|
9
|
-
|
|
10
|
-
import "../../libs/v0.8.x/ABHelpers.sol";
|
|
11
|
-
import "../../libs/v0.8.x/AuthLib.sol";
|
|
12
|
-
import "../../libs/v0.8.x/minter-libs/SplitFundsLib.sol";
|
|
13
|
-
import "../../libs/v0.8.x/minter-libs/MaxInvocationsLib.sol";
|
|
14
|
-
import "../../libs/v0.8.x/minter-libs/SetPriceLib.sol";
|
|
15
|
-
import "../../libs/v0.8.x/minter-libs/TokenHolderLib.sol";
|
|
16
|
-
import "../../libs/v0.8.x/minter-libs/PolyptychLib.sol";
|
|
17
|
-
|
|
18
|
-
import "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
|
|
19
|
-
import "@openzeppelin-4.5/contracts/utils/structs/EnumerableSet.sol";
|
|
20
|
-
|
|
4
|
+
// @dev fixed to specific solidity version for clarity and for more clear
|
|
5
|
+
// source code verification purposes.
|
|
21
6
|
pragma solidity 0.8.19;
|
|
22
7
|
|
|
8
|
+
import {IGenArt721CoreContractV3_Base} from "../../interfaces/v0.8.x/IGenArt721CoreContractV3_Base.sol";
|
|
9
|
+
import {IDelegationRegistry} from "../../interfaces/v0.8.x/IDelegationRegistry.sol";
|
|
10
|
+
import {ISharedMinterV0} from "../../interfaces/v0.8.x/ISharedMinterV0.sol";
|
|
11
|
+
import {ISharedMinterHolderV0} from "../../interfaces/v0.8.x/ISharedMinterHolderV0.sol";
|
|
12
|
+
import {IMinterFilterV1} from "../../interfaces/v0.8.x/IMinterFilterV1.sol";
|
|
13
|
+
|
|
14
|
+
import {ABHelpers} from "../../libs/v0.8.x/ABHelpers.sol";
|
|
15
|
+
import {AuthLib} from "../../libs/v0.8.x/AuthLib.sol";
|
|
16
|
+
import {SplitFundsLib} from "../../libs/v0.8.x/minter-libs/SplitFundsLib.sol";
|
|
17
|
+
import {MaxInvocationsLib} from "../../libs/v0.8.x/minter-libs/MaxInvocationsLib.sol";
|
|
18
|
+
import {SetPriceLib} from "../../libs/v0.8.x/minter-libs/SetPriceLib.sol";
|
|
19
|
+
import {TokenHolderLib} from "../../libs/v0.8.x/minter-libs/TokenHolderLib.sol";
|
|
20
|
+
import {PolyptychLib} from "../../libs/v0.8.x/minter-libs/PolyptychLib.sol";
|
|
21
|
+
|
|
22
|
+
import {ReentrancyGuard} from "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
|
|
23
|
+
import {EnumerableSet} from "@openzeppelin-4.5/contracts/utils/structs/EnumerableSet.sol";
|
|
24
|
+
|
|
23
25
|
/**
|
|
24
26
|
* @title Shared, filtered Minter contract that allows tokens to be minted with
|
|
25
27
|
* ETH when purchaser owns an allowlisted ERC-721 NFT.
|
|
@@ -71,6 +73,13 @@ pragma solidity 0.8.19;
|
|
|
71
73
|
* Token-level delegations are configured by the vault owner, and contract-
|
|
72
74
|
* level delegations must be configured for the core token contract as returned
|
|
73
75
|
* by the public immutable variable `genArt721CoreAddress`.
|
|
76
|
+
* ----------------------------------------------------------------------------
|
|
77
|
+
* @notice Caution: While Engine projects must be registered on the Art Blocks
|
|
78
|
+
* Core Registry to assign this minter, this minter does not enforce that a
|
|
79
|
+
* project is registered when configured or queried. This is primarily for gas
|
|
80
|
+
* optimization purposes. It is, therefore, possible that fake projects may be
|
|
81
|
+
* configured on this minter, but they will not be able to mint tokens due to
|
|
82
|
+
* checks performed by this minter's Minter Filter.
|
|
74
83
|
*/
|
|
75
84
|
contract MinterSetPricePolyptychV5 is
|
|
76
85
|
ReentrancyGuard,
|
|
@@ -84,13 +93,13 @@ contract MinterSetPricePolyptychV5 is
|
|
|
84
93
|
address public immutable minterFilterAddress;
|
|
85
94
|
|
|
86
95
|
/// Minter filter this minter may interact with.
|
|
87
|
-
IMinterFilterV1 private immutable
|
|
96
|
+
IMinterFilterV1 private immutable _minterFilter;
|
|
88
97
|
|
|
89
98
|
/// Delegation registry address
|
|
90
99
|
address public immutable delegationRegistryAddress;
|
|
91
100
|
|
|
92
101
|
/// Delegation registry address
|
|
93
|
-
IDelegationRegistry private immutable
|
|
102
|
+
IDelegationRegistry private immutable _delegationRegistryContract;
|
|
94
103
|
|
|
95
104
|
/// minterType for this minter
|
|
96
105
|
string public constant minterType = "MinterSetPricePolyptychV5";
|
|
@@ -98,68 +107,6 @@ contract MinterSetPricePolyptychV5 is
|
|
|
98
107
|
/// minter version for this minter
|
|
99
108
|
string public constant minterVersion = "v5.0.0";
|
|
100
109
|
|
|
101
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
102
|
-
// STATE VARIABLES FOR SetPriceLib begin here
|
|
103
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
104
|
-
|
|
105
|
-
/// contractAddress => projectId => set price project config
|
|
106
|
-
mapping(address => mapping(uint256 => SetPriceLib.SetPriceProjectConfig))
|
|
107
|
-
private _setPriceProjectConfigMapping;
|
|
108
|
-
|
|
109
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
110
|
-
// STATE VARIABLES FOR SetPriceLib end here
|
|
111
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
112
|
-
|
|
113
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
114
|
-
// STATE VARIABLES FOR SplitFundsLib begin here
|
|
115
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
116
|
-
|
|
117
|
-
// contractAddress => IsEngineCache
|
|
118
|
-
mapping(address => SplitFundsLib.IsEngineCache) private _isEngineCaches;
|
|
119
|
-
|
|
120
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
121
|
-
// STATE VARIABLES FOR SplitFundsLib end here
|
|
122
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
123
|
-
|
|
124
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
125
|
-
// STATE VARIABLES FOR MaxInvocationsLib begin here
|
|
126
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
127
|
-
|
|
128
|
-
// contractAddress => projectId => max invocations specific project config
|
|
129
|
-
mapping(address => mapping(uint256 => MaxInvocationsLib.MaxInvocationsProjectConfig))
|
|
130
|
-
private _maxInvocationsProjectConfigMapping;
|
|
131
|
-
|
|
132
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
133
|
-
// STATE VARIABLES FOR MaxInvocationsLib end here
|
|
134
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
135
|
-
|
|
136
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
137
|
-
// STATE VARIABLES FOR PolyptychLib begin here
|
|
138
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
139
|
-
|
|
140
|
-
// contractAddress => projectId => polyptych project config
|
|
141
|
-
mapping(address => mapping(uint256 => PolyptychLib.PolyptychProjectConfig))
|
|
142
|
-
private _polyptychProjectConfigs;
|
|
143
|
-
|
|
144
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
145
|
-
// STATE VARIABLES FOR PolyptychLib end here
|
|
146
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
147
|
-
|
|
148
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
149
|
-
// STATE VARIABLES FOR TokenHolderLib begin here
|
|
150
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* coreContract => projectId => ownedNFTAddress => ownedNFTProjectIds => bool
|
|
154
|
-
* projects whose holders are allowed to purchase a token on `projectId`
|
|
155
|
-
*/
|
|
156
|
-
mapping(address => mapping(uint256 => TokenHolderLib.HolderProjectConfig))
|
|
157
|
-
private _allowedProjectHoldersMapping;
|
|
158
|
-
|
|
159
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
160
|
-
// STATE VARIABLES FOR TokenHolderLib end here
|
|
161
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
162
|
-
|
|
163
110
|
// MODIFIERS
|
|
164
111
|
// @dev contract uses modifier-like internal functions instead of modifiers
|
|
165
112
|
// to reduce contract bytecode size
|
|
@@ -167,459 +114,416 @@ contract MinterSetPricePolyptychV5 is
|
|
|
167
114
|
|
|
168
115
|
/**
|
|
169
116
|
* @notice Initializes contract to be a Filtered Minter for
|
|
170
|
-
* `
|
|
171
|
-
* @param
|
|
117
|
+
* `minterFilter` minter filter.
|
|
118
|
+
* @param minterFilter Minter filter for which this will be a
|
|
172
119
|
* filtered minter.
|
|
173
|
-
* @param
|
|
120
|
+
* @param delegationRegistryAddress_ Delegation registry contract address.
|
|
174
121
|
*/
|
|
175
122
|
constructor(
|
|
176
|
-
address
|
|
177
|
-
address
|
|
123
|
+
address minterFilter,
|
|
124
|
+
address delegationRegistryAddress_
|
|
178
125
|
) ReentrancyGuard() {
|
|
179
|
-
minterFilterAddress =
|
|
180
|
-
|
|
126
|
+
minterFilterAddress = minterFilter;
|
|
127
|
+
_minterFilter = IMinterFilterV1(minterFilter);
|
|
181
128
|
|
|
182
|
-
delegationRegistryAddress =
|
|
183
|
-
|
|
184
|
-
|
|
129
|
+
delegationRegistryAddress = delegationRegistryAddress_;
|
|
130
|
+
_delegationRegistryContract = IDelegationRegistry(
|
|
131
|
+
delegationRegistryAddress_
|
|
132
|
+
);
|
|
133
|
+
emit TokenHolderLib.DelegationRegistryUpdated(
|
|
134
|
+
delegationRegistryAddress_
|
|
185
135
|
);
|
|
186
|
-
emit DelegationRegistryUpdated(_delegationRegistryAddress);
|
|
187
136
|
}
|
|
188
137
|
|
|
189
138
|
/**
|
|
190
|
-
* @notice Manually sets the local maximum invocations of project `
|
|
191
|
-
* with the provided `
|
|
192
|
-
* than or equal to the value of project `
|
|
139
|
+
* @notice Manually sets the local maximum invocations of project `projectId`
|
|
140
|
+
* with the provided `maxInvocations`, checking that `maxInvocations` is less
|
|
141
|
+
* than or equal to the value of project `project_id`'s maximum invocations that is
|
|
193
142
|
* set on the core contract.
|
|
194
|
-
* @dev Note that a `
|
|
143
|
+
* @dev Note that a `maxInvocations` of 0 can only be set if the current `invocations`
|
|
195
144
|
* value is also 0 and this would also set `maxHasBeenInvoked` to true, correctly short-circuiting
|
|
196
145
|
* this minter's purchase function, avoiding extra gas costs from the core contract's maxInvocations check.
|
|
197
|
-
* @param
|
|
198
|
-
* @param
|
|
199
|
-
* @param
|
|
146
|
+
* @param projectId Project ID to set the maximum invocations for.
|
|
147
|
+
* @param coreContract Core contract address for the given project.
|
|
148
|
+
* @param maxInvocations Maximum invocations to set for the project.
|
|
200
149
|
*/
|
|
201
150
|
function manuallyLimitProjectMaxInvocations(
|
|
202
|
-
uint256
|
|
203
|
-
address
|
|
204
|
-
uint24
|
|
151
|
+
uint256 projectId,
|
|
152
|
+
address coreContract,
|
|
153
|
+
uint24 maxInvocations
|
|
205
154
|
) external {
|
|
206
155
|
AuthLib.onlyArtist({
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
156
|
+
projectId: projectId,
|
|
157
|
+
coreContract: coreContract,
|
|
158
|
+
sender: msg.sender
|
|
159
|
+
});
|
|
160
|
+
MaxInvocationsLib.manuallyLimitProjectMaxInvocations({
|
|
161
|
+
projectId: projectId,
|
|
162
|
+
coreContract: coreContract,
|
|
163
|
+
maxInvocations: maxInvocations
|
|
210
164
|
});
|
|
211
|
-
MaxInvocationsLib.manuallyLimitProjectMaxInvocations(
|
|
212
|
-
_projectId,
|
|
213
|
-
_coreContract,
|
|
214
|
-
_maxInvocations,
|
|
215
|
-
_maxInvocationsProjectConfigMapping[_coreContract][_projectId]
|
|
216
|
-
);
|
|
217
|
-
emit ProjectMaxInvocationsLimitUpdated(
|
|
218
|
-
_projectId,
|
|
219
|
-
_coreContract,
|
|
220
|
-
_maxInvocations
|
|
221
|
-
);
|
|
222
165
|
}
|
|
223
166
|
|
|
224
167
|
/**
|
|
225
|
-
* @notice Updates this minter's price per token of project `
|
|
168
|
+
* @notice Updates this minter's price per token of project `projectId`
|
|
226
169
|
* to be '_pricePerTokenInWei`, in Wei.
|
|
227
170
|
* @dev Note that it is intentionally supported here that the configured
|
|
228
171
|
* price may be explicitly set to `0`.
|
|
229
|
-
* @param
|
|
230
|
-
* @param
|
|
231
|
-
* @param
|
|
172
|
+
* @param projectId Project ID to set the price per token for.
|
|
173
|
+
* @param coreContract Core contract address for the given project.
|
|
174
|
+
* @param pricePerTokenInWei Price per token to set for the project, in Wei.
|
|
232
175
|
*/
|
|
233
176
|
function updatePricePerTokenInWei(
|
|
234
|
-
uint256
|
|
235
|
-
address
|
|
236
|
-
uint248
|
|
177
|
+
uint256 projectId,
|
|
178
|
+
address coreContract,
|
|
179
|
+
uint248 pricePerTokenInWei
|
|
237
180
|
) external {
|
|
238
181
|
AuthLib.onlyArtist({
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
182
|
+
projectId: projectId,
|
|
183
|
+
coreContract: coreContract,
|
|
184
|
+
sender: msg.sender
|
|
185
|
+
});
|
|
186
|
+
SetPriceLib.updatePricePerToken({
|
|
187
|
+
projectId: projectId,
|
|
188
|
+
coreContract: coreContract,
|
|
189
|
+
pricePerToken: pricePerTokenInWei
|
|
242
190
|
});
|
|
243
|
-
SetPriceLib.SetPriceProjectConfig
|
|
244
|
-
storage _setPriceProjectConfig = _setPriceProjectConfigMapping[
|
|
245
|
-
_coreContract
|
|
246
|
-
][_projectId];
|
|
247
|
-
SetPriceLib.updatePricePerTokenInWei(
|
|
248
|
-
_pricePerTokenInWei,
|
|
249
|
-
_setPriceProjectConfig
|
|
250
|
-
);
|
|
251
|
-
emit PricePerTokenInWeiUpdated(
|
|
252
|
-
_projectId,
|
|
253
|
-
_coreContract,
|
|
254
|
-
_pricePerTokenInWei
|
|
255
|
-
);
|
|
256
191
|
|
|
257
192
|
// sync local max invocations if not initially populated
|
|
258
193
|
// @dev if local max invocations and maxHasBeenInvoked are both
|
|
259
194
|
// initial values, we know they have not been populated.
|
|
260
|
-
MaxInvocationsLib.MaxInvocationsProjectConfig
|
|
261
|
-
storage _maxInvocationsProjectConfig = _maxInvocationsProjectConfigMapping[
|
|
262
|
-
_coreContract
|
|
263
|
-
][_projectId];
|
|
264
195
|
// @dev if local maxInvocations and maxHasBeenInvoked are both
|
|
265
196
|
// initial values, we know they have not been populated on this minter
|
|
266
197
|
if (
|
|
267
|
-
MaxInvocationsLib.maxInvocationsIsUnconfigured(
|
|
268
|
-
|
|
269
|
-
|
|
198
|
+
MaxInvocationsLib.maxInvocationsIsUnconfigured({
|
|
199
|
+
projectId: projectId,
|
|
200
|
+
coreContract: coreContract
|
|
201
|
+
})
|
|
270
202
|
) {
|
|
271
|
-
syncProjectMaxInvocationsToCore(
|
|
203
|
+
syncProjectMaxInvocationsToCore({
|
|
204
|
+
projectId: projectId,
|
|
205
|
+
coreContract: coreContract
|
|
206
|
+
});
|
|
272
207
|
}
|
|
273
208
|
}
|
|
274
209
|
|
|
275
210
|
/**
|
|
276
|
-
* @notice Allows holders of NFTs at addresses `
|
|
277
|
-
* project IDs `
|
|
278
|
-
* `
|
|
279
|
-
* e.g. Allows holders of project `
|
|
280
|
-
* contract `
|
|
211
|
+
* @notice Allows holders of NFTs at addresses `ownedNFTAddresses`,
|
|
212
|
+
* project IDs `ownedNFTProjectIds` to mint on project `projectId`.
|
|
213
|
+
* `ownedNFTAddresses` assumed to be aligned with `ownedNFTProjectIds`.
|
|
214
|
+
* e.g. Allows holders of project `ownedNFTProjectIds[0]` on token
|
|
215
|
+
* contract `ownedNFTAddresses[0]` to mint `projectId`.
|
|
281
216
|
* WARNING: Only Art Blocks Core contracts are compatible with holder allowlisting,
|
|
282
217
|
* due to assumptions about tokenId and projectId relationships.
|
|
283
|
-
* @param
|
|
284
|
-
* @param
|
|
285
|
-
* @param
|
|
286
|
-
* allowlisted. Indexes must align with `
|
|
287
|
-
* @param
|
|
288
|
-
* holders shall be allowlisted to mint project `
|
|
289
|
-
* align with `
|
|
218
|
+
* @param projectId Project ID to enable minting on.
|
|
219
|
+
* @param coreContract Core contract address for the given project.
|
|
220
|
+
* @param ownedNFTAddresses NFT core addresses of projects to be
|
|
221
|
+
* allowlisted. Indexes must align with `ownedNFTProjectIds`.
|
|
222
|
+
* @param ownedNFTProjectIds Project IDs on `ownedNFTAddresses` whose
|
|
223
|
+
* holders shall be allowlisted to mint project `projectId`. Indexes must
|
|
224
|
+
* align with `ownedNFTAddresses`.
|
|
290
225
|
*/
|
|
291
226
|
function allowHoldersOfProjects(
|
|
292
|
-
uint256
|
|
293
|
-
address
|
|
294
|
-
address[]
|
|
295
|
-
uint256[]
|
|
227
|
+
uint256 projectId,
|
|
228
|
+
address coreContract,
|
|
229
|
+
address[] calldata ownedNFTAddresses,
|
|
230
|
+
uint256[] calldata ownedNFTProjectIds
|
|
296
231
|
) external {
|
|
297
232
|
AuthLib.onlyArtist({
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
233
|
+
projectId: projectId,
|
|
234
|
+
coreContract: coreContract,
|
|
235
|
+
sender: msg.sender
|
|
301
236
|
});
|
|
302
237
|
TokenHolderLib.allowHoldersOfProjects({
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
_ownedNFTProjectIds: _ownedNFTProjectIds
|
|
238
|
+
projectId: projectId,
|
|
239
|
+
coreContract: coreContract,
|
|
240
|
+
ownedNFTAddresses: ownedNFTAddresses,
|
|
241
|
+
ownedNFTProjectIds: ownedNFTProjectIds
|
|
308
242
|
});
|
|
309
|
-
|
|
310
|
-
// emit approve event
|
|
311
|
-
emit AllowedHoldersOfProjects(
|
|
312
|
-
_projectId,
|
|
313
|
-
_coreContract,
|
|
314
|
-
_ownedNFTAddresses,
|
|
315
|
-
_ownedNFTProjectIds
|
|
316
|
-
);
|
|
317
243
|
}
|
|
318
244
|
|
|
319
245
|
/**
|
|
320
|
-
* @notice Removes holders of NFTs at addresses `
|
|
321
|
-
* project IDs `
|
|
246
|
+
* @notice Removes holders of NFTs at addresses `ownedNFTAddresses`,
|
|
247
|
+
* project IDs `ownedNFTProjectIds` to mint on project `projectId`. If
|
|
322
248
|
* other projects owned by a holder are still allowed to mint, holder will
|
|
323
249
|
* maintain ability to purchase.
|
|
324
|
-
* `
|
|
325
|
-
* e.g. Removes holders of project `
|
|
326
|
-
* contract `
|
|
327
|
-
* @param
|
|
328
|
-
* @param
|
|
329
|
-
* @param
|
|
330
|
-
* from allowlist. Indexes must align with `
|
|
331
|
-
* @param
|
|
332
|
-
* holders will be removed from allowlist to mint project `
|
|
333
|
-
* Indexes must align with `
|
|
250
|
+
* `ownedNFTAddresses` assumed to be aligned with `ownedNFTProjectIds`.
|
|
251
|
+
* e.g. Removes holders of project `ownedNFTProjectIds[0]` on token
|
|
252
|
+
* contract `ownedNFTAddresses[0]` from mint allowlist of `projectId`.
|
|
253
|
+
* @param projectId Project ID to enable minting on.
|
|
254
|
+
* @param coreContract Core contract address for the given project.
|
|
255
|
+
* @param ownedNFTAddresses NFT core addresses of projects to be removed
|
|
256
|
+
* from allowlist. Indexes must align with `ownedNFTProjectIds`.
|
|
257
|
+
* @param ownedNFTProjectIds Project IDs on `ownedNFTAddresses` whose
|
|
258
|
+
* holders will be removed from allowlist to mint project `projectId`.
|
|
259
|
+
* Indexes must align with `ownedNFTAddresses`.
|
|
334
260
|
*/
|
|
335
261
|
function removeHoldersOfProjects(
|
|
336
|
-
uint256
|
|
337
|
-
address
|
|
338
|
-
address[]
|
|
339
|
-
uint256[]
|
|
262
|
+
uint256 projectId,
|
|
263
|
+
address coreContract,
|
|
264
|
+
address[] calldata ownedNFTAddresses,
|
|
265
|
+
uint256[] calldata ownedNFTProjectIds
|
|
340
266
|
) external {
|
|
341
267
|
AuthLib.onlyArtist({
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
268
|
+
projectId: projectId,
|
|
269
|
+
coreContract: coreContract,
|
|
270
|
+
sender: msg.sender
|
|
345
271
|
});
|
|
346
272
|
// require same length arrays
|
|
347
273
|
TokenHolderLib.removeHoldersOfProjects({
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
_ownedNFTProjectIds: _ownedNFTProjectIds
|
|
274
|
+
projectId: projectId,
|
|
275
|
+
coreContract: coreContract,
|
|
276
|
+
ownedNFTAddresses: ownedNFTAddresses,
|
|
277
|
+
ownedNFTProjectIds: ownedNFTProjectIds
|
|
353
278
|
});
|
|
354
|
-
|
|
355
|
-
// emit removed event
|
|
356
|
-
emit RemovedHoldersOfProjects(
|
|
357
|
-
_projectId,
|
|
358
|
-
_coreContract,
|
|
359
|
-
_ownedNFTAddresses,
|
|
360
|
-
_ownedNFTProjectIds
|
|
361
|
-
);
|
|
362
279
|
}
|
|
363
280
|
|
|
364
281
|
/**
|
|
365
|
-
* @notice Allows holders of NFTs at addresses `
|
|
366
|
-
* project IDs `
|
|
367
|
-
* Also removes holders of NFTs at addresses `
|
|
368
|
-
* project IDs `
|
|
369
|
-
* `
|
|
370
|
-
* `
|
|
371
|
-
* `
|
|
372
|
-
* e.g. Allows holders of project `
|
|
373
|
-
* contract `
|
|
374
|
-
* `
|
|
375
|
-
* `
|
|
282
|
+
* @notice Allows holders of NFTs at addresses `ownedNFTAddressesAdd`,
|
|
283
|
+
* project IDs `ownedNFTProjectIdsAdd` to mint on project `projectId`.
|
|
284
|
+
* Also removes holders of NFTs at addresses `ownedNFTAddressesRemove`,
|
|
285
|
+
* project IDs `ownedNFTProjectIdsRemove` from minting on project
|
|
286
|
+
* `projectId`.
|
|
287
|
+
* `ownedNFTAddressesAdd` assumed to be aligned with
|
|
288
|
+
* `ownedNFTProjectIdsAdd`.
|
|
289
|
+
* e.g. Allows holders of project `ownedNFTProjectIdsAdd[0]` on token
|
|
290
|
+
* contract `ownedNFTAddressesAdd[0]` to mint `projectId`.
|
|
291
|
+
* `ownedNFTAddressesRemove` also assumed to be aligned with
|
|
292
|
+
* `ownedNFTProjectIdsRemove`.
|
|
376
293
|
* WARNING: Only Art Blocks Core contracts are compatible with holder allowlisting,
|
|
377
294
|
* due to assumptions about tokenId and projectId relationships.
|
|
378
|
-
* @param
|
|
379
|
-
* @param
|
|
380
|
-
* @param
|
|
381
|
-
* allowlisted. Indexes must align with `
|
|
382
|
-
* @param
|
|
383
|
-
* whose holders shall be allowlisted to mint project `
|
|
384
|
-
* must align with `
|
|
385
|
-
* @param
|
|
295
|
+
* @param projectId Project ID to enable minting on.
|
|
296
|
+
* @param coreContract Core contract address for the given project.
|
|
297
|
+
* @param ownedNFTAddressesAdd NFT core addresses of projects to be
|
|
298
|
+
* allowlisted. Indexes must align with `ownedNFTProjectIdsAdd`.
|
|
299
|
+
* @param ownedNFTProjectIdsAdd Project IDs on `ownedNFTAddressesAdd`
|
|
300
|
+
* whose holders shall be allowlisted to mint project `projectId`. Indexes
|
|
301
|
+
* must align with `ownedNFTAddressesAdd`.
|
|
302
|
+
* @param ownedNFTAddressesRemove NFT core addresses of projects to be
|
|
386
303
|
* removed from allowlist. Indexes must align with
|
|
387
|
-
* `
|
|
388
|
-
* @param
|
|
389
|
-
* `
|
|
390
|
-
* to mint project `
|
|
391
|
-
* `
|
|
304
|
+
* `ownedNFTProjectIdsRemove`.
|
|
305
|
+
* @param ownedNFTProjectIdsRemove Project IDs on
|
|
306
|
+
* `ownedNFTAddressesRemove` whose holders will be removed from allowlist
|
|
307
|
+
* to mint project `projectId`. Indexes must align with
|
|
308
|
+
* `ownedNFTAddressesRemove`.
|
|
392
309
|
* @dev if a project is included in both add and remove arrays, it will be
|
|
393
310
|
* removed.
|
|
394
311
|
*/
|
|
395
312
|
function allowAndRemoveHoldersOfProjects(
|
|
396
|
-
uint256
|
|
397
|
-
address
|
|
398
|
-
address[]
|
|
399
|
-
uint256[]
|
|
400
|
-
address[]
|
|
401
|
-
uint256[]
|
|
313
|
+
uint256 projectId,
|
|
314
|
+
address coreContract,
|
|
315
|
+
address[] calldata ownedNFTAddressesAdd,
|
|
316
|
+
uint256[] calldata ownedNFTProjectIdsAdd,
|
|
317
|
+
address[] calldata ownedNFTAddressesRemove,
|
|
318
|
+
uint256[] calldata ownedNFTProjectIdsRemove
|
|
402
319
|
) external {
|
|
403
320
|
AuthLib.onlyArtist({
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
321
|
+
projectId: projectId,
|
|
322
|
+
coreContract: coreContract,
|
|
323
|
+
sender: msg.sender
|
|
407
324
|
});
|
|
408
325
|
TokenHolderLib.allowAndRemoveHoldersOfProjects({
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
_ownedNFTProjectIdsRemove: _ownedNFTProjectIdsRemove
|
|
326
|
+
projectId: projectId,
|
|
327
|
+
coreContract: coreContract,
|
|
328
|
+
ownedNFTAddressesAdd: ownedNFTAddressesAdd,
|
|
329
|
+
ownedNFTProjectIdsAdd: ownedNFTProjectIdsAdd,
|
|
330
|
+
ownedNFTAddressesRemove: ownedNFTAddressesRemove,
|
|
331
|
+
ownedNFTProjectIdsRemove: ownedNFTProjectIdsRemove
|
|
416
332
|
});
|
|
417
|
-
|
|
418
|
-
// emit events
|
|
419
|
-
emit AllowedHoldersOfProjects(
|
|
420
|
-
_projectId,
|
|
421
|
-
_coreContract,
|
|
422
|
-
_ownedNFTAddressesAdd,
|
|
423
|
-
_ownedNFTProjectIdsAdd
|
|
424
|
-
);
|
|
425
|
-
emit RemovedHoldersOfProjects(
|
|
426
|
-
_projectId,
|
|
427
|
-
_coreContract,
|
|
428
|
-
_ownedNFTAddressesRemove,
|
|
429
|
-
_ownedNFTProjectIdsRemove
|
|
430
|
-
);
|
|
431
333
|
}
|
|
432
334
|
|
|
433
335
|
/**
|
|
434
336
|
* @notice Allows the artist to increment the minter to the next polyptych panel
|
|
435
|
-
* @param
|
|
436
|
-
* @param
|
|
337
|
+
* @param projectId Project ID to increment to its next polyptych panel
|
|
338
|
+
* @param coreContract Core contract address for the given project.
|
|
437
339
|
*/
|
|
438
340
|
function incrementPolyptychProjectPanelId(
|
|
439
|
-
uint256
|
|
440
|
-
address
|
|
341
|
+
uint256 projectId,
|
|
342
|
+
address coreContract
|
|
441
343
|
) public {
|
|
442
344
|
AuthLib.onlyArtist({
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
345
|
+
projectId: projectId,
|
|
346
|
+
coreContract: coreContract,
|
|
347
|
+
sender: msg.sender
|
|
348
|
+
});
|
|
349
|
+
PolyptychLib.incrementPolyptychProjectPanelId({
|
|
350
|
+
projectId: projectId,
|
|
351
|
+
coreContract: coreContract
|
|
446
352
|
});
|
|
447
|
-
PolyptychLib.PolyptychProjectConfig
|
|
448
|
-
storage _polyptychProjectConfig = _polyptychProjectConfigs[
|
|
449
|
-
_coreContract
|
|
450
|
-
][_projectId];
|
|
451
|
-
PolyptychLib.incrementPolyptychProjectPanelId(_polyptychProjectConfig);
|
|
452
|
-
// index the update
|
|
453
|
-
emit ConfigValueSet(
|
|
454
|
-
_projectId,
|
|
455
|
-
_coreContract,
|
|
456
|
-
PolyptychLib.POLYPTYCH_PANEL_ID,
|
|
457
|
-
_polyptychProjectConfig.polyptychPanelId
|
|
458
|
-
);
|
|
459
353
|
}
|
|
460
354
|
|
|
461
355
|
/**
|
|
462
|
-
* @notice Purchases a token from project `
|
|
463
|
-
* `
|
|
464
|
-
* token ID `
|
|
465
|
-
* @param
|
|
466
|
-
* @param
|
|
467
|
-
* @param
|
|
356
|
+
* @notice Purchases a token from project `projectId` on core contract
|
|
357
|
+
* `coreContract` using an owned NFT at address `ownedNFTAddress` and
|
|
358
|
+
* token ID `ownedNFTTokenId` as the parent token.
|
|
359
|
+
* @param projectId Project ID to mint a token on.
|
|
360
|
+
* @param coreContract Core contract address for the given project.
|
|
361
|
+
* @param ownedNFTAddress ERC-721 NFT address holding the project token
|
|
468
362
|
* owned by msg.sender being used as the parent token.
|
|
469
|
-
* @param
|
|
363
|
+
* @param ownedNFTTokenId ERC-721 NFT token ID owned by msg.sender to be
|
|
470
364
|
* used as the parent token.
|
|
471
365
|
* @return tokenId Token ID of minted token
|
|
472
366
|
*/
|
|
473
367
|
function purchase(
|
|
474
|
-
uint256
|
|
475
|
-
address
|
|
476
|
-
address
|
|
477
|
-
uint256
|
|
368
|
+
uint256 projectId,
|
|
369
|
+
address coreContract,
|
|
370
|
+
address ownedNFTAddress,
|
|
371
|
+
uint256 ownedNFTTokenId
|
|
478
372
|
) external payable returns (uint256 tokenId) {
|
|
479
|
-
tokenId = purchaseTo(
|
|
480
|
-
msg.sender,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
address(0)
|
|
486
|
-
);
|
|
373
|
+
tokenId = purchaseTo({
|
|
374
|
+
to: msg.sender,
|
|
375
|
+
projectId: projectId,
|
|
376
|
+
coreContract: coreContract,
|
|
377
|
+
ownedNFTAddress: ownedNFTAddress,
|
|
378
|
+
ownedNFTTokenId: ownedNFTTokenId,
|
|
379
|
+
vault: address(0)
|
|
380
|
+
});
|
|
487
381
|
return tokenId;
|
|
488
382
|
}
|
|
489
383
|
|
|
490
384
|
/**
|
|
491
|
-
* @notice Purchases a token from project `
|
|
492
|
-
* `
|
|
493
|
-
* token ID `
|
|
494
|
-
* Sets the token's owner to `
|
|
495
|
-
* @param
|
|
496
|
-
* @param
|
|
497
|
-
* @param
|
|
498
|
-
* @param
|
|
385
|
+
* @notice Purchases a token from project `projectId` on core contract
|
|
386
|
+
* `coreContract` using an owned NFT at address `ownedNFTAddress` and
|
|
387
|
+
* token ID `ownedNFTTokenId` as the parent token.
|
|
388
|
+
* Sets the token's owner to `to`.
|
|
389
|
+
* @param to Address to be the new token's owner.
|
|
390
|
+
* @param projectId Project ID to mint a token on.
|
|
391
|
+
* @param coreContract Core contract address for the given project.
|
|
392
|
+
* @param ownedNFTAddress ERC-721 NFT holding the project token owned by
|
|
499
393
|
* msg.sender being used as the parent token.
|
|
500
|
-
* @param
|
|
394
|
+
* @param ownedNFTTokenId ERC-721 NFT token ID owned by msg.sender being used
|
|
501
395
|
* as the parent token.
|
|
502
396
|
* @return tokenId Token ID of minted token
|
|
503
397
|
*/
|
|
504
398
|
function purchaseTo(
|
|
505
|
-
address
|
|
506
|
-
uint256
|
|
507
|
-
address
|
|
508
|
-
address
|
|
509
|
-
uint256
|
|
399
|
+
address to,
|
|
400
|
+
uint256 projectId,
|
|
401
|
+
address coreContract,
|
|
402
|
+
address ownedNFTAddress,
|
|
403
|
+
uint256 ownedNFTTokenId
|
|
510
404
|
) external payable returns (uint256 tokenId) {
|
|
511
405
|
return
|
|
512
|
-
purchaseTo(
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
address(0)
|
|
519
|
-
);
|
|
406
|
+
purchaseTo({
|
|
407
|
+
to: to,
|
|
408
|
+
projectId: projectId,
|
|
409
|
+
coreContract: coreContract,
|
|
410
|
+
ownedNFTAddress: ownedNFTAddress,
|
|
411
|
+
ownedNFTTokenId: ownedNFTTokenId,
|
|
412
|
+
vault: address(0)
|
|
413
|
+
});
|
|
520
414
|
}
|
|
521
415
|
|
|
522
416
|
// public getter functions
|
|
523
417
|
/**
|
|
524
418
|
* @notice Gets the maximum invocations project configuration.
|
|
525
|
-
* @param
|
|
526
|
-
* @param
|
|
419
|
+
* @param projectId The ID of the project whose data needs to be fetched.
|
|
420
|
+
* @param coreContract The address of the core contract.
|
|
527
421
|
* @return MaxInvocationsLib.MaxInvocationsProjectConfig instance with the
|
|
528
422
|
* configuration data.
|
|
529
423
|
*/
|
|
530
424
|
function maxInvocationsProjectConfig(
|
|
531
|
-
uint256
|
|
532
|
-
address
|
|
425
|
+
uint256 projectId,
|
|
426
|
+
address coreContract
|
|
533
427
|
)
|
|
534
428
|
external
|
|
535
429
|
view
|
|
536
430
|
returns (MaxInvocationsLib.MaxInvocationsProjectConfig memory)
|
|
537
431
|
{
|
|
538
|
-
return
|
|
432
|
+
return
|
|
433
|
+
MaxInvocationsLib.getMaxInvocationsProjectConfig({
|
|
434
|
+
projectId: projectId,
|
|
435
|
+
coreContract: coreContract
|
|
436
|
+
});
|
|
539
437
|
}
|
|
540
438
|
|
|
541
439
|
/**
|
|
542
440
|
* @notice Gets the set price project configuration.
|
|
543
|
-
* @param
|
|
544
|
-
* @param
|
|
441
|
+
* @param projectId The ID of the project whose data needs to be fetched.
|
|
442
|
+
* @param coreContract The address of the core contract.
|
|
545
443
|
* @return SetPriceProjectConfig struct with the fixed price project
|
|
546
444
|
* configuration data.
|
|
547
445
|
*/
|
|
548
446
|
function setPriceProjectConfig(
|
|
549
|
-
uint256
|
|
550
|
-
address
|
|
447
|
+
uint256 projectId,
|
|
448
|
+
address coreContract
|
|
551
449
|
) external view returns (SetPriceLib.SetPriceProjectConfig memory) {
|
|
552
|
-
return
|
|
450
|
+
return
|
|
451
|
+
SetPriceLib.getSetPriceProjectConfig({
|
|
452
|
+
projectId: projectId,
|
|
453
|
+
coreContract: coreContract
|
|
454
|
+
});
|
|
553
455
|
}
|
|
554
456
|
|
|
555
457
|
/**
|
|
556
458
|
* @notice Checks if a specific NFT owner is allowed in a given project.
|
|
557
459
|
* @dev This function retrieves the allowance status of an NFT owner
|
|
558
460
|
* within a specific project from the allowedProjectHoldersMapping.
|
|
559
|
-
* @param
|
|
560
|
-
* @param
|
|
561
|
-
* @param
|
|
562
|
-
* @param
|
|
461
|
+
* @param projectId The ID of the project to check.
|
|
462
|
+
* @param coreContract Core contract address for the given project.
|
|
463
|
+
* @param ownedNFTAddress The address of the owned NFT contract.
|
|
464
|
+
* @param ownedNFTProjectId The ID of the owned NFT project.
|
|
563
465
|
* @return bool True if the NFT owner is allowed in the given project, False otherwise.
|
|
564
466
|
*/
|
|
565
467
|
function allowedProjectHolders(
|
|
566
|
-
uint256
|
|
567
|
-
address
|
|
568
|
-
address
|
|
569
|
-
uint256
|
|
468
|
+
uint256 projectId,
|
|
469
|
+
address coreContract,
|
|
470
|
+
address ownedNFTAddress,
|
|
471
|
+
uint256 ownedNFTProjectId
|
|
570
472
|
) external view returns (bool) {
|
|
571
473
|
return
|
|
572
|
-
|
|
573
|
-
.
|
|
474
|
+
TokenHolderLib
|
|
475
|
+
.getHolderProjectConfig({
|
|
476
|
+
projectId: projectId,
|
|
477
|
+
coreContract: coreContract
|
|
478
|
+
})
|
|
479
|
+
.allowedProjectHolders[ownedNFTAddress][ownedNFTProjectId];
|
|
574
480
|
}
|
|
575
481
|
|
|
576
482
|
/**
|
|
577
|
-
* @notice Returns if token is an allowlisted NFT for project `
|
|
578
|
-
* @param
|
|
579
|
-
* @param
|
|
580
|
-
* @param
|
|
581
|
-
* @param
|
|
483
|
+
* @notice Returns if token is an allowlisted NFT for project `projectId`.
|
|
484
|
+
* @param projectId Project ID to be checked.
|
|
485
|
+
* @param coreContract Core contract address for the given project.
|
|
486
|
+
* @param ownedNFTAddress ERC-721 NFT token address to be checked.
|
|
487
|
+
* @param ownedNFTTokenId ERC-721 NFT token ID to be checked.
|
|
582
488
|
* @return bool Token is allowlisted
|
|
583
489
|
* @dev does not check if token has been used to purchase
|
|
584
490
|
* @dev assumes project ID can be derived from tokenId / 1_000_000
|
|
585
491
|
*/
|
|
586
492
|
function isAllowlistedNFT(
|
|
587
|
-
uint256
|
|
588
|
-
address
|
|
589
|
-
address
|
|
590
|
-
uint256
|
|
493
|
+
uint256 projectId,
|
|
494
|
+
address coreContract,
|
|
495
|
+
address ownedNFTAddress,
|
|
496
|
+
uint256 ownedNFTTokenId
|
|
591
497
|
) external view returns (bool) {
|
|
592
498
|
return
|
|
593
499
|
TokenHolderLib.isAllowlistedNFT({
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
_ownedNFTTokenId: _ownedNFTTokenId
|
|
500
|
+
projectId: projectId,
|
|
501
|
+
coreContract: coreContract,
|
|
502
|
+
ownedNFTAddress: ownedNFTAddress,
|
|
503
|
+
ownedNFTTokenId: ownedNFTTokenId
|
|
599
504
|
});
|
|
600
505
|
}
|
|
601
506
|
|
|
602
507
|
/**
|
|
603
|
-
* @notice Checks if the specified `
|
|
604
|
-
* @dev This function retrieves the cached value of `
|
|
508
|
+
* @notice Checks if the specified `coreContract` is a valid engine contract.
|
|
509
|
+
* @dev This function retrieves the cached value of `isEngine` from
|
|
605
510
|
* the `isEngineCache` mapping. If the cached value is already set, it
|
|
606
|
-
* returns the cached value. Otherwise, it calls the `
|
|
607
|
-
* function from the `SplitFundsLib` library to check if `
|
|
511
|
+
* returns the cached value. Otherwise, it calls the `getV3CoreIsEngineView`
|
|
512
|
+
* function from the `SplitFundsLib` library to check if `coreContract`
|
|
608
513
|
* is a valid engine contract.
|
|
609
|
-
* @dev This function will revert if the provided `
|
|
514
|
+
* @dev This function will revert if the provided `coreContract` is not
|
|
610
515
|
* a valid Engine or V3 Flagship contract.
|
|
611
|
-
* @param
|
|
612
|
-
* @return bool indicating if `
|
|
516
|
+
* @param coreContract The address of the contract to check.
|
|
517
|
+
* @return bool indicating if `coreContract` is a valid engine contract.
|
|
613
518
|
*/
|
|
614
|
-
function isEngineView(address
|
|
615
|
-
SplitFundsLib.IsEngineCache storage isEngineCache =
|
|
616
|
-
|
|
617
|
-
];
|
|
519
|
+
function isEngineView(address coreContract) external view returns (bool) {
|
|
520
|
+
SplitFundsLib.IsEngineCache storage isEngineCache = SplitFundsLib
|
|
521
|
+
.getIsEngineCacheConfig(coreContract);
|
|
618
522
|
if (isEngineCache.isCached) {
|
|
619
523
|
return isEngineCache.isEngine;
|
|
620
524
|
} else {
|
|
621
|
-
// @dev this calls the non-modifying variant of
|
|
622
|
-
return SplitFundsLib.getV3CoreIsEngineView(
|
|
525
|
+
// @dev this calls the non-state-modifying variant of isEngine
|
|
526
|
+
return SplitFundsLib.getV3CoreIsEngineView(coreContract);
|
|
623
527
|
}
|
|
624
528
|
}
|
|
625
529
|
|
|
@@ -634,17 +538,18 @@ contract MinterSetPricePolyptychV5 is
|
|
|
634
538
|
* possible because the V3 core contract only allows maximum invocations
|
|
635
539
|
* to be reduced, not increased. Based on this rationale, we intentionally
|
|
636
540
|
* do not do input validation in this method as to whether or not the input
|
|
637
|
-
* @param
|
|
638
|
-
* @param
|
|
541
|
+
* @param projectId is an existing project ID.
|
|
542
|
+
* @param coreContract is an existing core contract address.
|
|
639
543
|
*/
|
|
640
544
|
function projectMaxHasBeenInvoked(
|
|
641
|
-
uint256
|
|
642
|
-
address
|
|
545
|
+
uint256 projectId,
|
|
546
|
+
address coreContract
|
|
643
547
|
) external view returns (bool) {
|
|
644
548
|
return
|
|
645
|
-
MaxInvocationsLib.getMaxHasBeenInvoked(
|
|
646
|
-
|
|
647
|
-
|
|
549
|
+
MaxInvocationsLib.getMaxHasBeenInvoked({
|
|
550
|
+
projectId: projectId,
|
|
551
|
+
coreContract: coreContract
|
|
552
|
+
});
|
|
648
553
|
}
|
|
649
554
|
|
|
650
555
|
/**
|
|
@@ -663,26 +568,27 @@ contract MinterSetPricePolyptychV5 is
|
|
|
663
568
|
* increased. When this happens, the minter will enable minting, allowing
|
|
664
569
|
* the core contract to enforce the max invocations check. Based on this
|
|
665
570
|
* rationale, we intentionally do not do input validation in this method as
|
|
666
|
-
* to whether or not the input `
|
|
667
|
-
* @param
|
|
668
|
-
* @param
|
|
571
|
+
* to whether or not the input `projectId` is an existing project ID.
|
|
572
|
+
* @param projectId is an existing project ID.
|
|
573
|
+
* @param coreContract is an existing core contract address.
|
|
669
574
|
*/
|
|
670
575
|
function projectMaxInvocations(
|
|
671
|
-
uint256
|
|
672
|
-
address
|
|
576
|
+
uint256 projectId,
|
|
577
|
+
address coreContract
|
|
673
578
|
) external view returns (uint256) {
|
|
674
579
|
return
|
|
675
|
-
MaxInvocationsLib.getMaxInvocations(
|
|
676
|
-
|
|
677
|
-
|
|
580
|
+
MaxInvocationsLib.getMaxInvocations({
|
|
581
|
+
projectId: projectId,
|
|
582
|
+
coreContract: coreContract
|
|
583
|
+
});
|
|
678
584
|
}
|
|
679
585
|
|
|
680
586
|
/**
|
|
681
587
|
* @notice Gets if price of token is configured, price of minting a
|
|
682
|
-
* token on project `
|
|
588
|
+
* token on project `projectId`, and currency symbol and address to be
|
|
683
589
|
* used as payment.
|
|
684
|
-
* @param
|
|
685
|
-
* @param
|
|
590
|
+
* @param projectId Project ID to get price information for
|
|
591
|
+
* @param coreContract Contract address of the core contract
|
|
686
592
|
* @return isConfigured true only if token price has been configured on
|
|
687
593
|
* this minter
|
|
688
594
|
* @return tokenPriceInWei current price of token on this minter - invalid
|
|
@@ -693,8 +599,8 @@ contract MinterSetPricePolyptychV5 is
|
|
|
693
599
|
* this minter. This minter always returns null address, reserved for ether
|
|
694
600
|
*/
|
|
695
601
|
function getPriceInfo(
|
|
696
|
-
uint256
|
|
697
|
-
address
|
|
602
|
+
uint256 projectId,
|
|
603
|
+
address coreContract
|
|
698
604
|
)
|
|
699
605
|
external
|
|
700
606
|
view
|
|
@@ -706,158 +612,139 @@ contract MinterSetPricePolyptychV5 is
|
|
|
706
612
|
)
|
|
707
613
|
{
|
|
708
614
|
SetPriceLib.SetPriceProjectConfig
|
|
709
|
-
storage
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
615
|
+
storage setPriceProjectConfig_ = SetPriceLib
|
|
616
|
+
.getSetPriceProjectConfig({
|
|
617
|
+
projectId: projectId,
|
|
618
|
+
coreContract: coreContract
|
|
619
|
+
});
|
|
620
|
+
isConfigured = setPriceProjectConfig_.priceIsConfigured;
|
|
621
|
+
tokenPriceInWei = setPriceProjectConfig_.pricePerToken;
|
|
714
622
|
currencySymbol = "ETH";
|
|
715
623
|
currencyAddress = address(0);
|
|
716
624
|
}
|
|
717
625
|
|
|
718
626
|
/**
|
|
719
627
|
* Gets the current polyptych panel ID for the given project.
|
|
720
|
-
* @param
|
|
721
|
-
* @param
|
|
628
|
+
* @param projectId Project ID to be queried
|
|
629
|
+
* @param coreContract Contract address of the core contract
|
|
722
630
|
* @return uint256 representing the current polyptych panel ID for the
|
|
723
631
|
* given project
|
|
724
632
|
*/
|
|
725
633
|
function getCurrentPolyptychPanelId(
|
|
726
|
-
uint256
|
|
727
|
-
address
|
|
634
|
+
uint256 projectId,
|
|
635
|
+
address coreContract
|
|
728
636
|
) external view returns (uint256) {
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
637
|
+
return
|
|
638
|
+
PolyptychLib.getPolyptychPanelId({
|
|
639
|
+
projectId: projectId,
|
|
640
|
+
coreContract: coreContract
|
|
641
|
+
});
|
|
734
642
|
}
|
|
735
643
|
|
|
736
644
|
/**
|
|
737
645
|
* Gets if the hash seed for the given project has been used on a given
|
|
738
646
|
* polyptych panel id. The current polyptych panel ID for a given project
|
|
739
647
|
* can be queried via the view function `getCurrentPolyptychPanelId`.
|
|
740
|
-
* @param
|
|
741
|
-
* @param
|
|
742
|
-
* @param
|
|
743
|
-
* @param
|
|
648
|
+
* @param projectId Project ID to be queried
|
|
649
|
+
* @param coreContract Contract address of the core contract
|
|
650
|
+
* @param panelId Panel ID to be queried
|
|
651
|
+
* @param hashSeed Hash seed to be queried
|
|
744
652
|
* @return bool representing if the hash seed has been used on the given
|
|
745
653
|
* polyptych panel ID
|
|
746
654
|
*/
|
|
747
655
|
function getPolyptychPanelHashSeedIsMinted(
|
|
748
|
-
uint256
|
|
749
|
-
address
|
|
750
|
-
uint256
|
|
751
|
-
bytes12
|
|
656
|
+
uint256 projectId,
|
|
657
|
+
address coreContract,
|
|
658
|
+
uint256 panelId,
|
|
659
|
+
bytes12 hashSeed
|
|
752
660
|
) external view returns (bool) {
|
|
753
|
-
PolyptychLib.PolyptychProjectConfig
|
|
754
|
-
storage _polyptychProjectConfig = _polyptychProjectConfigs[
|
|
755
|
-
_coreContract
|
|
756
|
-
][_projectId];
|
|
757
661
|
return
|
|
758
|
-
PolyptychLib.getPolyptychPanelHashSeedIsMinted(
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
662
|
+
PolyptychLib.getPolyptychPanelHashSeedIsMinted({
|
|
663
|
+
projectId: projectId,
|
|
664
|
+
coreContract: coreContract,
|
|
665
|
+
panelId: panelId,
|
|
666
|
+
hashSeed: hashSeed
|
|
667
|
+
});
|
|
763
668
|
}
|
|
764
669
|
|
|
765
670
|
/**
|
|
766
|
-
* @notice Syncs local maximum invocations of project `
|
|
671
|
+
* @notice Syncs local maximum invocations of project `projectId` based on
|
|
767
672
|
* the value currently defined in the core contract.
|
|
768
|
-
* @param
|
|
769
|
-
* @param
|
|
673
|
+
* @param projectId Project ID to set the maximum invocations for.
|
|
674
|
+
* @param coreContract Core contract address for the given project.
|
|
770
675
|
* @dev this enables gas reduction after maxInvocations have been reached -
|
|
771
676
|
* core contracts shall still enforce a maxInvocation check during mint.
|
|
772
677
|
*/
|
|
773
678
|
function syncProjectMaxInvocationsToCore(
|
|
774
|
-
uint256
|
|
775
|
-
address
|
|
679
|
+
uint256 projectId,
|
|
680
|
+
address coreContract
|
|
776
681
|
) public {
|
|
777
682
|
AuthLib.onlyArtist({
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
683
|
+
projectId: projectId,
|
|
684
|
+
coreContract: coreContract,
|
|
685
|
+
sender: msg.sender
|
|
781
686
|
});
|
|
782
687
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
_maxInvocationsProjectConfigMapping[_coreContract][_projectId]
|
|
788
|
-
);
|
|
789
|
-
emit ProjectMaxInvocationsLimitUpdated(
|
|
790
|
-
_projectId,
|
|
791
|
-
_coreContract,
|
|
792
|
-
maxInvocations
|
|
793
|
-
);
|
|
688
|
+
MaxInvocationsLib.syncProjectMaxInvocationsToCore({
|
|
689
|
+
projectId: projectId,
|
|
690
|
+
coreContract: coreContract
|
|
691
|
+
});
|
|
794
692
|
}
|
|
795
693
|
|
|
796
694
|
/**
|
|
797
|
-
* @notice Purchases a token from project `
|
|
798
|
-
* `
|
|
799
|
-
* token ID `
|
|
800
|
-
* Sets the token's owner to `
|
|
801
|
-
* Parent token must be owned by `msg.sender`, or `
|
|
802
|
-
* is a valid delegate for `
|
|
803
|
-
* @param
|
|
804
|
-
* @param
|
|
805
|
-
* @param
|
|
806
|
-
* @param
|
|
807
|
-
* msg.sender or `
|
|
808
|
-
* @param
|
|
809
|
-
* `
|
|
695
|
+
* @notice Purchases a token from project `projectId` on core contract
|
|
696
|
+
* `coreContract` using an owned NFT at address `ownedNFTAddress` and
|
|
697
|
+
* token ID `ownedNFTTokenId` as the parent token.
|
|
698
|
+
* Sets the token's owner to `to`.
|
|
699
|
+
* Parent token must be owned by `msg.sender`, or `vault` if `msg.sender`
|
|
700
|
+
* is a valid delegate for `vault`.
|
|
701
|
+
* @param to Address to be the new token's owner.
|
|
702
|
+
* @param projectId Project ID to mint a token on.
|
|
703
|
+
* @param coreContract Core contract address for the given project.
|
|
704
|
+
* @param ownedNFTAddress ERC-721 NFT holding the project token owned by
|
|
705
|
+
* msg.sender or `vault` being used as the parent token.
|
|
706
|
+
* @param ownedNFTTokenId ERC-721 NFT token ID owned by msg.sender or
|
|
707
|
+
* `vault` being used as the parent token.
|
|
810
708
|
* @return tokenId Token ID of minted token
|
|
811
709
|
*/
|
|
812
710
|
function purchaseTo(
|
|
813
|
-
address
|
|
814
|
-
uint256
|
|
815
|
-
address
|
|
816
|
-
address
|
|
817
|
-
uint256
|
|
818
|
-
address
|
|
711
|
+
address to,
|
|
712
|
+
uint256 projectId,
|
|
713
|
+
address coreContract,
|
|
714
|
+
address ownedNFTAddress,
|
|
715
|
+
uint256 ownedNFTTokenId,
|
|
716
|
+
address vault
|
|
819
717
|
) public payable nonReentrant returns (uint256 tokenId) {
|
|
820
718
|
// CHECKS
|
|
821
|
-
|
|
822
|
-
storage _setPriceProjectConfig = _setPriceProjectConfigMapping[
|
|
823
|
-
_coreContract
|
|
824
|
-
][_projectId];
|
|
825
|
-
MaxInvocationsLib.MaxInvocationsProjectConfig
|
|
826
|
-
storage _maxInvocationsProjectConfig = _maxInvocationsProjectConfigMapping[
|
|
827
|
-
_coreContract
|
|
828
|
-
][_projectId];
|
|
829
|
-
|
|
719
|
+
// pre-mint MaxInvocationsLib checks
|
|
830
720
|
// Note that `maxHasBeenInvoked` is only checked here to reduce gas
|
|
831
721
|
// consumption after a project has been fully minted.
|
|
832
|
-
// `
|
|
722
|
+
// `maxInvocationsProjectConfig.maxHasBeenInvoked` is locally cached to reduce
|
|
833
723
|
// gas consumption, but if not in sync with the core contract's value,
|
|
834
724
|
// the core contract also enforces its own max invocation check during
|
|
835
725
|
// minting.
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
);
|
|
726
|
+
MaxInvocationsLib.preMintChecks({
|
|
727
|
+
projectId: projectId,
|
|
728
|
+
coreContract: coreContract
|
|
729
|
+
});
|
|
840
730
|
|
|
841
|
-
//
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
731
|
+
// pre-mint checks for set price lib, and get price per token in wei
|
|
732
|
+
// @dev price per token is loaded into memory here for gas efficiency
|
|
733
|
+
uint256 pricePerTokenInWei = SetPriceLib.preMintChecksAndGetPrice({
|
|
734
|
+
projectId: projectId,
|
|
735
|
+
coreContract: coreContract
|
|
736
|
+
});
|
|
846
737
|
// @dev pricePerTokenInWei intentionally not loaded as local variable
|
|
847
738
|
// to avoid stack too deep error
|
|
848
|
-
require(
|
|
849
|
-
msg.value >= _setPriceProjectConfig.pricePerTokenInWei,
|
|
850
|
-
"Min value to mint req."
|
|
851
|
-
);
|
|
739
|
+
require(msg.value >= pricePerTokenInWei, "Min value to mint req.");
|
|
852
740
|
|
|
853
741
|
// require token used to claim to be in set of allowlisted NFTs
|
|
854
742
|
require(
|
|
855
743
|
TokenHolderLib.isAllowlistedNFT({
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
_ownedNFTTokenId: _ownedNFTTokenId
|
|
744
|
+
projectId: projectId,
|
|
745
|
+
coreContract: coreContract,
|
|
746
|
+
ownedNFTAddress: ownedNFTAddress,
|
|
747
|
+
ownedNFTTokenId: ownedNFTTokenId
|
|
861
748
|
}),
|
|
862
749
|
"Only allowlisted NFTs"
|
|
863
750
|
);
|
|
@@ -865,31 +752,31 @@ contract MinterSetPricePolyptychV5 is
|
|
|
865
752
|
// NOTE: delegate-vault handling **begins here**.
|
|
866
753
|
|
|
867
754
|
// handle that the vault may be either the `msg.sender` in the case
|
|
868
|
-
// that there is not a true vault, or may be `
|
|
755
|
+
// that there is not a true vault, or may be `vault` if one is
|
|
869
756
|
// provided explicitly (and it is valid).
|
|
870
|
-
address
|
|
871
|
-
if (
|
|
757
|
+
address vault_ = msg.sender;
|
|
758
|
+
if (vault != address(0)) {
|
|
872
759
|
// If a vault is provided, it must be valid, otherwise throw rather
|
|
873
760
|
// than optimistically-minting with original `msg.sender`.
|
|
874
761
|
// Note, we do not check `checkDelegateForAll` or `checkDelegateForContract` as well,
|
|
875
762
|
// as they are known to be implicitly checked by calling `checkDelegateForToken`.
|
|
876
|
-
bool isValidVault =
|
|
877
|
-
.checkDelegateForToken(
|
|
878
|
-
msg.sender,
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
);
|
|
763
|
+
bool isValidVault = _delegationRegistryContract
|
|
764
|
+
.checkDelegateForToken({
|
|
765
|
+
delegate: msg.sender,
|
|
766
|
+
vault: vault,
|
|
767
|
+
contract_: coreContract,
|
|
768
|
+
tokenId: ownedNFTTokenId
|
|
769
|
+
});
|
|
883
770
|
require(isValidVault, "Invalid delegate-vault pairing");
|
|
884
|
-
|
|
771
|
+
vault_ = vault;
|
|
885
772
|
}
|
|
886
773
|
|
|
887
774
|
// we need the new token ID in advance of the randomizer setting a token hash
|
|
888
775
|
IGenArt721CoreContractV3_Base genArtCoreContract = IGenArt721CoreContractV3_Base(
|
|
889
|
-
|
|
776
|
+
coreContract
|
|
890
777
|
);
|
|
891
|
-
(uint256
|
|
892
|
-
|
|
778
|
+
(uint256 invocations, , , , , ) = genArtCoreContract.projectStateData(
|
|
779
|
+
projectId
|
|
893
780
|
);
|
|
894
781
|
|
|
895
782
|
// EFFECTS
|
|
@@ -897,60 +784,54 @@ contract MinterSetPricePolyptychV5 is
|
|
|
897
784
|
// we need to store the new token ID before it is minted so the randomizer can query it
|
|
898
785
|
// block scope to avoid stack too deep error
|
|
899
786
|
{
|
|
900
|
-
bytes12
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
);
|
|
787
|
+
bytes12 targetHashSeed = PolyptychLib.getTokenHashSeed({
|
|
788
|
+
coreContract: ownedNFTAddress,
|
|
789
|
+
tokenId: ownedNFTTokenId
|
|
790
|
+
});
|
|
904
791
|
|
|
905
|
-
//
|
|
906
|
-
{
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
_targetHashSeed
|
|
915
|
-
);
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
uint256 _newTokenId = ABHelpers.tokenIdFromProjectIdAndTokenNumber({
|
|
919
|
-
_projectId: _projectId,
|
|
792
|
+
// validates hash seed and ensures each hash seed used max once per panel
|
|
793
|
+
PolyptychLib.validatePolyptychEffects({
|
|
794
|
+
projectId: projectId,
|
|
795
|
+
coreContract: coreContract,
|
|
796
|
+
tokenHashSeed: targetHashSeed
|
|
797
|
+
});
|
|
798
|
+
|
|
799
|
+
uint256 newTokenId = ABHelpers.tokenIdFromProjectIdAndTokenNumber({
|
|
800
|
+
projectId: projectId,
|
|
920
801
|
// @dev next token number is current invocations due to number
|
|
921
802
|
// being zero-based-indexed
|
|
922
|
-
|
|
803
|
+
tokenNumber: invocations
|
|
923
804
|
});
|
|
924
805
|
PolyptychLib.setPolyptychHashSeed({
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
806
|
+
coreContract: coreContract,
|
|
807
|
+
tokenId: newTokenId, // new token ID
|
|
808
|
+
hashSeed: targetHashSeed
|
|
928
809
|
});
|
|
929
810
|
|
|
930
811
|
// once mint() is called, the polyptych randomizer will either:
|
|
931
812
|
// 1) assign a random token hash
|
|
932
813
|
// 2) if configured, obtain the token hash from the `polyptychSeedHashes` mapping
|
|
933
|
-
tokenId =
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
);
|
|
814
|
+
tokenId = _minterFilter.mint_joo({
|
|
815
|
+
to: to,
|
|
816
|
+
projectId: projectId,
|
|
817
|
+
coreContract: coreContract,
|
|
818
|
+
sender: vault_
|
|
819
|
+
});
|
|
939
820
|
|
|
940
821
|
// NOTE: delegate-vault handling **ends here**.
|
|
941
822
|
|
|
942
823
|
// redundant check against reentrancy
|
|
943
824
|
PolyptychLib.validateAssignedHashSeed({
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
825
|
+
coreContract: coreContract,
|
|
826
|
+
tokenId: tokenId,
|
|
827
|
+
targetHashSeed: targetHashSeed
|
|
947
828
|
});
|
|
948
829
|
}
|
|
949
830
|
|
|
950
|
-
MaxInvocationsLib.validatePurchaseEffectsInvocations(
|
|
951
|
-
tokenId,
|
|
952
|
-
|
|
953
|
-
);
|
|
831
|
+
MaxInvocationsLib.validatePurchaseEffectsInvocations({
|
|
832
|
+
tokenId: tokenId,
|
|
833
|
+
coreContract: coreContract
|
|
834
|
+
});
|
|
954
835
|
|
|
955
836
|
// INTERACTIONS
|
|
956
837
|
// block scope to avoid stack too deep error
|
|
@@ -965,26 +846,21 @@ contract MinterSetPricePolyptychV5 is
|
|
|
965
846
|
// @dev if the artist is the sender, then the NFT must be owned by the
|
|
966
847
|
// recipient, otherwise the NFT must be owned by the vault
|
|
967
848
|
address _artist = genArtCoreContract.projectIdToArtistAddress(
|
|
968
|
-
|
|
849
|
+
projectId
|
|
969
850
|
);
|
|
970
|
-
address targetOwner = (msg.sender == _artist) ?
|
|
851
|
+
address targetOwner = (msg.sender == _artist) ? to : vault_;
|
|
971
852
|
TokenHolderLib.validateNFTOwnership({
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
853
|
+
ownedNFTAddress: ownedNFTAddress,
|
|
854
|
+
ownedNFTTokenId: ownedNFTTokenId,
|
|
855
|
+
targetOwner: targetOwner
|
|
975
856
|
});
|
|
976
857
|
}
|
|
977
858
|
|
|
978
859
|
// split funds
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
SplitFundsLib.splitFundsETH({
|
|
984
|
-
_projectId: _projectId,
|
|
985
|
-
_pricePerTokenInWei: _setPriceProjectConfig.pricePerTokenInWei,
|
|
986
|
-
_coreContract: _coreContract,
|
|
987
|
-
_isEngine: isEngine
|
|
860
|
+
SplitFundsLib.splitFundsETHRefundSender({
|
|
861
|
+
projectId: projectId,
|
|
862
|
+
pricePerTokenInWei: pricePerTokenInWei,
|
|
863
|
+
coreContract: coreContract
|
|
988
864
|
});
|
|
989
865
|
|
|
990
866
|
return tokenId;
|