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