@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,406 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
// Created By: Art Blocks Inc.
|
|
3
|
+
|
|
4
|
+
import "../../../../interfaces/0.8.x/IGenArt721CoreContractV1.sol";
|
|
5
|
+
import "../../../../interfaces/0.8.x/IMinterFilterV0.sol";
|
|
6
|
+
import "../../../../interfaces/0.8.x/IFilteredMinterV0.sol";
|
|
7
|
+
|
|
8
|
+
import "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
|
|
9
|
+
|
|
10
|
+
pragma solidity 0.8.9;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @title Filtered Minter contract that allows tokens to be minted with ETH.
|
|
14
|
+
* Pricing is achieved using an automated Dutch-auction mechanism.
|
|
15
|
+
* @author Art Blocks Inc.
|
|
16
|
+
*/
|
|
17
|
+
contract MinterDALinV1 is ReentrancyGuard, IFilteredMinterV0 {
|
|
18
|
+
/// Auction details updated for project `projectId`.
|
|
19
|
+
event SetAuctionDetails(
|
|
20
|
+
uint256 indexed projectId,
|
|
21
|
+
uint256 _auctionTimestampStart,
|
|
22
|
+
uint256 _auctionTimestampEnd,
|
|
23
|
+
uint256 _startPrice,
|
|
24
|
+
uint256 _basePrice
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
/// Auction details cleared for project `projectId`.
|
|
28
|
+
event ResetAuctionDetails(uint256 indexed projectId);
|
|
29
|
+
|
|
30
|
+
/// Minimum allowed auction length updated
|
|
31
|
+
event MinimumAuctionLengthSecondsUpdated(
|
|
32
|
+
uint256 _minimumAuctionLengthSeconds
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
/// Core contract address this minter interacts with
|
|
36
|
+
address public immutable genArt721CoreAddress;
|
|
37
|
+
|
|
38
|
+
/// This contract handles cores with interface IV1
|
|
39
|
+
IGenArt721CoreContractV1 private immutable genArtCoreContract;
|
|
40
|
+
|
|
41
|
+
/// Minter filter address this minter interacts with
|
|
42
|
+
address public immutable minterFilterAddress;
|
|
43
|
+
|
|
44
|
+
/// Minter filter this minter may interact with.
|
|
45
|
+
IMinterFilterV0 private immutable minterFilter;
|
|
46
|
+
|
|
47
|
+
/// minterType for this minter
|
|
48
|
+
string public constant minterType = "MinterDALinV1";
|
|
49
|
+
|
|
50
|
+
uint256 constant ONE_MILLION = 1_000_000;
|
|
51
|
+
|
|
52
|
+
/// projectId => has project reached its maximum number of invocations?
|
|
53
|
+
mapping(uint256 => bool) public projectMaxHasBeenInvoked;
|
|
54
|
+
/// projectId => project's maximum number of invocations
|
|
55
|
+
mapping(uint256 => uint256) public projectMaxInvocations;
|
|
56
|
+
/// Minimum auction length in seconds
|
|
57
|
+
uint256 public minimumAuctionLengthSeconds = 3600;
|
|
58
|
+
|
|
59
|
+
/// projectId => auction parameters
|
|
60
|
+
mapping(uint256 => AuctionParameters) public projectAuctionParameters;
|
|
61
|
+
struct AuctionParameters {
|
|
62
|
+
uint256 timestampStart;
|
|
63
|
+
uint256 timestampEnd;
|
|
64
|
+
uint256 startPrice;
|
|
65
|
+
uint256 basePrice;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
modifier onlyCoreWhitelisted() {
|
|
69
|
+
require(
|
|
70
|
+
genArtCoreContract.isWhitelisted(msg.sender),
|
|
71
|
+
"Only Core whitelisted"
|
|
72
|
+
);
|
|
73
|
+
_;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
modifier onlyArtist(uint256 _projectId) {
|
|
77
|
+
require(
|
|
78
|
+
(msg.sender ==
|
|
79
|
+
genArtCoreContract.projectIdToArtistAddress(_projectId)),
|
|
80
|
+
"Only Artist"
|
|
81
|
+
);
|
|
82
|
+
_;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @notice Initializes contract to be a Filtered Minter for
|
|
87
|
+
* `_minterFilter`, integrated with Art Blocks core contract
|
|
88
|
+
* at address `_genArt721Address`.
|
|
89
|
+
* @param _genArt721Address Art Blocks core contract address for
|
|
90
|
+
* which this contract will be a minter.
|
|
91
|
+
* @param _minterFilter Minter filter for which
|
|
92
|
+
* this will a filtered minter.
|
|
93
|
+
*/
|
|
94
|
+
constructor(
|
|
95
|
+
address _genArt721Address,
|
|
96
|
+
address _minterFilter
|
|
97
|
+
) ReentrancyGuard() {
|
|
98
|
+
genArt721CoreAddress = _genArt721Address;
|
|
99
|
+
genArtCoreContract = IGenArt721CoreContractV1(_genArt721Address);
|
|
100
|
+
minterFilterAddress = _minterFilter;
|
|
101
|
+
minterFilter = IMinterFilterV0(_minterFilter);
|
|
102
|
+
require(
|
|
103
|
+
minterFilter.genArt721CoreAddress() == _genArt721Address,
|
|
104
|
+
"Illegal contract pairing"
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @notice Sets the maximum invocations of project `_projectId` based
|
|
110
|
+
* on the value currently defined in the core contract.
|
|
111
|
+
* @param _projectId Project ID to set the maximum invocations for.
|
|
112
|
+
* @dev also checks and may refresh projectMaxHasBeenInvoked for project
|
|
113
|
+
* @dev this enables gas reduction after maxInvocations have been reached -
|
|
114
|
+
* core contracts shall still enforce a maxInvocation check during mint.
|
|
115
|
+
*/
|
|
116
|
+
function setProjectMaxInvocations(
|
|
117
|
+
uint256 _projectId
|
|
118
|
+
) external onlyCoreWhitelisted {
|
|
119
|
+
uint256 invocations;
|
|
120
|
+
uint256 maxInvocations;
|
|
121
|
+
(, , invocations, maxInvocations, , , , , ) = genArtCoreContract
|
|
122
|
+
.projectTokenInfo(_projectId);
|
|
123
|
+
// update storage with results
|
|
124
|
+
projectMaxInvocations[_projectId] = maxInvocations;
|
|
125
|
+
if (invocations < maxInvocations) {
|
|
126
|
+
projectMaxHasBeenInvoked[_projectId] = false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @notice Warning: Disabling purchaseTo is not supported on this minter.
|
|
132
|
+
* This method exists purely for interface-conformance purposes.
|
|
133
|
+
*/
|
|
134
|
+
function togglePurchaseToDisabled(
|
|
135
|
+
uint256 _projectId
|
|
136
|
+
) external view onlyArtist(_projectId) {
|
|
137
|
+
revert("Action not supported");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @notice Sets minimum auction length to `_minimumAuctionLengthSeconds`
|
|
142
|
+
* for all projects.
|
|
143
|
+
* @param _minimumAuctionLengthSeconds Minimum auction length in seconds.
|
|
144
|
+
*/
|
|
145
|
+
function setMinimumAuctionLengthSeconds(
|
|
146
|
+
uint256 _minimumAuctionLengthSeconds
|
|
147
|
+
) external onlyCoreWhitelisted {
|
|
148
|
+
minimumAuctionLengthSeconds = _minimumAuctionLengthSeconds;
|
|
149
|
+
emit MinimumAuctionLengthSecondsUpdated(_minimumAuctionLengthSeconds);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
////// Auction Functions
|
|
153
|
+
/**
|
|
154
|
+
* @notice Sets auction details for project `_projectId`.
|
|
155
|
+
* @param _projectId Project ID to set auction details for.
|
|
156
|
+
* @param _auctionTimestampStart Timestamp at which to start the auction.
|
|
157
|
+
* @param _auctionTimestampEnd Timestamp at which to end the auction.
|
|
158
|
+
* @param _startPrice Price at which to start the auction, in Wei.
|
|
159
|
+
* @param _basePrice Resting price of the auction, in Wei.
|
|
160
|
+
*/
|
|
161
|
+
function setAuctionDetails(
|
|
162
|
+
uint256 _projectId,
|
|
163
|
+
uint256 _auctionTimestampStart,
|
|
164
|
+
uint256 _auctionTimestampEnd,
|
|
165
|
+
uint256 _startPrice,
|
|
166
|
+
uint256 _basePrice
|
|
167
|
+
) external onlyArtist(_projectId) {
|
|
168
|
+
AuctionParameters memory auctionParams = projectAuctionParameters[
|
|
169
|
+
_projectId
|
|
170
|
+
];
|
|
171
|
+
require(
|
|
172
|
+
auctionParams.timestampStart == 0 ||
|
|
173
|
+
block.timestamp < auctionParams.timestampStart,
|
|
174
|
+
"No modifications mid-auction"
|
|
175
|
+
);
|
|
176
|
+
require(
|
|
177
|
+
block.timestamp < _auctionTimestampStart,
|
|
178
|
+
"Only future auctions"
|
|
179
|
+
);
|
|
180
|
+
require(
|
|
181
|
+
_auctionTimestampEnd > _auctionTimestampStart,
|
|
182
|
+
"Auction end must be greater than auction start"
|
|
183
|
+
);
|
|
184
|
+
require(
|
|
185
|
+
_auctionTimestampEnd >=
|
|
186
|
+
_auctionTimestampStart + minimumAuctionLengthSeconds,
|
|
187
|
+
"Auction length must be at least minimumAuctionLengthSeconds"
|
|
188
|
+
);
|
|
189
|
+
require(
|
|
190
|
+
_startPrice > _basePrice,
|
|
191
|
+
"Auction start price must be greater than auction end price"
|
|
192
|
+
);
|
|
193
|
+
projectAuctionParameters[_projectId] = AuctionParameters(
|
|
194
|
+
_auctionTimestampStart,
|
|
195
|
+
_auctionTimestampEnd,
|
|
196
|
+
_startPrice,
|
|
197
|
+
_basePrice
|
|
198
|
+
);
|
|
199
|
+
emit SetAuctionDetails(
|
|
200
|
+
_projectId,
|
|
201
|
+
_auctionTimestampStart,
|
|
202
|
+
_auctionTimestampEnd,
|
|
203
|
+
_startPrice,
|
|
204
|
+
_basePrice
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @notice Resets auction details for project `_projectId`, zero-ing out all
|
|
210
|
+
* relevant auction fields. Not intended to be used in normal auction
|
|
211
|
+
* operation, but rather only in case of the need to halt an auction.
|
|
212
|
+
* @param _projectId Project ID to set auction details for.
|
|
213
|
+
*/
|
|
214
|
+
function resetAuctionDetails(
|
|
215
|
+
uint256 _projectId
|
|
216
|
+
) external onlyCoreWhitelisted {
|
|
217
|
+
delete projectAuctionParameters[_projectId];
|
|
218
|
+
emit ResetAuctionDetails(_projectId);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @notice Purchases a token from project `_projectId`.
|
|
223
|
+
* @param _projectId Project ID to mint a token on.
|
|
224
|
+
* @return tokenId Token ID of minted token
|
|
225
|
+
*/
|
|
226
|
+
function purchase(
|
|
227
|
+
uint256 _projectId
|
|
228
|
+
) external payable returns (uint256 tokenId) {
|
|
229
|
+
tokenId = purchaseTo(msg.sender, _projectId);
|
|
230
|
+
return tokenId;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* @notice Purchases a token from project `_projectId` and sets
|
|
235
|
+
* the token's owner to `_to`.
|
|
236
|
+
* @param _to Address to be the new token's owner.
|
|
237
|
+
* @param _projectId Project ID to mint a token on.
|
|
238
|
+
* @return tokenId Token ID of minted token
|
|
239
|
+
*/
|
|
240
|
+
function purchaseTo(
|
|
241
|
+
address _to,
|
|
242
|
+
uint256 _projectId
|
|
243
|
+
) public payable nonReentrant returns (uint256 tokenId) {
|
|
244
|
+
// CHECKS
|
|
245
|
+
require(
|
|
246
|
+
!projectMaxHasBeenInvoked[_projectId],
|
|
247
|
+
"Maximum number of invocations reached"
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
// _getPrice reverts if auction is unconfigured or has not started
|
|
251
|
+
uint256 currentPriceInWei = _getPrice(_projectId);
|
|
252
|
+
require(
|
|
253
|
+
msg.value >= currentPriceInWei,
|
|
254
|
+
"Must send minimum value to mint!"
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
// EFFECTS
|
|
258
|
+
tokenId = minterFilter.mint(_to, _projectId, msg.sender);
|
|
259
|
+
// what if projectMaxInvocations[_projectId] is 0 (default value)?
|
|
260
|
+
// that is intended, so that by default the minter allows infinite transactions,
|
|
261
|
+
// allowing the artblocks contract to stop minting
|
|
262
|
+
// uint256 tokenInvocation = tokenId % ONE_MILLION;
|
|
263
|
+
if (
|
|
264
|
+
projectMaxInvocations[_projectId] > 0 &&
|
|
265
|
+
tokenId % ONE_MILLION == projectMaxInvocations[_projectId] - 1
|
|
266
|
+
) {
|
|
267
|
+
projectMaxHasBeenInvoked[_projectId] = true;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// INTERACTIONS
|
|
271
|
+
_splitFundsETHAuction(_projectId, currentPriceInWei);
|
|
272
|
+
|
|
273
|
+
return tokenId;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @dev splits ETH funds between sender (if refund), foundation,
|
|
278
|
+
* artist, and artist's additional payee for a token purchased on
|
|
279
|
+
* project `_projectId`.
|
|
280
|
+
* @dev utilizes transfer() to send ETH, which may fail if access
|
|
281
|
+
* lists are not properly populated when purchasing tokens.
|
|
282
|
+
* @param _projectId Project ID for which funds shall be split.
|
|
283
|
+
* @param _currentPriceInWei Current price of token, in Wei.
|
|
284
|
+
*/
|
|
285
|
+
function _splitFundsETHAuction(
|
|
286
|
+
uint256 _projectId,
|
|
287
|
+
uint256 _currentPriceInWei
|
|
288
|
+
) internal {
|
|
289
|
+
if (msg.value > 0) {
|
|
290
|
+
uint256 refund = msg.value - _currentPriceInWei;
|
|
291
|
+
if (refund > 0) {
|
|
292
|
+
(bool success_, ) = msg.sender.call{value: refund}("");
|
|
293
|
+
require(success_, "Refund failed");
|
|
294
|
+
}
|
|
295
|
+
uint256 foundationAmount = (_currentPriceInWei *
|
|
296
|
+
genArtCoreContract.artblocksPercentage()) / 100;
|
|
297
|
+
if (foundationAmount > 0) {
|
|
298
|
+
(bool success_, ) = genArtCoreContract.artblocksAddress().call{
|
|
299
|
+
value: foundationAmount
|
|
300
|
+
}("");
|
|
301
|
+
require(success_, "Foundation payment failed");
|
|
302
|
+
}
|
|
303
|
+
uint256 projectFunds = _currentPriceInWei - foundationAmount;
|
|
304
|
+
uint256 additionalPayeeAmount;
|
|
305
|
+
if (
|
|
306
|
+
genArtCoreContract.projectIdToAdditionalPayeePercentage(
|
|
307
|
+
_projectId
|
|
308
|
+
) > 0
|
|
309
|
+
) {
|
|
310
|
+
additionalPayeeAmount =
|
|
311
|
+
(projectFunds *
|
|
312
|
+
genArtCoreContract.projectIdToAdditionalPayeePercentage(
|
|
313
|
+
_projectId
|
|
314
|
+
)) /
|
|
315
|
+
100;
|
|
316
|
+
if (additionalPayeeAmount > 0) {
|
|
317
|
+
(bool success_, ) = genArtCoreContract
|
|
318
|
+
.projectIdToAdditionalPayee(_projectId)
|
|
319
|
+
.call{value: additionalPayeeAmount}("");
|
|
320
|
+
require(success_, "Additional payment failed");
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
uint256 creatorFunds = projectFunds - additionalPayeeAmount;
|
|
324
|
+
if (creatorFunds > 0) {
|
|
325
|
+
(bool success_, ) = genArtCoreContract
|
|
326
|
+
.projectIdToArtistAddress(_projectId)
|
|
327
|
+
.call{value: creatorFunds}("");
|
|
328
|
+
require(success_, "Artist payment failed");
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* @notice Gets price of minting a token on project `_projectId` given
|
|
335
|
+
* the project's AuctionParameters and current block timestamp.
|
|
336
|
+
* Reverts if auction has not yet started or auction is unconfigured.
|
|
337
|
+
* @param _projectId Project ID to get price of token for.
|
|
338
|
+
* @return current price of token in Wei
|
|
339
|
+
*/
|
|
340
|
+
function _getPrice(uint256 _projectId) private view returns (uint256) {
|
|
341
|
+
AuctionParameters memory auctionParams = projectAuctionParameters[
|
|
342
|
+
_projectId
|
|
343
|
+
];
|
|
344
|
+
require(
|
|
345
|
+
block.timestamp > auctionParams.timestampStart,
|
|
346
|
+
"Auction not yet started"
|
|
347
|
+
);
|
|
348
|
+
if (block.timestamp >= auctionParams.timestampEnd) {
|
|
349
|
+
require(auctionParams.timestampEnd > 0, "Only configured auctions");
|
|
350
|
+
return auctionParams.basePrice;
|
|
351
|
+
}
|
|
352
|
+
uint256 elapsedTime = block.timestamp - auctionParams.timestampStart;
|
|
353
|
+
uint256 duration = auctionParams.timestampEnd -
|
|
354
|
+
auctionParams.timestampStart;
|
|
355
|
+
uint256 startToEndDiff = auctionParams.startPrice -
|
|
356
|
+
auctionParams.basePrice;
|
|
357
|
+
return
|
|
358
|
+
auctionParams.startPrice -
|
|
359
|
+
((elapsedTime * startToEndDiff) / duration);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* @notice Gets if price of token is configured, price of minting a
|
|
364
|
+
* token on project `_projectId`, and currency symbol and address to be
|
|
365
|
+
* used as payment. Supersedes any core contract price information.
|
|
366
|
+
* @param _projectId Project ID to get price information for.
|
|
367
|
+
* @return isConfigured true only if project's auction parameters have been
|
|
368
|
+
* configured on this minter
|
|
369
|
+
* @return tokenPriceInWei current price of token on this minter - invalid
|
|
370
|
+
* if auction has not yet been configured
|
|
371
|
+
* @return currencySymbol currency symbol for purchases of project on this
|
|
372
|
+
* minter. This minter always returns "ETH"
|
|
373
|
+
* @return currencyAddress currency address for purchases of project on
|
|
374
|
+
* this minter. This minter always returns null address, reserved for ether
|
|
375
|
+
*/
|
|
376
|
+
function getPriceInfo(
|
|
377
|
+
uint256 _projectId
|
|
378
|
+
)
|
|
379
|
+
external
|
|
380
|
+
view
|
|
381
|
+
returns (
|
|
382
|
+
bool isConfigured,
|
|
383
|
+
uint256 tokenPriceInWei,
|
|
384
|
+
string memory currencySymbol,
|
|
385
|
+
address currencyAddress
|
|
386
|
+
)
|
|
387
|
+
{
|
|
388
|
+
AuctionParameters memory auctionParams = projectAuctionParameters[
|
|
389
|
+
_projectId
|
|
390
|
+
];
|
|
391
|
+
isConfigured = (auctionParams.startPrice > 0);
|
|
392
|
+
if (block.timestamp <= auctionParams.timestampStart) {
|
|
393
|
+
// Provide a reasonable value for `tokenPriceInWei` when it would
|
|
394
|
+
// otherwise revert, using the starting price before auction starts.
|
|
395
|
+
tokenPriceInWei = auctionParams.startPrice;
|
|
396
|
+
} else if (auctionParams.timestampEnd == 0) {
|
|
397
|
+
// In the case of unconfigured auction, return price of zero when
|
|
398
|
+
// it would otherwise revert
|
|
399
|
+
tokenPriceInWei = 0;
|
|
400
|
+
} else {
|
|
401
|
+
tokenPriceInWei = _getPrice(_projectId);
|
|
402
|
+
}
|
|
403
|
+
currencySymbol = "ETH";
|
|
404
|
+
currencyAddress = address(0);
|
|
405
|
+
}
|
|
406
|
+
}
|
package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDALin/MinterDALinV2.sol
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
2
|
// Created By: Art Blocks Inc.
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
4
|
+
import "../../../../interfaces/0.8.x/IGenArt721CoreContractV3.sol";
|
|
5
|
+
import "../../../../interfaces/0.8.x/IMinterFilterV0.sol";
|
|
6
|
+
import "../../../../interfaces/0.8.x/IFilteredMinterDALinV0.sol";
|
|
7
7
|
|
|
8
8
|
import "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
|
|
9
9
|
import "@openzeppelin-4.5/contracts/utils/math/SafeCast.sol";
|
package/contracts/{minter-suite → archive/minter-suite}/Minters/MinterDALin/MinterDALinV3.sol
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
2
|
// Created By: Art Blocks Inc.
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
4
|
+
import "../../../../interfaces/0.8.x/IGenArt721CoreContractV3.sol";
|
|
5
|
+
import "../../../../interfaces/0.8.x/IMinterFilterV0.sol";
|
|
6
|
+
import "../../../../interfaces/0.8.x/IFilteredMinterDALinV1.sol";
|
|
7
7
|
|
|
8
8
|
import "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
|
|
9
9
|
import "@openzeppelin-4.5/contracts/utils/math/SafeCast.sol";
|