@artblocks/contracts 0.0.1 → 1.0.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 +27 -2
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/Address.json +10 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/Counters.json +10 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/CustomERC721Metadata.json +425 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/ERC165.json +38 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/ERC721.json +322 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/ERC721Enumerable.json +384 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/ERC721ReceiverMock.json +101 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/GenArt721.json +1528 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/IERC165.json +32 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/IERC721.json +316 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/IERC721Enumerable.json +378 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/IERC721Receiver.json +47 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/SafeMath.json +10 -0
- package/artifacts/contracts/archive/GenArt721CoreV0.sol/Strings.json +10 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/Address.json +10 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/Counters.json +10 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/CustomERC721Metadata.json +425 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/ERC165.json +38 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/ERC721.json +322 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/ERC721Enumerable.json +384 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/GenArt721Core.json +1773 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/IERC165.json +32 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/IERC721.json +316 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/IERC721Enumerable.json +378 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/IERC721Receiver.json +47 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/Randomizer.json +26 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/SafeMath.json +10 -0
- package/artifacts/contracts/archive/GenArt721CoreV1.sol/Strings.json +10 -0
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV0.sol/MinterDAExpV0.json +575 -0
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV1.sol/MinterDAExpV1.json +463 -0
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDAExp/MinterDAExpV2.sol/MinterDAExpV2.json +3 -3
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDAExp/MinterDAExpV3.sol/MinterDAExpV3.json +3 -3
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol/MinterDAExpSettlementV0.json +15 -15
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV0.sol/MinterDALinV0.json +551 -0
- package/artifacts/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV1.sol/MinterDALinV1.json +439 -0
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDALin/MinterDALinV2.sol/MinterDALinV2.json +3 -3
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDALin/MinterDALinV3.sol/MinterDALinV3.json +3 -3
- package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV0.sol/MinterHolderV0.json +622 -0
- package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV1.sol/MinterHolderV1.json +719 -0
- package/artifacts/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +794 -0
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterHolder/MinterHolderV3.sol/MinterHolderV3.json +3 -3
- package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV0.sol/MinterMerkleV0.json +873 -0
- package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV1.sol/MinterMerkleV1.json +932 -0
- package/artifacts/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV2.sol/MinterMerkleV2.json +984 -0
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterMerkle/MinterMerkleV3.sol/MinterMerkleV3.json +3 -3
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterMerkle/MinterMerkleV4.sol/MinterMerkleV4.json +3 -3
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV0.sol/MinterSetPriceV0.json +400 -0
- package/artifacts/contracts/{minter-suite/Minters/MinterSetPrice/deprecated → archive/minter-suite/Minters/MinterSetPrice}/MinterSetPriceV1.sol/MinterSetPriceV1.json +3 -3
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterSetPrice/MinterSetPriceV2.sol/MinterSetPriceV2.json +3 -3
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterSetPrice/MinterSetPriceV3.sol/MinterSetPriceV3.json +3 -3
- package/artifacts/contracts/{minter-suite/Minters/MinterSetPriceERC20/deprecated → archive/minter-suite/Minters/MinterSetPriceERC20}/MinterSetPriceERC20V0.sol/MinterSetPriceERC20V0.json +3 -3
- package/artifacts/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V1.sol/MinterSetPriceERC20V1.json +349 -0
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol/MinterSetPriceERC20V2.json +3 -3
- package/artifacts/contracts/{minter-suite → archive/minter-suite}/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol/MinterSetPriceERC20V3.json +3 -3
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDAExpSettlementV0.sol/IFilteredMinterDAExpSettlementV0.json +12 -12
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDAExpSettlement_Mixin.sol/IFilteredMinterDAExpSettlement_Mixin.json +161 -0
- package/artifacts/contracts/interfaces/0.8.x/IMinterBaseV0.sol/IMinterBaseV0.json +24 -0
- package/artifacts/contracts/interfaces/0.8.x/IMintingAPICoreV0.sol/IMintingAPICoreV0.json +185 -0
- package/artifacts/contracts/interfaces/0.8.x/IMintingAPIMinterV0.sol/IMintingAPIMinterV0.json +88 -0
- package/artifacts/contracts/minter-suite/Minters/MinterBase_v0_1_1.sol/MinterBase.json +24 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV1.sol/MinterDAExpSettlementV1.json +1066 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpV4.sol/MinterDAExpV4.json +869 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDALinV4.sol/MinterDALinV4.json +845 -0
- package/artifacts/contracts/minter-suite/Minters/MinterHolderV4.sol/MinterHolderV4.json +1113 -0
- package/artifacts/contracts/minter-suite/Minters/MinterMerkleV5.sol/MinterMerkleV5.json +1052 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V4.sol/MinterSetPriceERC20V4.json +755 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV4.sol/MinterSetPriceV4.json +684 -0
- package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +1817 -0
- package/contracts/archive/GenArt721CoreV0.sol +1621 -0
- package/contracts/archive/GenArt721CoreV1.sol +1577 -0
- package/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV0.sol +503 -0
- package/contracts/archive/minter-suite/Minters/MinterDAExp/MinterDAExpV1.sol +442 -0
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDAExp/MinterDAExpV2.sol +3 -3
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDAExp/MinterDAExpV3.sol +3 -3
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol +3 -3
- package/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV0.sol +450 -0
- package/contracts/archive/minter-suite/Minters/MinterDALin/MinterDALinV1.sol +406 -0
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDALin/MinterDALinV2.sol +3 -3
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDALin/MinterDALinV3.sol +3 -3
- package/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV0.sol +540 -0
- package/contracts/archive/minter-suite/Minters/MinterHolder/MinterHolderV1.sol +648 -0
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterHolder/MinterHolderV2.sol +6 -6
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterHolder/MinterHolderV3.sol +4 -4
- package/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV0.sol +523 -0
- package/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV1.sol +602 -0
- package/contracts/archive/minter-suite/Minters/MinterMerkle/MinterMerkleV2.sol +679 -0
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterMerkle/MinterMerkleV3.sol +4 -4
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterMerkle/MinterMerkleV4.sol +4 -4
- package/contracts/archive/minter-suite/Minters/MinterSetPrice/MinterSetPriceV0.sol +333 -0
- package/contracts/{minter-suite/Minters/MinterSetPrice/deprecated → archive/minter-suite/Minters/MinterSetPrice}/MinterSetPriceV1.sol +0 -0
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterSetPrice/MinterSetPriceV2.sol +3 -3
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterSetPrice/MinterSetPriceV3.sol +3 -3
- package/contracts/{minter-suite/Minters/MinterSetPriceERC20/deprecated → archive/minter-suite/Minters/MinterSetPriceERC20}/MinterSetPriceERC20V0.sol +0 -0
- package/contracts/archive/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V1.sol +411 -0
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol +3 -3
- package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol +3 -3
- package/contracts/interfaces/0.8.x/IFilteredMinterDAExpSettlementV0.sol +4 -53
- package/contracts/interfaces/0.8.x/IFilteredMinterDAExpSettlement_Mixin.sol +62 -0
- package/contracts/interfaces/0.8.x/IMinterBaseV0.sol +20 -0
- package/contracts/interfaces/0.8.x/IMintingAPICoreV0.sol +62 -0
- package/contracts/interfaces/0.8.x/IMintingAPIMinterV0.sol +31 -0
- package/contracts/minter-suite/Minters/MinterBase_v0_1_1.sol +293 -0
- package/contracts/minter-suite/Minters/MinterDAExpSettlementV1.sol +1026 -0
- package/contracts/minter-suite/Minters/MinterDAExpV4.sol +572 -0
- package/contracts/minter-suite/Minters/MinterDALinV4.sol +525 -0
- package/contracts/minter-suite/Minters/MinterHolderV4.sol +752 -0
- package/contracts/minter-suite/Minters/MinterMerkleV5.sol +688 -0
- package/contracts/minter-suite/Minters/MinterSetPriceERC20V4.sol +451 -0
- package/contracts/minter-suite/Minters/MinterSetPriceV4.sol +352 -0
- package/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol +1979 -0
- package/package.json +1 -1
- package/artifacts/contracts/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +0 -794
|
@@ -0,0 +1,648 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
// Created By: Art Blocks Inc.
|
|
3
|
+
|
|
4
|
+
import "../../../../interfaces/0.8.x/IGenArt721CoreContractV3.sol";
|
|
5
|
+
import "../../../../interfaces/0.8.x/IMinterFilterV0.sol";
|
|
6
|
+
import "../../../../interfaces/0.8.x/IFilteredMinterHolderV0.sol";
|
|
7
|
+
|
|
8
|
+
import "@openzeppelin-4.5/contracts/token/ERC721/IERC721.sol";
|
|
9
|
+
import "@openzeppelin-4.5/contracts/token/ERC20/IERC20.sol";
|
|
10
|
+
import "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
|
|
11
|
+
import "@openzeppelin-4.5/contracts/utils/structs/EnumerableSet.sol";
|
|
12
|
+
import "@openzeppelin-4.5/contracts/utils/structs/EnumerableMap.sol";
|
|
13
|
+
|
|
14
|
+
pragma solidity 0.8.17;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @title Filtered Minter contract that allows tokens to be minted with ETH
|
|
18
|
+
* when purchaser owns an allowlisted ERC-721 NFT.
|
|
19
|
+
* This is designed to be used with IGenArt721CoreContractV3 contracts.
|
|
20
|
+
* @author Art Blocks Inc.
|
|
21
|
+
* @notice Privileged Roles and Ownership:
|
|
22
|
+
* This contract is designed to be managed, with limited powers.
|
|
23
|
+
* Privileged roles and abilities are controlled by the core contract's Admin
|
|
24
|
+
* ACL contract and a project's artist. Both of these roles hold extensive
|
|
25
|
+
* power and can modify minter details.
|
|
26
|
+
* Care must be taken to ensure that the admin ACL contract and artist
|
|
27
|
+
* addresses are secure behind a multi-sig or other access control mechanism.
|
|
28
|
+
* ----------------------------------------------------------------------------
|
|
29
|
+
* The following functions are restricted to the core contract's Admin ACL
|
|
30
|
+
* contract:
|
|
31
|
+
* - registerNFTAddress
|
|
32
|
+
* - unregisterNFTAddress
|
|
33
|
+
* ----------------------------------------------------------------------------
|
|
34
|
+
* The following functions are restricted to a project's artist:
|
|
35
|
+
* - allowHoldersOfProjects
|
|
36
|
+
* - removeHoldersOfProjects
|
|
37
|
+
* - allowRemoveHoldersOfProjects
|
|
38
|
+
* - updatePricePerTokenInWei
|
|
39
|
+
* ----------------------------------------------------------------------------
|
|
40
|
+
* Additional admin and artist privileged roles may be described on other
|
|
41
|
+
* contracts that this minter integrates with.
|
|
42
|
+
*/
|
|
43
|
+
contract MinterHolderV1 is ReentrancyGuard, IFilteredMinterHolderV0 {
|
|
44
|
+
// add Enumerable Set methods
|
|
45
|
+
using EnumerableSet for EnumerableSet.AddressSet;
|
|
46
|
+
|
|
47
|
+
/// Core contract address this minter interacts with
|
|
48
|
+
address public immutable genArt721CoreAddress;
|
|
49
|
+
|
|
50
|
+
/// This contract handles cores with interface IV3
|
|
51
|
+
IGenArt721CoreContractV3 private immutable genArtCoreContract;
|
|
52
|
+
|
|
53
|
+
/// Minter filter address this minter interacts with
|
|
54
|
+
address public immutable minterFilterAddress;
|
|
55
|
+
|
|
56
|
+
/// Minter filter this minter may interact with.
|
|
57
|
+
IMinterFilterV0 private immutable minterFilter;
|
|
58
|
+
|
|
59
|
+
/// minterType for this minter
|
|
60
|
+
string public constant minterType = "MinterHolderV1";
|
|
61
|
+
|
|
62
|
+
uint256 constant ONE_MILLION = 1_000_000;
|
|
63
|
+
|
|
64
|
+
struct ProjectConfig {
|
|
65
|
+
bool maxHasBeenInvoked;
|
|
66
|
+
bool priceIsConfigured;
|
|
67
|
+
uint24 maxInvocations;
|
|
68
|
+
uint256 pricePerTokenInWei;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
mapping(uint256 => ProjectConfig) public projectConfig;
|
|
72
|
+
|
|
73
|
+
/// Set of core contracts allowed to be queried for token holders
|
|
74
|
+
EnumerableSet.AddressSet private _registeredNFTAddresses;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* projectId => ownedNFTAddress => ownedNFTProjectIds => bool
|
|
78
|
+
* projects whose holders are allowed to purchase a token on `projectId`
|
|
79
|
+
*/
|
|
80
|
+
mapping(uint256 => mapping(address => mapping(uint256 => bool)))
|
|
81
|
+
public allowedProjectHolders;
|
|
82
|
+
|
|
83
|
+
// modifier to restrict access to only AdminACL allowed calls
|
|
84
|
+
// @dev defers which ACL contract is used to the core contract
|
|
85
|
+
modifier onlyCoreAdminACL(bytes4 _selector) {
|
|
86
|
+
require(
|
|
87
|
+
genArtCoreContract.adminACLAllowed(
|
|
88
|
+
msg.sender,
|
|
89
|
+
address(this),
|
|
90
|
+
_selector
|
|
91
|
+
),
|
|
92
|
+
"Only Core AdminACL allowed"
|
|
93
|
+
);
|
|
94
|
+
_;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
modifier onlyArtist(uint256 _projectId) {
|
|
98
|
+
require(
|
|
99
|
+
msg.sender ==
|
|
100
|
+
genArtCoreContract.projectIdToArtistAddress(_projectId),
|
|
101
|
+
"Only Artist"
|
|
102
|
+
);
|
|
103
|
+
_;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @notice Initializes contract to be a Filtered Minter for
|
|
108
|
+
* `_minterFilter`, integrated with Art Blocks core contract
|
|
109
|
+
* at address `_genArt721Address`.
|
|
110
|
+
* @param _genArt721Address Art Blocks core contract for which this
|
|
111
|
+
* contract will be a minter.
|
|
112
|
+
* @param _minterFilter Minter filter for which
|
|
113
|
+
* this will a filtered minter.
|
|
114
|
+
*/
|
|
115
|
+
constructor(
|
|
116
|
+
address _genArt721Address,
|
|
117
|
+
address _minterFilter
|
|
118
|
+
) ReentrancyGuard() {
|
|
119
|
+
genArt721CoreAddress = _genArt721Address;
|
|
120
|
+
genArtCoreContract = IGenArt721CoreContractV3(_genArt721Address);
|
|
121
|
+
minterFilterAddress = _minterFilter;
|
|
122
|
+
minterFilter = IMinterFilterV0(_minterFilter);
|
|
123
|
+
require(
|
|
124
|
+
minterFilter.genArt721CoreAddress() == _genArt721Address,
|
|
125
|
+
"Illegal contract pairing"
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @notice Registers holders of NFTs at address `_NFTAddress` to be
|
|
132
|
+
* considered for minting. New core address is assumed to follow syntax of:
|
|
133
|
+
* `projectId = tokenId / 1_000_000`
|
|
134
|
+
* @param _NFTAddress NFT core address to be registered.
|
|
135
|
+
*/
|
|
136
|
+
function registerNFTAddress(
|
|
137
|
+
address _NFTAddress
|
|
138
|
+
) external onlyCoreAdminACL(this.registerNFTAddress.selector) {
|
|
139
|
+
_registeredNFTAddresses.add(_NFTAddress);
|
|
140
|
+
emit RegisteredNFTAddress(_NFTAddress);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
*
|
|
145
|
+
* @notice Unregisters holders of NFTs at address `_NFTAddress` to be
|
|
146
|
+
* considered for adding to future allowlists.
|
|
147
|
+
* @param _NFTAddress NFT core address to be unregistered.
|
|
148
|
+
*/
|
|
149
|
+
function unregisterNFTAddress(
|
|
150
|
+
address _NFTAddress
|
|
151
|
+
) external onlyCoreAdminACL(this.unregisterNFTAddress.selector) {
|
|
152
|
+
_registeredNFTAddresses.remove(_NFTAddress);
|
|
153
|
+
emit UnregisteredNFTAddress(_NFTAddress);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @notice Allows holders of NFTs at addresses `_ownedNFTAddresses`,
|
|
158
|
+
* project IDs `_ownedNFTProjectIds` to mint on project `_projectId`.
|
|
159
|
+
* `_ownedNFTAddresses` assumed to be aligned with `_ownedNFTProjectIds`.
|
|
160
|
+
* e.g. Allows holders of project `_ownedNFTProjectIds[0]` on token
|
|
161
|
+
* contract `_ownedNFTAddresses[0]` to mint `_projectId`.
|
|
162
|
+
* @param _projectId Project ID to enable minting on.
|
|
163
|
+
* @param _ownedNFTAddresses NFT core addresses of projects to be
|
|
164
|
+
* allowlisted. Indexes must align with `_ownedNFTProjectIds`.
|
|
165
|
+
* @param _ownedNFTProjectIds Project IDs on `_ownedNFTAddresses` whose
|
|
166
|
+
* holders shall be allowlisted to mint project `_projectId`. Indexes must
|
|
167
|
+
* align with `_ownedNFTAddresses`.
|
|
168
|
+
*/
|
|
169
|
+
function allowHoldersOfProjects(
|
|
170
|
+
uint256 _projectId,
|
|
171
|
+
address[] memory _ownedNFTAddresses,
|
|
172
|
+
uint256[] memory _ownedNFTProjectIds
|
|
173
|
+
) public onlyArtist(_projectId) {
|
|
174
|
+
// require same length arrays
|
|
175
|
+
require(
|
|
176
|
+
_ownedNFTAddresses.length == _ownedNFTProjectIds.length,
|
|
177
|
+
"Length of add arrays must match"
|
|
178
|
+
);
|
|
179
|
+
// for each approved project
|
|
180
|
+
for (uint256 i = 0; i < _ownedNFTAddresses.length; i++) {
|
|
181
|
+
// ensure registered address
|
|
182
|
+
require(
|
|
183
|
+
_registeredNFTAddresses.contains(_ownedNFTAddresses[i]),
|
|
184
|
+
"Only Registered NFT Addresses"
|
|
185
|
+
);
|
|
186
|
+
// approve
|
|
187
|
+
allowedProjectHolders[_projectId][_ownedNFTAddresses[i]][
|
|
188
|
+
_ownedNFTProjectIds[i]
|
|
189
|
+
] = true;
|
|
190
|
+
}
|
|
191
|
+
// emit approve event
|
|
192
|
+
emit AllowedHoldersOfProjects(
|
|
193
|
+
_projectId,
|
|
194
|
+
_ownedNFTAddresses,
|
|
195
|
+
_ownedNFTProjectIds
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @notice Removes holders of NFTs at addresses `_ownedNFTAddresses`,
|
|
201
|
+
* project IDs `_ownedNFTProjectIds` to mint on project `_projectId`. If
|
|
202
|
+
* other projects owned by a holder are still allowed to mint, holder will
|
|
203
|
+
* maintain ability to purchase.
|
|
204
|
+
* `_ownedNFTAddresses` assumed to be aligned with `_ownedNFTProjectIds`.
|
|
205
|
+
* e.g. Removes holders of project `_ownedNFTProjectIds[0]` on token
|
|
206
|
+
* contract `_ownedNFTAddresses[0]` from mint allowlist of `_projectId`.
|
|
207
|
+
* @param _projectId Project ID to enable minting on.
|
|
208
|
+
* @param _ownedNFTAddresses NFT core addresses of projects to be removed
|
|
209
|
+
* from allowlist. Indexes must align with `_ownedNFTProjectIds`.
|
|
210
|
+
* @param _ownedNFTProjectIds Project IDs on `_ownedNFTAddresses` whose
|
|
211
|
+
* holders will be removed from allowlist to mint project `_projectId`.
|
|
212
|
+
* Indexes must align with `_ownedNFTAddresses`.
|
|
213
|
+
*/
|
|
214
|
+
function removeHoldersOfProjects(
|
|
215
|
+
uint256 _projectId,
|
|
216
|
+
address[] memory _ownedNFTAddresses,
|
|
217
|
+
uint256[] memory _ownedNFTProjectIds
|
|
218
|
+
) public onlyArtist(_projectId) {
|
|
219
|
+
// require same length arrays
|
|
220
|
+
require(
|
|
221
|
+
_ownedNFTAddresses.length == _ownedNFTProjectIds.length,
|
|
222
|
+
"Length of remove arrays must match"
|
|
223
|
+
);
|
|
224
|
+
// for each removed project
|
|
225
|
+
for (uint256 i = 0; i < _ownedNFTAddresses.length; i++) {
|
|
226
|
+
// revoke
|
|
227
|
+
allowedProjectHolders[_projectId][_ownedNFTAddresses[i]][
|
|
228
|
+
_ownedNFTProjectIds[i]
|
|
229
|
+
] = false;
|
|
230
|
+
}
|
|
231
|
+
// emit removed event
|
|
232
|
+
emit RemovedHoldersOfProjects(
|
|
233
|
+
_projectId,
|
|
234
|
+
_ownedNFTAddresses,
|
|
235
|
+
_ownedNFTProjectIds
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @notice Allows holders of NFTs at addresses `_ownedNFTAddressesAdd`,
|
|
241
|
+
* project IDs `_ownedNFTProjectIdsAdd` to mint on project `_projectId`.
|
|
242
|
+
* Also removes holders of NFTs at addresses `_ownedNFTAddressesRemove`,
|
|
243
|
+
* project IDs `_ownedNFTProjectIdsRemove` from minting on project
|
|
244
|
+
* `_projectId`.
|
|
245
|
+
* `_ownedNFTAddressesAdd` assumed to be aligned with
|
|
246
|
+
* `_ownedNFTProjectIdsAdd`.
|
|
247
|
+
* e.g. Allows holders of project `_ownedNFTProjectIdsAdd[0]` on token
|
|
248
|
+
* contract `_ownedNFTAddressesAdd[0]` to mint `_projectId`.
|
|
249
|
+
* `_ownedNFTAddressesRemove` also assumed to be aligned with
|
|
250
|
+
* `_ownedNFTProjectIdsRemove`.
|
|
251
|
+
* @param _projectId Project ID to enable minting on.
|
|
252
|
+
* @param _ownedNFTAddressesAdd NFT core addresses of projects to be
|
|
253
|
+
* allowlisted. Indexes must align with `_ownedNFTProjectIdsAdd`.
|
|
254
|
+
* @param _ownedNFTProjectIdsAdd Project IDs on `_ownedNFTAddressesAdd`
|
|
255
|
+
* whose holders shall be allowlisted to mint project `_projectId`. Indexes
|
|
256
|
+
* must align with `_ownedNFTAddressesAdd`.
|
|
257
|
+
* @param _ownedNFTAddressesRemove NFT core addresses of projects to be
|
|
258
|
+
* removed from allowlist. Indexes must align with
|
|
259
|
+
* `_ownedNFTProjectIdsRemove`.
|
|
260
|
+
* @param _ownedNFTProjectIdsRemove Project IDs on
|
|
261
|
+
* `_ownedNFTAddressesRemove` whose holders will be removed from allowlist
|
|
262
|
+
* to mint project `_projectId`. Indexes must align with
|
|
263
|
+
* `_ownedNFTAddressesRemove`.
|
|
264
|
+
* @dev if a project is included in both add and remove arrays, it will be
|
|
265
|
+
* removed.
|
|
266
|
+
*/
|
|
267
|
+
function allowRemoveHoldersOfProjects(
|
|
268
|
+
uint256 _projectId,
|
|
269
|
+
address[] memory _ownedNFTAddressesAdd,
|
|
270
|
+
uint256[] memory _ownedNFTProjectIdsAdd,
|
|
271
|
+
address[] memory _ownedNFTAddressesRemove,
|
|
272
|
+
uint256[] memory _ownedNFTProjectIdsRemove
|
|
273
|
+
) external onlyArtist(_projectId) {
|
|
274
|
+
allowHoldersOfProjects(
|
|
275
|
+
_projectId,
|
|
276
|
+
_ownedNFTAddressesAdd,
|
|
277
|
+
_ownedNFTProjectIdsAdd
|
|
278
|
+
);
|
|
279
|
+
removeHoldersOfProjects(
|
|
280
|
+
_projectId,
|
|
281
|
+
_ownedNFTAddressesRemove,
|
|
282
|
+
_ownedNFTProjectIdsRemove
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @notice Returns if token is an allowlisted NFT for project `_projectId`.
|
|
288
|
+
* @param _projectId Project ID to be checked.
|
|
289
|
+
* @param _ownedNFTAddress ERC-721 NFT token address to be checked.
|
|
290
|
+
* @param _ownedNFTTokenId ERC-721 NFT token ID to be checked.
|
|
291
|
+
* @return bool Token is allowlisted
|
|
292
|
+
* @dev does not check if token has been used to purchase
|
|
293
|
+
* @dev assumes project ID can be derived from tokenId / 1_000_000
|
|
294
|
+
*/
|
|
295
|
+
function isAllowlistedNFT(
|
|
296
|
+
uint256 _projectId,
|
|
297
|
+
address _ownedNFTAddress,
|
|
298
|
+
uint256 _ownedNFTTokenId
|
|
299
|
+
) public view returns (bool) {
|
|
300
|
+
uint256 ownedNFTProjectId = _ownedNFTTokenId / ONE_MILLION;
|
|
301
|
+
return
|
|
302
|
+
allowedProjectHolders[_projectId][_ownedNFTAddress][
|
|
303
|
+
ownedNFTProjectId
|
|
304
|
+
];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @notice Syncs local maximum invocations of project `_projectId` based on
|
|
309
|
+
* the value currently defined in the core contract. Only used for gas
|
|
310
|
+
* optimization of mints after maxInvocations has been reached.
|
|
311
|
+
* @param _projectId Project ID to set the maximum invocations for.
|
|
312
|
+
* @dev this enables gas reduction after maxInvocations have been reached -
|
|
313
|
+
* core contracts shall still enforce a maxInvocation check during mint.
|
|
314
|
+
* @dev function is intentionally not gated to any specific access control;
|
|
315
|
+
* it only syncs a local state variable to the core contract's state.
|
|
316
|
+
*/
|
|
317
|
+
function setProjectMaxInvocations(uint256 _projectId) external {
|
|
318
|
+
uint256 maxInvocations;
|
|
319
|
+
(, maxInvocations, , , , ) = genArtCoreContract.projectStateData(
|
|
320
|
+
_projectId
|
|
321
|
+
);
|
|
322
|
+
// update storage with results
|
|
323
|
+
projectConfig[_projectId].maxInvocations = uint24(maxInvocations);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @notice Warning: Disabling purchaseTo is not supported on this minter.
|
|
328
|
+
* This method exists purely for interface-conformance purposes.
|
|
329
|
+
*/
|
|
330
|
+
function togglePurchaseToDisabled(
|
|
331
|
+
uint256 _projectId
|
|
332
|
+
) external view onlyArtist(_projectId) {
|
|
333
|
+
revert("Action not supported");
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @notice projectId => has project reached its maximum number of
|
|
338
|
+
* invocations? Note that this returns a local cache of the core contract's
|
|
339
|
+
* state, and may be out of sync with the core contract. This is
|
|
340
|
+
* intentional, as it only enables gas optimization of mints after a
|
|
341
|
+
* project's maximum invocations has been reached. A false negative will
|
|
342
|
+
* only result in a gas cost increase, since the core contract will still
|
|
343
|
+
* enforce a maxInvocation check during minting. A false positive is not
|
|
344
|
+
* possible because the V3 core contract only allows maximum invocations
|
|
345
|
+
* to be reduced, not increased. Based on this rationale, we intentionally
|
|
346
|
+
* do not do input validation in this method as to whether or not the input
|
|
347
|
+
* `_projectId` is an existing project ID.
|
|
348
|
+
*/
|
|
349
|
+
function projectMaxHasBeenInvoked(
|
|
350
|
+
uint256 _projectId
|
|
351
|
+
) external view returns (bool) {
|
|
352
|
+
return projectConfig[_projectId].maxHasBeenInvoked;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* @notice projectId => project's maximum number of invocations.
|
|
357
|
+
* Optionally synced with core contract value, for gas optimization.
|
|
358
|
+
* Note that this returns a local cache of the core contract's
|
|
359
|
+
* state, and may be out of sync with the core contract. This is
|
|
360
|
+
* intentional, as it only enables gas optimization of mints after a
|
|
361
|
+
* project's maximum invocations has been reached.
|
|
362
|
+
* @dev A number greater than the core contract's project max invocations
|
|
363
|
+
* will only result in a gas cost increase, since the core contract will
|
|
364
|
+
* still enforce a maxInvocation check during minting. A number less than
|
|
365
|
+
* the core contract's project max invocations is only possible when the
|
|
366
|
+
* project's max invocations have not been synced on this minter, since the
|
|
367
|
+
* V3 core contract only allows maximum invocations to be reduced, not
|
|
368
|
+
* increased. When this happens, the minter will enable minting, allowing
|
|
369
|
+
* the core contract to enforce the max invocations check. Based on this
|
|
370
|
+
* rationale, we intentionally do not do input validation in this method as
|
|
371
|
+
* to whether or not the input `_projectId` is an existing project ID.
|
|
372
|
+
*/
|
|
373
|
+
function projectMaxInvocations(
|
|
374
|
+
uint256 _projectId
|
|
375
|
+
) external view returns (uint256) {
|
|
376
|
+
return uint256(projectConfig[_projectId].maxInvocations);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @notice Updates this minter's price per token of project `_projectId`
|
|
381
|
+
* to be '_pricePerTokenInWei`, in Wei.
|
|
382
|
+
* This price supersedes any legacy core contract price per token value.
|
|
383
|
+
* @dev Note that it is intentionally supported here that the configured
|
|
384
|
+
* price may be explicitly set to `0`.
|
|
385
|
+
*/
|
|
386
|
+
function updatePricePerTokenInWei(
|
|
387
|
+
uint256 _projectId,
|
|
388
|
+
uint256 _pricePerTokenInWei
|
|
389
|
+
) external onlyArtist(_projectId) {
|
|
390
|
+
projectConfig[_projectId].pricePerTokenInWei = _pricePerTokenInWei;
|
|
391
|
+
projectConfig[_projectId].priceIsConfigured = true;
|
|
392
|
+
emit PricePerTokenInWeiUpdated(_projectId, _pricePerTokenInWei);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* @notice Inactive function - requires NFT ownership to purchase.
|
|
397
|
+
*/
|
|
398
|
+
function purchase(uint256) external payable returns (uint256) {
|
|
399
|
+
revert("Must claim NFT ownership");
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* @notice Inactive function - requires NFT ownership to purchase.
|
|
404
|
+
*/
|
|
405
|
+
function purchaseTo(address, uint256) public payable returns (uint256) {
|
|
406
|
+
revert("Must claim NFT ownership");
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* @notice Purchases a token from project `_projectId`.
|
|
411
|
+
* @param _projectId Project ID to mint a token on.
|
|
412
|
+
* @param _ownedNFTAddress ERC-721 NFT address owned by msg.sender being used to
|
|
413
|
+
* prove right to purchase.
|
|
414
|
+
* @param _ownedNFTTokenId ERC-721 NFT token ID owned by msg.sender being used
|
|
415
|
+
* to prove right to purchase.
|
|
416
|
+
* @return tokenId Token ID of minted token
|
|
417
|
+
*/
|
|
418
|
+
function purchase(
|
|
419
|
+
uint256 _projectId,
|
|
420
|
+
address _ownedNFTAddress,
|
|
421
|
+
uint256 _ownedNFTTokenId
|
|
422
|
+
) external payable returns (uint256 tokenId) {
|
|
423
|
+
tokenId = purchaseTo_L69(
|
|
424
|
+
msg.sender,
|
|
425
|
+
_projectId,
|
|
426
|
+
_ownedNFTAddress,
|
|
427
|
+
_ownedNFTTokenId
|
|
428
|
+
);
|
|
429
|
+
return tokenId;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* @notice gas-optimized version of purchase(uint256,address,uint256).
|
|
434
|
+
*/
|
|
435
|
+
function purchase_nnf(
|
|
436
|
+
uint256 _projectId,
|
|
437
|
+
address _ownedNFTAddress,
|
|
438
|
+
uint256 _ownedNFTTokenId
|
|
439
|
+
) external payable returns (uint256 tokenId) {
|
|
440
|
+
tokenId = purchaseTo_L69(
|
|
441
|
+
msg.sender,
|
|
442
|
+
_projectId,
|
|
443
|
+
_ownedNFTAddress,
|
|
444
|
+
_ownedNFTTokenId
|
|
445
|
+
);
|
|
446
|
+
return tokenId;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* @notice Purchases a token from project `_projectId` and sets
|
|
451
|
+
* the token's owner to `_to`.
|
|
452
|
+
* @param _to Address to be the new token's owner.
|
|
453
|
+
* @param _projectId Project ID to mint a token on.
|
|
454
|
+
* @param _ownedNFTAddress ERC-721 NFT address owned by msg.sender being used to
|
|
455
|
+
* claim right to purchase.
|
|
456
|
+
* @param _ownedNFTTokenId ERC-721 NFT token ID owned by msg.sender being used
|
|
457
|
+
* to claim right to purchase.
|
|
458
|
+
* @return tokenId Token ID of minted token
|
|
459
|
+
*/
|
|
460
|
+
function purchaseTo(
|
|
461
|
+
address _to,
|
|
462
|
+
uint256 _projectId,
|
|
463
|
+
address _ownedNFTAddress,
|
|
464
|
+
uint256 _ownedNFTTokenId
|
|
465
|
+
) external payable returns (uint256 tokenId) {
|
|
466
|
+
return
|
|
467
|
+
purchaseTo_L69(_to, _projectId, _ownedNFTAddress, _ownedNFTTokenId);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* @notice gas-optimized version of purchaseTo(address,uint256,address,uint256).
|
|
472
|
+
*/
|
|
473
|
+
function purchaseTo_L69(
|
|
474
|
+
address _to,
|
|
475
|
+
uint256 _projectId,
|
|
476
|
+
address _ownedNFTAddress,
|
|
477
|
+
uint256 _ownedNFTTokenId
|
|
478
|
+
) public payable nonReentrant returns (uint256 tokenId) {
|
|
479
|
+
// CHECKS
|
|
480
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
481
|
+
|
|
482
|
+
// Note that `maxHasBeenInvoked` is only checked here to reduce gas
|
|
483
|
+
// consumption after a project has been fully minted.
|
|
484
|
+
// `_projectConfig.maxHasBeenInvoked` is locally cached to reduce
|
|
485
|
+
// gas consumption, but if not in sync with the core contract's value,
|
|
486
|
+
// the core contract also enforces its own max invocation check during
|
|
487
|
+
// minting.
|
|
488
|
+
require(
|
|
489
|
+
!_projectConfig.maxHasBeenInvoked,
|
|
490
|
+
"Maximum number of invocations reached"
|
|
491
|
+
);
|
|
492
|
+
|
|
493
|
+
// load price of token into memory
|
|
494
|
+
uint256 _pricePerTokenInWei = _projectConfig.pricePerTokenInWei;
|
|
495
|
+
|
|
496
|
+
require(
|
|
497
|
+
msg.value >= _pricePerTokenInWei,
|
|
498
|
+
"Must send minimum value to mint!"
|
|
499
|
+
);
|
|
500
|
+
|
|
501
|
+
// require artist to have configured price of token on this minter
|
|
502
|
+
require(_projectConfig.priceIsConfigured, "Price not configured");
|
|
503
|
+
|
|
504
|
+
// require token used to claim to be in set of allowlisted NFTs
|
|
505
|
+
require(
|
|
506
|
+
isAllowlistedNFT(_projectId, _ownedNFTAddress, _ownedNFTTokenId),
|
|
507
|
+
"Only allowlisted NFTs"
|
|
508
|
+
);
|
|
509
|
+
|
|
510
|
+
// EFFECTS
|
|
511
|
+
tokenId = minterFilter.mint(_to, _projectId, msg.sender);
|
|
512
|
+
|
|
513
|
+
// okay if this underflows because if statement will always eval false.
|
|
514
|
+
// this is only for gas optimization (core enforces maxInvocations).
|
|
515
|
+
unchecked {
|
|
516
|
+
if (tokenId % ONE_MILLION == _projectConfig.maxInvocations - 1) {
|
|
517
|
+
_projectConfig.maxHasBeenInvoked = true;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// INTERACTIONS
|
|
522
|
+
// require sender to own NFT used to redeem
|
|
523
|
+
/**
|
|
524
|
+
* @dev Considered an interaction because calling ownerOf on an NFT
|
|
525
|
+
* contract. Plan is to only register AB/PBAB NFTs on the minter, but
|
|
526
|
+
* in case other NFTs are registered, better to check here. Also,
|
|
527
|
+
* function is non-reentrant, so being extra cautious.
|
|
528
|
+
*/
|
|
529
|
+
require(
|
|
530
|
+
IERC721(_ownedNFTAddress).ownerOf(_ownedNFTTokenId) == msg.sender,
|
|
531
|
+
"Only owner of NFT"
|
|
532
|
+
);
|
|
533
|
+
|
|
534
|
+
// split funds
|
|
535
|
+
_splitFundsETH(_projectId, _pricePerTokenInWei);
|
|
536
|
+
|
|
537
|
+
return tokenId;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* @dev splits ETH funds between sender (if refund), foundation,
|
|
542
|
+
* artist, and artist's additional payee for a token purchased on
|
|
543
|
+
* project `_projectId`.
|
|
544
|
+
* @dev possible DoS during splits is acknowledged, and mitigated by
|
|
545
|
+
* business practices, including end-to-end testing on mainnet, and
|
|
546
|
+
* admin-accepted artist payment addresses.
|
|
547
|
+
*/
|
|
548
|
+
function _splitFundsETH(
|
|
549
|
+
uint256 _projectId,
|
|
550
|
+
uint256 _pricePerTokenInWei
|
|
551
|
+
) internal {
|
|
552
|
+
if (msg.value > 0) {
|
|
553
|
+
bool success_;
|
|
554
|
+
// send refund to sender
|
|
555
|
+
uint256 refund = msg.value - _pricePerTokenInWei;
|
|
556
|
+
if (refund > 0) {
|
|
557
|
+
(success_, ) = msg.sender.call{value: refund}("");
|
|
558
|
+
require(success_, "Refund failed");
|
|
559
|
+
}
|
|
560
|
+
// split remaining funds between foundation, artist, and artist's
|
|
561
|
+
// additional payee
|
|
562
|
+
(
|
|
563
|
+
uint256 artblocksRevenue_,
|
|
564
|
+
address payable artblocksAddress_,
|
|
565
|
+
uint256 artistRevenue_,
|
|
566
|
+
address payable artistAddress_,
|
|
567
|
+
uint256 additionalPayeePrimaryRevenue_,
|
|
568
|
+
address payable additionalPayeePrimaryAddress_
|
|
569
|
+
) = genArtCoreContract.getPrimaryRevenueSplits(
|
|
570
|
+
_projectId,
|
|
571
|
+
_pricePerTokenInWei
|
|
572
|
+
);
|
|
573
|
+
// Art Blocks payment
|
|
574
|
+
if (artblocksRevenue_ > 0) {
|
|
575
|
+
(success_, ) = artblocksAddress_.call{value: artblocksRevenue_}(
|
|
576
|
+
""
|
|
577
|
+
);
|
|
578
|
+
require(success_, "Art Blocks payment failed");
|
|
579
|
+
}
|
|
580
|
+
// artist payment
|
|
581
|
+
if (artistRevenue_ > 0) {
|
|
582
|
+
(success_, ) = artistAddress_.call{value: artistRevenue_}("");
|
|
583
|
+
require(success_, "Artist payment failed");
|
|
584
|
+
}
|
|
585
|
+
// additional payee payment
|
|
586
|
+
if (additionalPayeePrimaryRevenue_ > 0) {
|
|
587
|
+
(success_, ) = additionalPayeePrimaryAddress_.call{
|
|
588
|
+
value: additionalPayeePrimaryRevenue_
|
|
589
|
+
}("");
|
|
590
|
+
require(success_, "Additional Payee payment failed");
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* @notice Gets quantity of NFT addresses registered on this minter.
|
|
597
|
+
* @return uint256 quantity of NFT addresses registered
|
|
598
|
+
*/
|
|
599
|
+
function getNumRegisteredNFTAddresses() external view returns (uint256) {
|
|
600
|
+
return _registeredNFTAddresses.length();
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* @notice Get registered NFT core contract address at index `_index` of
|
|
605
|
+
* enumerable set.
|
|
606
|
+
* @param _index enumerable set index to query.
|
|
607
|
+
* @return NFTAddress NFT core contract address at index `_index`
|
|
608
|
+
* @dev index must be < quantity of registered NFT addresses
|
|
609
|
+
*/
|
|
610
|
+
function getRegisteredNFTAddressAt(
|
|
611
|
+
uint256 _index
|
|
612
|
+
) external view returns (address NFTAddress) {
|
|
613
|
+
return _registeredNFTAddresses.at(_index);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* @notice Gets if price of token is configured, price of minting a
|
|
618
|
+
* token on project `_projectId`, and currency symbol and address to be
|
|
619
|
+
* used as payment. Supersedes any core contract price information.
|
|
620
|
+
* @param _projectId Project ID to get price information for.
|
|
621
|
+
* @return isConfigured true only if token price has been configured on
|
|
622
|
+
* this minter
|
|
623
|
+
* @return tokenPriceInWei current price of token on this minter - invalid
|
|
624
|
+
* if price has not yet been configured
|
|
625
|
+
* @return currencySymbol currency symbol for purchases of project on this
|
|
626
|
+
* minter. This minter always returns "ETH"
|
|
627
|
+
* @return currencyAddress currency address for purchases of project on
|
|
628
|
+
* this minter. This minter always returns null address, reserved for ether
|
|
629
|
+
*/
|
|
630
|
+
function getPriceInfo(
|
|
631
|
+
uint256 _projectId
|
|
632
|
+
)
|
|
633
|
+
external
|
|
634
|
+
view
|
|
635
|
+
returns (
|
|
636
|
+
bool isConfigured,
|
|
637
|
+
uint256 tokenPriceInWei,
|
|
638
|
+
string memory currencySymbol,
|
|
639
|
+
address currencyAddress
|
|
640
|
+
)
|
|
641
|
+
{
|
|
642
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
643
|
+
isConfigured = _projectConfig.priceIsConfigured;
|
|
644
|
+
tokenPriceInWei = _projectConfig.pricePerTokenInWei;
|
|
645
|
+
currencySymbol = "ETH";
|
|
646
|
+
currencyAddress = address(0);
|
|
647
|
+
}
|
|
648
|
+
}
|
package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterHolder/MinterHolderV2.sol
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
2
|
// Created By: Art Blocks Inc.
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
4
|
+
import "../../../../interfaces/0.8.x/IGenArt721CoreContractV3.sol";
|
|
5
|
+
import "../../../../interfaces/0.8.x/IMinterFilterV0.sol";
|
|
6
|
+
import "../../../../interfaces/0.8.x/IFilteredMinterHolderV1.sol";
|
|
7
|
+
import "../../../../interfaces/0.8.x/IDelegationRegistry.sol";
|
|
8
8
|
|
|
9
9
|
import "@openzeppelin-4.5/contracts/token/ERC721/IERC721.sol";
|
|
10
10
|
import "@openzeppelin-4.5/contracts/token/ERC20/IERC20.sol";
|
|
@@ -55,7 +55,7 @@ pragma solidity 0.8.17;
|
|
|
55
55
|
* Delegations must be configured by the vault owner prior to purchase. Supported
|
|
56
56
|
* delegation types include token-level, contract-level (via genArt721CoreAddress), or
|
|
57
57
|
* wallet-level delegation. Contract-level delegations must be configured for the core
|
|
58
|
-
* token contract as returned by
|
|
58
|
+
* token contract as returned by the public immutable variable `genArt721CoreAddress`.
|
|
59
59
|
*/
|
|
60
60
|
contract MinterHolderV2 is ReentrancyGuard, IFilteredMinterHolderV1 {
|
|
61
61
|
// add Enumerable Set methods
|
|
@@ -599,7 +599,7 @@ contract MinterHolderV2 is ReentrancyGuard, IFilteredMinterHolderV1 {
|
|
|
599
599
|
.checkDelegateForToken(
|
|
600
600
|
msg.sender, // delegate
|
|
601
601
|
_vault, // vault
|
|
602
|
-
|
|
602
|
+
genArt721CoreAddress, // contract
|
|
603
603
|
_ownedNFTTokenId // tokenId
|
|
604
604
|
);
|
|
605
605
|
require(isValidVault, "Invalid delegate-vault pairing");
|
package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterHolder/MinterHolderV3.sol
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
2
|
// Created By: Art Blocks Inc.
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
4
|
+
import "../../../../interfaces/0.8.x/IGenArt721CoreContractV3.sol";
|
|
5
|
+
import "../../../../interfaces/0.8.x/IMinterFilterV0.sol";
|
|
6
|
+
import "../../../../interfaces/0.8.x/IFilteredMinterHolderV2.sol";
|
|
7
|
+
import "../../../../interfaces/0.8.x/IDelegationRegistry.sol";
|
|
8
8
|
|
|
9
9
|
import "@openzeppelin-4.5/contracts/token/ERC721/IERC721.sol";
|
|
10
10
|
import "@openzeppelin-4.5/contracts/token/ERC20/IERC20.sol";
|