@artblocks/contracts 0.0.1 → 1.0.1
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 +30 -11
- package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +2 -2
- package/artifacts/contracts/BasicPolyptychRandomizerV0.sol/BasicPolyptychRandomizerV0.json +229 -0
- package/artifacts/contracts/BasicRandomizerV2.sol/BasicRandomizerV2.json +3 -3
- package/artifacts/contracts/GenArt721CoreV3.sol/GenArt721CoreV3.json +2 -2
- package/artifacts/contracts/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +2 -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/MinterDAExpSettlement/MinterDAExpSettlementV1.sol/MinterDAExpSettlementV1.json +1066 -0
- 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/explorations/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +2 -2
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDAExpSettlementV0.sol/IFilteredMinterDAExpSettlementV0.json +12 -12
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDAExpSettlementV1.sol/IFilteredMinterDAExpSettlementV1.json +767 -0
- 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/IMinterFilterV0.sol/IMinterFilterV0.json +6 -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/interfaces/0.8.x/IRandomizerPolyptychV0.sol/IRandomizerPolyptychV0.json +87 -0
- package/artifacts/contracts/interfaces/0.8.x/IRandomizerV2.sol/IRandomizerV2.json +1 -1
- package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV0.sol/MinterFilterV0.json +8 -2
- package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV1.sol/MinterFilterV1.json +34 -2
- package/artifacts/contracts/minter-suite/Minters/MinterBase_v0_1_1.sol/MinterBase.json +24 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlementV2.sol/MinterDAExpSettlementV2.json +1127 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpV4.sol/MinterDAExpV4.json +882 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDALinV4.sol/MinterDALinV4.json +858 -0
- package/artifacts/contracts/minter-suite/Minters/MinterHolderV4.sol/MinterHolderV4.json +1126 -0
- package/artifacts/contracts/minter-suite/Minters/MinterMerkleV5.sol/MinterMerkleV5.json +1065 -0
- package/artifacts/contracts/minter-suite/Minters/MinterPolyptychV0.sol/IGenArt721CoreContractV3WithRandomizer.json +662 -0
- package/artifacts/contracts/minter-suite/Minters/MinterPolyptychV0.sol/MinterPolyptychV0.json +1268 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20V4.sol/MinterSetPriceERC20V4.json +768 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceV4.sol/MinterSetPriceV4.json +697 -0
- package/artifacts/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol/GenArt721CoreV3_Engine_IncorrectCoreType.json +1817 -0
- package/artifacts/contracts/mock/RandomizerV2_NoAssignMock.sol/RandomizerV2_NoAssignMock.json +3 -3
- package/contracts/BasicPolyptychRandomizerV0.sol +126 -0
- package/contracts/BasicRandomizerV2.sol +3 -3
- 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/MinterDAExpSettlement/MinterDAExpSettlementV1.sol +1026 -0
- 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/IFilteredMinterDAExpSettlementV1.sol +21 -0
- 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/IMinterFilterV0.sol +6 -0
- package/contracts/interfaces/0.8.x/IMintingAPICoreV0.sol +62 -0
- package/contracts/interfaces/0.8.x/IMintingAPIMinterV0.sol +31 -0
- package/contracts/interfaces/0.8.x/IRandomizerPolyptychV0.sol +31 -0
- package/contracts/interfaces/0.8.x/IRandomizerV2.sol +5 -2
- package/contracts/minter-suite/MinterFilter/MinterFilterV1.sol +18 -0
- package/contracts/minter-suite/Minters/MinterBase_v0_1_1.sol +293 -0
- package/contracts/minter-suite/Minters/MinterDAExpSettlementV2.sol +1312 -0
- package/contracts/minter-suite/Minters/MinterDAExpV4.sol +600 -0
- package/contracts/minter-suite/Minters/MinterDALinV4.sol +552 -0
- package/contracts/minter-suite/Minters/MinterHolderV4.sol +781 -0
- package/contracts/minter-suite/Minters/MinterMerkleV5.sol +717 -0
- package/contracts/minter-suite/Minters/MinterPolyptychV0.sol +998 -0
- package/contracts/minter-suite/Minters/MinterSetPriceERC20V4.sol +480 -0
- package/contracts/minter-suite/Minters/MinterSetPriceV4.sol +380 -0
- package/contracts/mock/GenArt721CoreV3_Engine_IncorrectCoreType.sol +1979 -0
- package/package.json +8 -2
- package/artifacts/contracts/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +0 -794
|
@@ -0,0 +1,679 @@
|
|
|
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/IFilteredMinterMerkleV0.sol";
|
|
7
|
+
import "../../../../interfaces/0.8.x/IDelegationRegistry.sol";
|
|
8
|
+
|
|
9
|
+
import "@openzeppelin-4.7/contracts/utils/cryptography/MerkleProof.sol";
|
|
10
|
+
import "@openzeppelin-4.7/contracts/token/ERC20/IERC20.sol";
|
|
11
|
+
import "@openzeppelin-4.7/contracts/security/ReentrancyGuard.sol";
|
|
12
|
+
|
|
13
|
+
pragma solidity 0.8.17;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @title Filtered Minter contract that allows tokens to be minted with ETH
|
|
17
|
+
* for addresses in a Merkle allowlist.
|
|
18
|
+
* This is designed to be used with IGenArt721CoreContractV3 contracts.
|
|
19
|
+
* @author Art Blocks Inc.
|
|
20
|
+
* @notice Privileged Roles and Ownership:
|
|
21
|
+
* This contract is designed to be managed, with limited powers.
|
|
22
|
+
* Privileged roles and abilities are controlled by the project's artist, which
|
|
23
|
+
* can be modified by the core contract's Admin ACL contract. Both of these
|
|
24
|
+
* roles hold extensive power and can modify minter details.
|
|
25
|
+
* Care must be taken to ensure that the admin ACL contract and artist
|
|
26
|
+
* addresses are secure behind a multi-sig or other access control mechanism.
|
|
27
|
+
* ----------------------------------------------------------------------------
|
|
28
|
+
* The following functions are restricted to a project's artist:
|
|
29
|
+
* - updateMerkleRoot
|
|
30
|
+
* - updatePricePerTokenInWei
|
|
31
|
+
* - setProjectInvocationsPerAddress
|
|
32
|
+
* ----------------------------------------------------------------------------
|
|
33
|
+
* Additional admin and artist privileged roles may be described on other
|
|
34
|
+
* contracts that this minter integrates with.
|
|
35
|
+
* ----------------------------------------------------------------------------
|
|
36
|
+
* This contract allows gated minting with support for vaults to delegate minting
|
|
37
|
+
* privileges via an external delegation registry. This means a vault on an allowlist
|
|
38
|
+
* can delegate minting privileges to a wallet that is not on the allowlist,
|
|
39
|
+
* enabling the vault to remain air-gapped while still allowing minting. The
|
|
40
|
+
* delegation registry contract is responsible for managing these delegations,
|
|
41
|
+
* and is available at the address returned by the public constant
|
|
42
|
+
* `DELEGATION_REGISTRY_ADDRESS`. At the time of writing, the delegation
|
|
43
|
+
* registry enables easy delegation configuring at https://delegate.cash/.
|
|
44
|
+
* Art Blocks does not guarentee the security of the delegation registry, and
|
|
45
|
+
* users should take care to ensure that the delegation registry is secure.
|
|
46
|
+
* Delegations must be configured by the vault owner prior to purchase. Supported
|
|
47
|
+
* delegation types include contract-level or wallet-level delegation. Contract-
|
|
48
|
+
* level delegations must be configured for the core token contract as returned
|
|
49
|
+
* by the public immutable variable `genArt721CoreAddress`.
|
|
50
|
+
*/
|
|
51
|
+
contract MinterMerkleV2 is ReentrancyGuard, IFilteredMinterMerkleV0 {
|
|
52
|
+
using MerkleProof for bytes32[];
|
|
53
|
+
|
|
54
|
+
/// Delegation registry address
|
|
55
|
+
address public constant DELEGATION_REGISTRY_ADDRESS =
|
|
56
|
+
0x00000000000076A84feF008CDAbe6409d2FE638B;
|
|
57
|
+
|
|
58
|
+
/// Delegation registry address
|
|
59
|
+
IDelegationRegistry private immutable delegationRegistryContract;
|
|
60
|
+
|
|
61
|
+
/// Core contract address this minter interacts with
|
|
62
|
+
address public immutable genArt721CoreAddress;
|
|
63
|
+
|
|
64
|
+
/// This contract handles cores with interface IV3
|
|
65
|
+
IGenArt721CoreContractV3 private immutable genArtCoreContract;
|
|
66
|
+
|
|
67
|
+
/// Minter filter address this minter interacts with
|
|
68
|
+
address public immutable minterFilterAddress;
|
|
69
|
+
|
|
70
|
+
/// Minter filter this minter may interact with.
|
|
71
|
+
IMinterFilterV0 private immutable minterFilter;
|
|
72
|
+
|
|
73
|
+
/// minterType for this minter
|
|
74
|
+
string public constant minterType = "MinterMerkleV2";
|
|
75
|
+
|
|
76
|
+
/// project minter configuration keys used by this minter
|
|
77
|
+
bytes32 private constant CONFIG_MERKLE_ROOT = "merkleRoot";
|
|
78
|
+
bytes32 private constant CONFIG_USE_MAX_INVOCATIONS_PER_ADDRESS_OVERRIDE =
|
|
79
|
+
"useMaxMintsPerAddrOverride"; // shortened to fit in 32 bytes
|
|
80
|
+
bytes32 private constant CONFIG_MAX_INVOCATIONS_OVERRIDE =
|
|
81
|
+
"maxMintsPerAddrOverride"; // shortened to match format of previous key
|
|
82
|
+
|
|
83
|
+
uint256 constant ONE_MILLION = 1_000_000;
|
|
84
|
+
|
|
85
|
+
uint256 public constant DEFAULT_MAX_INVOCATIONS_PER_ADDRESS = 1;
|
|
86
|
+
|
|
87
|
+
struct ProjectConfig {
|
|
88
|
+
bool maxHasBeenInvoked;
|
|
89
|
+
bool priceIsConfigured;
|
|
90
|
+
// initial value is false, so by default, projects limit allowlisted
|
|
91
|
+
// addresses to a mint qty of `DEFAULT_MAX_INVOCATIONS_PER_ADDRESS`
|
|
92
|
+
bool useMaxInvocationsPerAddressOverride;
|
|
93
|
+
// a value of 0 means no limit
|
|
94
|
+
// (only used if `useMaxInvocationsPerAddressOverride` is true)
|
|
95
|
+
uint24 maxInvocationsPerAddressOverride;
|
|
96
|
+
uint24 maxInvocations;
|
|
97
|
+
uint256 pricePerTokenInWei;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
mapping(uint256 => ProjectConfig) public projectConfig;
|
|
101
|
+
|
|
102
|
+
/// projectId => merkle root
|
|
103
|
+
mapping(uint256 => bytes32) public projectMerkleRoot;
|
|
104
|
+
|
|
105
|
+
/// projectId => purchaser address => qty of mints purchased for project
|
|
106
|
+
mapping(uint256 => mapping(address => uint256))
|
|
107
|
+
public projectUserMintInvocations;
|
|
108
|
+
|
|
109
|
+
modifier onlyArtist(uint256 _projectId) {
|
|
110
|
+
require(
|
|
111
|
+
msg.sender ==
|
|
112
|
+
genArtCoreContract.projectIdToArtistAddress(_projectId),
|
|
113
|
+
"Only Artist"
|
|
114
|
+
);
|
|
115
|
+
_;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @notice Initializes contract to be a Filtered Minter for
|
|
120
|
+
* `_minterFilter`, integrated with Art Blocks core contract
|
|
121
|
+
* at address `_genArt721Address`.
|
|
122
|
+
* @param _genArt721Address Art Blocks core contract address for
|
|
123
|
+
* which this contract will be a minter.
|
|
124
|
+
* @param _minterFilter Minter filter for which this will be a
|
|
125
|
+
* filtered minter.
|
|
126
|
+
*/
|
|
127
|
+
constructor(
|
|
128
|
+
address _genArt721Address,
|
|
129
|
+
address _minterFilter
|
|
130
|
+
) ReentrancyGuard() {
|
|
131
|
+
genArt721CoreAddress = _genArt721Address;
|
|
132
|
+
genArtCoreContract = IGenArt721CoreContractV3(_genArt721Address);
|
|
133
|
+
delegationRegistryContract = IDelegationRegistry(
|
|
134
|
+
DELEGATION_REGISTRY_ADDRESS
|
|
135
|
+
);
|
|
136
|
+
minterFilterAddress = _minterFilter;
|
|
137
|
+
minterFilter = IMinterFilterV0(_minterFilter);
|
|
138
|
+
require(
|
|
139
|
+
minterFilter.genArt721CoreAddress() == _genArt721Address,
|
|
140
|
+
"Illegal contract pairing"
|
|
141
|
+
);
|
|
142
|
+
// broadcast default max invocations per address for this minter
|
|
143
|
+
emit DefaultMaxInvocationsPerAddress(
|
|
144
|
+
DEFAULT_MAX_INVOCATIONS_PER_ADDRESS
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @notice Update the Merkle root for project `_projectId`.
|
|
150
|
+
* @param _projectId Project ID to be updated.
|
|
151
|
+
* @param _root root of Merkle tree defining addresses allowed to mint
|
|
152
|
+
* on project `_projectId`.
|
|
153
|
+
*/
|
|
154
|
+
function updateMerkleRoot(
|
|
155
|
+
uint256 _projectId,
|
|
156
|
+
bytes32 _root
|
|
157
|
+
) external onlyArtist(_projectId) {
|
|
158
|
+
require(_root != bytes32(0), "Root must be provided");
|
|
159
|
+
projectMerkleRoot[_projectId] = _root;
|
|
160
|
+
emit ConfigValueSet(_projectId, CONFIG_MERKLE_ROOT, _root);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @notice Returns hashed address (to be used as merkle tree leaf).
|
|
165
|
+
* Included as a public function to enable users to calculate their hashed
|
|
166
|
+
* address in Solidity when generating proofs off-chain.
|
|
167
|
+
* @param _address address to be hashed
|
|
168
|
+
* @return bytes32 hashed address, via keccak256 (using encodePacked)
|
|
169
|
+
*/
|
|
170
|
+
function hashAddress(address _address) public pure returns (bytes32) {
|
|
171
|
+
return keccak256(abi.encodePacked(_address));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @notice Verify if address is allowed to mint on project `_projectId`.
|
|
176
|
+
* @param _projectId Project ID to be checked.
|
|
177
|
+
* @param _proof Merkle proof for address.
|
|
178
|
+
* @param _address Address to check.
|
|
179
|
+
* @return inAllowlist true only if address is allowed to mint and valid
|
|
180
|
+
* Merkle proof was provided
|
|
181
|
+
*/
|
|
182
|
+
function verifyAddress(
|
|
183
|
+
uint256 _projectId,
|
|
184
|
+
bytes32[] calldata _proof,
|
|
185
|
+
address _address
|
|
186
|
+
) public view returns (bool) {
|
|
187
|
+
return
|
|
188
|
+
_proof.verifyCalldata(
|
|
189
|
+
projectMerkleRoot[_projectId],
|
|
190
|
+
hashAddress(_address)
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @notice Sets maximum allowed invocations per allowlisted address for
|
|
196
|
+
* project `_project` to `limit`. If `limit` is set to 0, allowlisted
|
|
197
|
+
* addresses will be able to mint as many times as desired, until the
|
|
198
|
+
* project reaches its maximum invocations.
|
|
199
|
+
* Default is a value of 1 if never configured by artist.
|
|
200
|
+
* @param _projectId Project ID to toggle the mint limit.
|
|
201
|
+
* @param _maxInvocationsPerAddress Maximum allowed invocations per
|
|
202
|
+
* allowlisted address.
|
|
203
|
+
* @dev default value stated above must be updated if the value of
|
|
204
|
+
* CONFIG_USE_MAX_INVOCATIONS_PER_ADDRESS_OVERRIDE is changed.
|
|
205
|
+
*/
|
|
206
|
+
function setProjectInvocationsPerAddress(
|
|
207
|
+
uint256 _projectId,
|
|
208
|
+
uint24 _maxInvocationsPerAddress
|
|
209
|
+
) external onlyArtist(_projectId) {
|
|
210
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
211
|
+
// use override value instead of the contract's default
|
|
212
|
+
// @dev this never changes from true to false; default value is only
|
|
213
|
+
// used if artist has never configured project invocations per address
|
|
214
|
+
_projectConfig.useMaxInvocationsPerAddressOverride = true;
|
|
215
|
+
// update the override value
|
|
216
|
+
_projectConfig
|
|
217
|
+
.maxInvocationsPerAddressOverride = _maxInvocationsPerAddress;
|
|
218
|
+
// generic events
|
|
219
|
+
emit ConfigValueSet(
|
|
220
|
+
_projectId,
|
|
221
|
+
CONFIG_USE_MAX_INVOCATIONS_PER_ADDRESS_OVERRIDE,
|
|
222
|
+
true
|
|
223
|
+
);
|
|
224
|
+
emit ConfigValueSet(
|
|
225
|
+
_projectId,
|
|
226
|
+
CONFIG_MAX_INVOCATIONS_OVERRIDE,
|
|
227
|
+
uint256(_maxInvocationsPerAddress)
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @notice Syncs local maximum invocations of project `_projectId` based on
|
|
233
|
+
* the value currently defined in the core contract. Only used for gas
|
|
234
|
+
* optimization of mints after maxInvocations has been reached.
|
|
235
|
+
* @param _projectId Project ID to set the maximum invocations for.
|
|
236
|
+
* @dev this enables gas reduction after maxInvocations have been reached -
|
|
237
|
+
* core contracts shall still enforce a maxInvocation check during mint.
|
|
238
|
+
* @dev function is intentionally not gated to any specific access control;
|
|
239
|
+
* it only syncs a local state variable to the core contract's state.
|
|
240
|
+
*/
|
|
241
|
+
function setProjectMaxInvocations(uint256 _projectId) external {
|
|
242
|
+
uint256 maxInvocations;
|
|
243
|
+
(, maxInvocations, , , , ) = genArtCoreContract.projectStateData(
|
|
244
|
+
_projectId
|
|
245
|
+
);
|
|
246
|
+
// update storage with results
|
|
247
|
+
projectConfig[_projectId].maxInvocations = uint24(maxInvocations);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @notice Warning: Disabling purchaseTo is not supported on this minter.
|
|
252
|
+
* This method exists purely for interface-conformance purposes.
|
|
253
|
+
*/
|
|
254
|
+
function togglePurchaseToDisabled(
|
|
255
|
+
uint256 _projectId
|
|
256
|
+
) external view onlyArtist(_projectId) {
|
|
257
|
+
revert("Action not supported");
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @notice projectId => has project reached its maximum number of
|
|
262
|
+
* invocations? Note that this returns a local cache of the core contract's
|
|
263
|
+
* state, and may be out of sync with the core contract. This is
|
|
264
|
+
* intentional, as it only enables gas optimization of mints after a
|
|
265
|
+
* project's maximum invocations has been reached. A false negative will
|
|
266
|
+
* only result in a gas cost increase, since the core contract will still
|
|
267
|
+
* enforce a maxInvocation check during minting. A false positive is not
|
|
268
|
+
* possible because the V3 core contract only allows maximum invocations
|
|
269
|
+
* to be reduced, not increased. Based on this rationale, we intentionally
|
|
270
|
+
* do not do input validation in this method as to whether or not the input
|
|
271
|
+
* `_projectId` is an existing project ID.
|
|
272
|
+
*/
|
|
273
|
+
function projectMaxHasBeenInvoked(
|
|
274
|
+
uint256 _projectId
|
|
275
|
+
) external view returns (bool) {
|
|
276
|
+
return projectConfig[_projectId].maxHasBeenInvoked;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @notice projectId => project's maximum number of invocations.
|
|
281
|
+
* Optionally synced with core contract value, for gas optimization.
|
|
282
|
+
* Note that this returns a local cache of the core contract's
|
|
283
|
+
* state, and may be out of sync with the core contract. This is
|
|
284
|
+
* intentional, as it only enables gas optimization of mints after a
|
|
285
|
+
* project's maximum invocations has been reached.
|
|
286
|
+
* @dev A number greater than the core contract's project max invocations
|
|
287
|
+
* will only result in a gas cost increase, since the core contract will
|
|
288
|
+
* still enforce a maxInvocation check during minting. A number less than
|
|
289
|
+
* the core contract's project max invocations is only possible when the
|
|
290
|
+
* project's max invocations have not been synced on this minter, since the
|
|
291
|
+
* V3 core contract only allows maximum invocations to be reduced, not
|
|
292
|
+
* increased. When this happens, the minter will enable minting, allowing
|
|
293
|
+
* the core contract to enforce the max invocations check. Based on this
|
|
294
|
+
* rationale, we intentionally do not do input validation in this method as
|
|
295
|
+
* to whether or not the input `_projectId` is an existing project ID.
|
|
296
|
+
*/
|
|
297
|
+
function projectMaxInvocations(
|
|
298
|
+
uint256 _projectId
|
|
299
|
+
) external view returns (uint256) {
|
|
300
|
+
return uint256(projectConfig[_projectId].maxInvocations);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* @notice Updates this minter's price per token of project `_projectId`
|
|
305
|
+
* to be '_pricePerTokenInWei`, in Wei.
|
|
306
|
+
* This price supersedes any legacy core contract price per token value.
|
|
307
|
+
* @dev Note that it is intentionally supported here that the configured
|
|
308
|
+
* price may be explicitly set to `0`.
|
|
309
|
+
*/
|
|
310
|
+
function updatePricePerTokenInWei(
|
|
311
|
+
uint256 _projectId,
|
|
312
|
+
uint256 _pricePerTokenInWei
|
|
313
|
+
) external onlyArtist(_projectId) {
|
|
314
|
+
projectConfig[_projectId].pricePerTokenInWei = _pricePerTokenInWei;
|
|
315
|
+
projectConfig[_projectId].priceIsConfigured = true;
|
|
316
|
+
emit PricePerTokenInWeiUpdated(_projectId, _pricePerTokenInWei);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @notice Inactive function - requires Merkle proof to purchase.
|
|
321
|
+
*/
|
|
322
|
+
function purchase(uint256) external payable returns (uint256) {
|
|
323
|
+
revert("Must provide Merkle proof");
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @notice Inactive function - requires Merkle proof to purchase.
|
|
328
|
+
*/
|
|
329
|
+
function purchaseTo(address, uint256) public payable returns (uint256) {
|
|
330
|
+
revert("Must provide Merkle proof");
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* @notice Purchases a token from project `_projectId`.
|
|
335
|
+
* @param _projectId Project ID to mint a token on.
|
|
336
|
+
* @param _proof Merkle proof.
|
|
337
|
+
* @return tokenId Token ID of minted token
|
|
338
|
+
*/
|
|
339
|
+
function purchase(
|
|
340
|
+
uint256 _projectId,
|
|
341
|
+
bytes32[] calldata _proof
|
|
342
|
+
) external payable returns (uint256 tokenId) {
|
|
343
|
+
tokenId = purchaseTo_kem(msg.sender, _projectId, _proof, address(0));
|
|
344
|
+
return tokenId;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* @notice gas-optimized version of purchase(uint256,bytes32[]).
|
|
349
|
+
*/
|
|
350
|
+
function purchase_gD5(
|
|
351
|
+
uint256 _projectId,
|
|
352
|
+
bytes32[] calldata _proof
|
|
353
|
+
) external payable returns (uint256 tokenId) {
|
|
354
|
+
tokenId = purchaseTo_kem(msg.sender, _projectId, _proof, address(0));
|
|
355
|
+
return tokenId;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @notice Purchases a token from project `_projectId` and sets
|
|
360
|
+
* the token's owner to `_to`.
|
|
361
|
+
* @param _to Address to be the new token's owner.
|
|
362
|
+
* @param _projectId Project ID to mint a token on.
|
|
363
|
+
* @param _proof Merkle proof.
|
|
364
|
+
* @return tokenId Token ID of minted token
|
|
365
|
+
*/
|
|
366
|
+
function purchaseTo(
|
|
367
|
+
address _to,
|
|
368
|
+
uint256 _projectId,
|
|
369
|
+
bytes32[] calldata _proof
|
|
370
|
+
) external payable returns (uint256 tokenId) {
|
|
371
|
+
return purchaseTo_kem(_to, _projectId, _proof, address(0));
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* @notice Purchases a token from project `_projectId` and sets
|
|
376
|
+
* the token's owner to `_to`, as a delegate, (the `msg.sender`)
|
|
377
|
+
* on behalf of an explicitly defined vault.
|
|
378
|
+
* @param _to Address to be the new token's owner.
|
|
379
|
+
* @param _projectId Project ID to mint a token on.
|
|
380
|
+
* @param _proof Merkle proof.
|
|
381
|
+
* @param _vault Vault being purchased on behalf of.
|
|
382
|
+
* @return tokenId Token ID of minted token
|
|
383
|
+
*/
|
|
384
|
+
function purchaseTo(
|
|
385
|
+
address _to,
|
|
386
|
+
uint256 _projectId,
|
|
387
|
+
bytes32[] calldata _proof,
|
|
388
|
+
address _vault
|
|
389
|
+
) external payable returns (uint256 tokenId) {
|
|
390
|
+
return purchaseTo_kem(_to, _projectId, _proof, _vault);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* @notice gas-optimized version of
|
|
395
|
+
* purchaseTo(address,uint256,bytes32[],address).
|
|
396
|
+
* @param _to Address to be the new token's owner.
|
|
397
|
+
* @param _projectId Project ID to mint a token on.
|
|
398
|
+
* @param _proof Merkle proof. Must be a valid proof of either `msg.sender`
|
|
399
|
+
* if `_vault` is `address(0)`, or `_vault` if `_vault` is not `address(0)`.
|
|
400
|
+
* @param _vault Vault being purchased on behalf of. Acceptable to be
|
|
401
|
+
* address(0) if no vault.
|
|
402
|
+
*/
|
|
403
|
+
function purchaseTo_kem(
|
|
404
|
+
address _to,
|
|
405
|
+
uint256 _projectId,
|
|
406
|
+
bytes32[] calldata _proof,
|
|
407
|
+
address _vault // acceptable to be `address(0)` if no vault
|
|
408
|
+
) public payable nonReentrant returns (uint256 tokenId) {
|
|
409
|
+
// CHECKS
|
|
410
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
411
|
+
|
|
412
|
+
// Note that `maxHasBeenInvoked` is only checked here to reduce gas
|
|
413
|
+
// consumption after a project has been fully minted.
|
|
414
|
+
// `_projectConfig.maxHasBeenInvoked` is locally cached to reduce
|
|
415
|
+
// gas consumption, but if not in sync with the core contract's value,
|
|
416
|
+
// the core contract also enforces its own max invocation check during
|
|
417
|
+
// minting.
|
|
418
|
+
require(
|
|
419
|
+
!_projectConfig.maxHasBeenInvoked,
|
|
420
|
+
"Maximum number of invocations reached"
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
// load price of token into memory
|
|
424
|
+
uint256 _pricePerTokenInWei = _projectConfig.pricePerTokenInWei;
|
|
425
|
+
|
|
426
|
+
require(
|
|
427
|
+
msg.value >= _pricePerTokenInWei,
|
|
428
|
+
"Must send minimum value to mint!"
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
// require artist to have configured price of token on this minter
|
|
432
|
+
require(_projectConfig.priceIsConfigured, "Price not configured");
|
|
433
|
+
|
|
434
|
+
// no contract filter since Merkle tree controls allowed addresses
|
|
435
|
+
|
|
436
|
+
// NOTE: delegate-vault handling **begins here**.
|
|
437
|
+
|
|
438
|
+
// handle that the vault may be either the `msg.sender` in the case
|
|
439
|
+
// that there is not a true vault, or may be `_vault` if one is
|
|
440
|
+
// provided explicitly (and it is valid).
|
|
441
|
+
address vault = msg.sender;
|
|
442
|
+
if (_vault != address(0)) {
|
|
443
|
+
// If a vault is provided, it must be valid, otherwise throw rather
|
|
444
|
+
// than optimistically-minting with original `msg.sender`.
|
|
445
|
+
// Note, we do not check `checkDelegateForAll` as well, as it is known
|
|
446
|
+
// to be implicitly checked by calling `checkDelegateForContract`.
|
|
447
|
+
bool isValidDelegee = delegationRegistryContract
|
|
448
|
+
.checkDelegateForContract(
|
|
449
|
+
msg.sender, // delegate
|
|
450
|
+
_vault, // vault
|
|
451
|
+
genArt721CoreAddress // contract
|
|
452
|
+
);
|
|
453
|
+
require(isValidDelegee, "Invalid delegate-vault pairing");
|
|
454
|
+
vault = _vault;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// require valid Merkle proof
|
|
458
|
+
require(
|
|
459
|
+
verifyAddress(_projectId, _proof, vault),
|
|
460
|
+
"Invalid Merkle proof"
|
|
461
|
+
);
|
|
462
|
+
|
|
463
|
+
// limit mints per address by project
|
|
464
|
+
uint256 _maxProjectInvocationsPerAddress = _projectConfig
|
|
465
|
+
.useMaxInvocationsPerAddressOverride
|
|
466
|
+
? _projectConfig.maxInvocationsPerAddressOverride
|
|
467
|
+
: DEFAULT_MAX_INVOCATIONS_PER_ADDRESS;
|
|
468
|
+
|
|
469
|
+
// note that mint limits index off of the `vault` (when applicable)
|
|
470
|
+
require(
|
|
471
|
+
projectUserMintInvocations[_projectId][vault] <
|
|
472
|
+
_maxProjectInvocationsPerAddress ||
|
|
473
|
+
_maxProjectInvocationsPerAddress == 0,
|
|
474
|
+
"Maximum number of invocations per address reached"
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
// EFFECTS
|
|
478
|
+
// increment user's invocations for this project
|
|
479
|
+
unchecked {
|
|
480
|
+
// this will never overflow since user's invocations on a project
|
|
481
|
+
// are limited by the project's max invocations
|
|
482
|
+
projectUserMintInvocations[_projectId][vault]++;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// mint token
|
|
486
|
+
tokenId = minterFilter.mint(_to, _projectId, vault);
|
|
487
|
+
|
|
488
|
+
// NOTE: delegate-vault handling **ends here**.
|
|
489
|
+
|
|
490
|
+
// okay if this underflows because if statement will always eval false.
|
|
491
|
+
// this is only for gas optimization (core enforces maxInvocations).
|
|
492
|
+
unchecked {
|
|
493
|
+
if (tokenId % ONE_MILLION == _projectConfig.maxInvocations - 1) {
|
|
494
|
+
_projectConfig.maxHasBeenInvoked = true;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// INTERACTIONS
|
|
499
|
+
_splitFundsETH(_projectId, _pricePerTokenInWei);
|
|
500
|
+
|
|
501
|
+
return tokenId;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* @dev splits ETH funds between sender (if refund), foundation,
|
|
506
|
+
* artist, and artist's additional payee for a token purchased on
|
|
507
|
+
* project `_projectId`.
|
|
508
|
+
* @dev possible DoS during splits is acknowledged, and mitigated by
|
|
509
|
+
* business practices, including end-to-end testing on mainnet, and
|
|
510
|
+
* admin-accepted artist payment addresses.
|
|
511
|
+
*/
|
|
512
|
+
function _splitFundsETH(
|
|
513
|
+
uint256 _projectId,
|
|
514
|
+
uint256 _pricePerTokenInWei
|
|
515
|
+
) internal {
|
|
516
|
+
if (msg.value > 0) {
|
|
517
|
+
bool success_;
|
|
518
|
+
// send refund to sender
|
|
519
|
+
uint256 refund = msg.value - _pricePerTokenInWei;
|
|
520
|
+
if (refund > 0) {
|
|
521
|
+
(success_, ) = msg.sender.call{value: refund}("");
|
|
522
|
+
require(success_, "Refund failed");
|
|
523
|
+
}
|
|
524
|
+
// split remaining funds between foundation, artist, and artist's
|
|
525
|
+
// additional payee
|
|
526
|
+
(
|
|
527
|
+
uint256 artblocksRevenue_,
|
|
528
|
+
address payable artblocksAddress_,
|
|
529
|
+
uint256 artistRevenue_,
|
|
530
|
+
address payable artistAddress_,
|
|
531
|
+
uint256 additionalPayeePrimaryRevenue_,
|
|
532
|
+
address payable additionalPayeePrimaryAddress_
|
|
533
|
+
) = genArtCoreContract.getPrimaryRevenueSplits(
|
|
534
|
+
_projectId,
|
|
535
|
+
_pricePerTokenInWei
|
|
536
|
+
);
|
|
537
|
+
// Art Blocks payment
|
|
538
|
+
if (artblocksRevenue_ > 0) {
|
|
539
|
+
(success_, ) = artblocksAddress_.call{value: artblocksRevenue_}(
|
|
540
|
+
""
|
|
541
|
+
);
|
|
542
|
+
require(success_, "Art Blocks payment failed");
|
|
543
|
+
}
|
|
544
|
+
// artist payment
|
|
545
|
+
if (artistRevenue_ > 0) {
|
|
546
|
+
(success_, ) = artistAddress_.call{value: artistRevenue_}("");
|
|
547
|
+
require(success_, "Artist payment failed");
|
|
548
|
+
}
|
|
549
|
+
// additional payee payment
|
|
550
|
+
if (additionalPayeePrimaryRevenue_ > 0) {
|
|
551
|
+
(success_, ) = additionalPayeePrimaryAddress_.call{
|
|
552
|
+
value: additionalPayeePrimaryRevenue_
|
|
553
|
+
}("");
|
|
554
|
+
require(success_, "Additional Payee payment failed");
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* @notice projectId => maximum invocations per allowlisted address. If a
|
|
561
|
+
* a value of 0 is returned, there is no limit on the number of mints per
|
|
562
|
+
* allowlisted address.
|
|
563
|
+
* Default behavior is limit 1 mint per address.
|
|
564
|
+
* This value can be changed at any time by the artist.
|
|
565
|
+
* @dev default value stated above must be updated if the value of
|
|
566
|
+
* CONFIG_USE_MAX_INVOCATIONS_PER_ADDRESS_OVERRIDE is changed.
|
|
567
|
+
*/
|
|
568
|
+
function projectMaxInvocationsPerAddress(
|
|
569
|
+
uint256 _projectId
|
|
570
|
+
) public view returns (uint256) {
|
|
571
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
572
|
+
if (_projectConfig.useMaxInvocationsPerAddressOverride) {
|
|
573
|
+
return uint256(_projectConfig.maxInvocationsPerAddressOverride);
|
|
574
|
+
} else {
|
|
575
|
+
return DEFAULT_MAX_INVOCATIONS_PER_ADDRESS;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* @notice Returns remaining invocations for a given address.
|
|
581
|
+
* If `projectLimitsMintInvocationsPerAddress` is false, individual
|
|
582
|
+
* addresses are only limited by the project's maximum invocations, and a
|
|
583
|
+
* dummy value of zero is returned for `mintInvocationsRemaining`.
|
|
584
|
+
* If `projectLimitsMintInvocationsPerAddress` is true, the quantity of
|
|
585
|
+
* remaining mint invocations for address `_address` is returned as
|
|
586
|
+
* `mintInvocationsRemaining`.
|
|
587
|
+
* Note that mint invocations per address can be changed at any time by the
|
|
588
|
+
* artist of a project.
|
|
589
|
+
* Also note that all mint invocations are limited by a project's maximum
|
|
590
|
+
* invocations as defined on the core contract. This function may return
|
|
591
|
+
* a value greater than the project's remaining invocations.
|
|
592
|
+
*/
|
|
593
|
+
function projectRemainingInvocationsForAddress(
|
|
594
|
+
uint256 _projectId,
|
|
595
|
+
address _address
|
|
596
|
+
)
|
|
597
|
+
external
|
|
598
|
+
view
|
|
599
|
+
returns (
|
|
600
|
+
bool projectLimitsMintInvocationsPerAddress,
|
|
601
|
+
uint256 mintInvocationsRemaining
|
|
602
|
+
)
|
|
603
|
+
{
|
|
604
|
+
uint256 maxInvocationsPerAddress = projectMaxInvocationsPerAddress(
|
|
605
|
+
_projectId
|
|
606
|
+
);
|
|
607
|
+
if (maxInvocationsPerAddress == 0) {
|
|
608
|
+
// project does not limit mint invocations per address, so leave
|
|
609
|
+
// `projectLimitsMintInvocationsPerAddress` at solidity initial
|
|
610
|
+
// value of false. Also leave `mintInvocationsRemaining` at
|
|
611
|
+
// solidity initial value of zero, as indicated in this function's
|
|
612
|
+
// documentation.
|
|
613
|
+
} else {
|
|
614
|
+
projectLimitsMintInvocationsPerAddress = true;
|
|
615
|
+
uint256 userMintInvocations = projectUserMintInvocations[
|
|
616
|
+
_projectId
|
|
617
|
+
][_address];
|
|
618
|
+
// if user has not reached max invocations per address, return
|
|
619
|
+
// remaining invocations
|
|
620
|
+
if (maxInvocationsPerAddress > userMintInvocations) {
|
|
621
|
+
unchecked {
|
|
622
|
+
// will never underflow due to the check above
|
|
623
|
+
mintInvocationsRemaining =
|
|
624
|
+
maxInvocationsPerAddress -
|
|
625
|
+
userMintInvocations;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
// else user has reached their maximum invocations, so leave
|
|
629
|
+
// `mintInvocationsRemaining` at solidity initial value of zero
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* @notice Process proof for an address. Returns Merkle root. Included to
|
|
635
|
+
* enable users to easily verify a proof's validity.
|
|
636
|
+
* @param _proof Merkle proof for address.
|
|
637
|
+
* @param _address Address to process.
|
|
638
|
+
* @return merkleRoot Merkle root for `_address` and `_proof`
|
|
639
|
+
*/
|
|
640
|
+
function processProofForAddress(
|
|
641
|
+
bytes32[] calldata _proof,
|
|
642
|
+
address _address
|
|
643
|
+
) external pure returns (bytes32) {
|
|
644
|
+
return _proof.processProofCalldata(hashAddress(_address));
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* @notice Gets if price of token is configured, price of minting a
|
|
649
|
+
* token on project `_projectId`, and currency symbol and address to be
|
|
650
|
+
* used as payment. Supersedes any core contract price information.
|
|
651
|
+
* @param _projectId Project ID to get price information for.
|
|
652
|
+
* @return isConfigured true only if token price has been configured on
|
|
653
|
+
* this minter
|
|
654
|
+
* @return tokenPriceInWei current price of token on this minter - invalid
|
|
655
|
+
* if price has not yet been configured
|
|
656
|
+
* @return currencySymbol currency symbol for purchases of project on this
|
|
657
|
+
* minter. This minter always returns "ETH"
|
|
658
|
+
* @return currencyAddress currency address for purchases of project on
|
|
659
|
+
* this minter. This minter always returns null address, reserved for ether
|
|
660
|
+
*/
|
|
661
|
+
function getPriceInfo(
|
|
662
|
+
uint256 _projectId
|
|
663
|
+
)
|
|
664
|
+
external
|
|
665
|
+
view
|
|
666
|
+
returns (
|
|
667
|
+
bool isConfigured,
|
|
668
|
+
uint256 tokenPriceInWei,
|
|
669
|
+
string memory currencySymbol,
|
|
670
|
+
address currencyAddress
|
|
671
|
+
)
|
|
672
|
+
{
|
|
673
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
674
|
+
isConfigured = _projectConfig.priceIsConfigured;
|
|
675
|
+
tokenPriceInWei = _projectConfig.pricePerTokenInWei;
|
|
676
|
+
currencySymbol = "ETH";
|
|
677
|
+
currencyAddress = address(0);
|
|
678
|
+
}
|
|
679
|
+
}
|
package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterMerkle/MinterMerkleV3.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/IFilteredMinterMerkleV1.sol";
|
|
7
|
+
import "../../../../interfaces/0.8.x/IDelegationRegistry.sol";
|
|
8
8
|
|
|
9
9
|
import "@openzeppelin-4.7/contracts/utils/cryptography/MerkleProof.sol";
|
|
10
10
|
import "@openzeppelin-4.7/contracts/token/ERC20/IERC20.sol";
|