@artblocks/contracts 0.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/.env.example +10 -0
- package/LICENSE +165 -0
- package/README.md +286 -0
- package/artifacts/contracts/AdminACLV0.sol/AdminACLV0.json +164 -0
- package/artifacts/contracts/AdminACLV1.sol/AdminACLV1.json +248 -0
- package/artifacts/contracts/BasicRandomizer.sol/BasicRandomizer.json +24 -0
- package/artifacts/contracts/BasicRandomizerV2.sol/BasicRandomizerV2.json +102 -0
- package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +1020 -0
- package/artifacts/contracts/GenArt721CoreV3.sol/GenArt721CoreV3.json +1928 -0
- package/artifacts/contracts/GenArt721CoreV3_Engine.sol/GenArt721CoreV3_Engine.json +1942 -0
- package/artifacts/contracts/engine/GenArt721CoreV2_ENGINE_FLEX.sol/GenArt721CoreV2_ENGINE_FLEX.json +1708 -0
- package/artifacts/contracts/engine/GenArt721CoreV2_PBAB.sol/GenArt721CoreV2_PBAB.json +1410 -0
- package/artifacts/contracts/engine/GenArt721CoreV2_PRTNR.sol/GenArt721CoreV2_PRTNR.json +1436 -0
- package/artifacts/contracts/engine/GenArt721MinterBurner_PBAB.sol/GenArt721MinterBurner_PBAB.json +437 -0
- package/artifacts/contracts/engine/GenArt721MinterDAExp_PBAB.sol/GenArt721MinterDAExp_PBAB.json +508 -0
- package/artifacts/contracts/engine/GenArt721Minter_PBAB.sol/GenArt721Minter_PBAB.json +381 -0
- package/artifacts/contracts/engine-registry/EngineRegistryV0.sol/EngineRegistryV0.json +109 -0
- package/artifacts/contracts/engine-registry/future/EngineRegistryV1.sol/EngineRegistryV1.json +109 -0
- package/artifacts/contracts/explorations/GenArt721CoreV3_Explorations.sol/GenArt721CoreV3_Explorations.json +1902 -0
- package/artifacts/contracts/interfaces/0.5.x/IBonusContract.sol/IBonusContract.json +47 -0
- package/artifacts/contracts/interfaces/0.5.x/IGenArt721CoreContractV1.sol/IGenArt721CoreContractV1.json +413 -0
- package/artifacts/contracts/interfaces/0.5.x/IGenArt721CoreV2_PBAB.sol/IGenArt721CoreV2_PBAB.json +392 -0
- package/artifacts/contracts/interfaces/0.5.x/IRandomizer.sol/IRandomizer.json +26 -0
- package/artifacts/contracts/interfaces/0.8.x/IAdminACLV0.sol/IAdminACLV0.json +122 -0
- package/artifacts/contracts/interfaces/0.8.x/IArtblocksRoyaltyOverride.sol/IArtblocksRoyaltyOverride.json +59 -0
- package/artifacts/contracts/interfaces/0.8.x/IBonusContract.sol/IBonusContract.json +43 -0
- package/artifacts/contracts/interfaces/0.8.x/IDelegationRegistry.sol/IDelegationRegistry.json +510 -0
- package/artifacts/contracts/interfaces/0.8.x/IDependencyRegistryCompatibleV0.sol/IDependencyRegistryCompatibleV0.json +53 -0
- package/artifacts/contracts/interfaces/0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +350 -0
- package/artifacts/contracts/interfaces/0.8.x/IEngineRegistryV0.sol/IEngineRegistryV0.json +85 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDAExpSettlementV0.sol/IFilteredMinterDAExpSettlementV0.json +730 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDAExpV0.sol/IFilteredMinterDAExpV0.json +311 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDAExpV1.sol/IFilteredMinterDAExpV1.json +617 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDALinV0.sol/IFilteredMinterDALinV0.json +292 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterDALinV1.sol/IFilteredMinterDALinV1.json +598 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterHolderV0.sol/IFilteredMinterHolderV0.json +355 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterHolderV1.sol/IFilteredMinterHolderV1.json +368 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterHolderV2.sol/IFilteredMinterHolderV2.json +674 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterMerkleV0.sol/IFilteredMinterMerkleV0.json +551 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterMerkleV1.sol/IFilteredMinterMerkleV1.json +564 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterMerkleV2.sol/IFilteredMinterMerkleV2.json +601 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterV0.sol/IFilteredMinterV0.json +216 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterV1.sol/IFilteredMinterV1.json +485 -0
- package/artifacts/contracts/interfaces/0.8.x/IFilteredMinterV2.sol/IFilteredMinterV2.json +522 -0
- package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV1.sol/IGenArt721CoreContractV1.json +299 -0
- package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV3.sol/IGenArt721CoreContractV3.json +609 -0
- package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Base.sol/IGenArt721CoreContractV3_Base.json +448 -0
- package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Engine.sol/IGenArt721CoreContractV3_Engine.json +649 -0
- package/artifacts/contracts/interfaces/0.8.x/IGenArt721CoreV2_PBAB.sol/IGenArt721CoreV2_PBAB.json +362 -0
- package/artifacts/contracts/interfaces/0.8.x/IManifold.sol/IManifold.json +35 -0
- package/artifacts/contracts/interfaces/0.8.x/IMinterFilterV0.sol/IMinterFilterV0.json +192 -0
- package/artifacts/contracts/interfaces/0.8.x/IRandomizer.sol/IRandomizer.json +24 -0
- package/artifacts/contracts/interfaces/0.8.x/IRandomizerV2.sol/IRandomizerV2.json +37 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/Address.json +10 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/Counters.json +10 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/CustomERC721Metadata.json +425 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/ERC165.json +38 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/ERC721.json +322 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/ERC721Enumerable.json +384 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/GenArt721CoreV1.json +1773 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/IERC165.json +32 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/IERC721.json +316 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/IERC721Enumerable.json +378 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/IERC721Receiver.json +47 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/SafeMath.json +10 -0
- package/artifacts/contracts/legacy/GenArt721CoreV1.sol/Strings.json +10 -0
- package/artifacts/contracts/legacy/GenArt721LegacyMinter.sol/GenArt721LegacyMinter.json +338 -0
- package/artifacts/contracts/libs/0.5.x/CustomERC721Metadata.sol/CustomERC721Metadata.json +425 -0
- package/artifacts/contracts/libs/0.5.x/IERC20.sol/IERC20.json +206 -0
- package/artifacts/contracts/libs/0.5.x/SafeMath.sol/SafeMath.json +10 -0
- package/artifacts/contracts/libs/0.5.x/Strings.sol/Strings.json +10 -0
- package/artifacts/contracts/libs/0.8.x/BytecodeStorage.sol/BytecodeStorage.json +10 -0
- package/artifacts/contracts/libs/0.8.x/Bytes32Strings.sol/Bytes32Strings.json +10 -0
- package/artifacts/contracts/libs/0.8.x/ERC721_PackedHashSeed.sol/ERC721_PackedHashSeed.json +357 -0
- package/artifacts/contracts/libs/integration-refs/delegation-registry/DelegationRegistry.sol/DelegationRegistry.json +529 -0
- package/artifacts/contracts/libs/integration-refs/gnosis-safe/GnosisSafeMock.sol/GnosisSafeMock.json +1037 -0
- package/artifacts/contracts/libs/integration-refs/gnosis-safe/GnosisSafeProxyFactoryMock.sol/GnosisSafeProxyFactoryMock.json +172 -0
- package/artifacts/contracts/libs/integration-refs/gnosis-safe/MultiSendMock.sol/MultiSendMock.json +24 -0
- package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV0.sol/MinterFilterV0.json +342 -0
- package/artifacts/contracts/minter-suite/MinterFilter/MinterFilterV1.sol/MinterFilterV1.json +322 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol/MinterDAExpV2.json +550 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol/MinterDAExpV3.json +856 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol/MinterDAExpSettlementV0.json +1053 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDALin/MinterDALinV2.sol/MinterDALinV2.json +526 -0
- package/artifacts/contracts/minter-suite/Minters/MinterDALin/MinterDALinV3.sol/MinterDALinV3.json +832 -0
- package/artifacts/contracts/minter-suite/Minters/MinterHolder/MinterHolderV2.sol/MinterHolderV2.json +794 -0
- package/artifacts/contracts/minter-suite/Minters/MinterHolder/MinterHolderV3.sol/MinterHolderV3.json +1100 -0
- package/artifacts/contracts/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol/MinterMerkleV3.json +1002 -0
- package/artifacts/contracts/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol/MinterMerkleV4.json +1039 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol/MinterSetPriceV2.json +365 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol/MinterSetPriceV3.json +671 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPrice/deprecated/MinterSetPriceV1.sol/MinterSetPriceV1.json +288 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol/MinterSetPriceERC20V2.json +436 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol/MinterSetPriceERC20V3.json +742 -0
- package/artifacts/contracts/minter-suite/Minters/MinterSetPriceERC20/deprecated/MinterSetPriceERC20V0.sol/MinterSetPriceERC20V0.json +461 -0
- package/artifacts/contracts/mock/BytecodeTextCR_DMock.sol/BytecodeTextCR_DMock.json +194 -0
- package/artifacts/contracts/mock/DeadReceiverMock.sol/DeadReceiverMock.json +15 -0
- package/artifacts/contracts/mock/ERC20Mock.sol/ERC20Mock.json +292 -0
- package/artifacts/contracts/mock/MockAdminACLV0.sol/MockAdminACLV0Events.json +165 -0
- package/artifacts/contracts/mock/RandomizerV2_NoAssignMock.sol/RandomizerV2_NoAssignMock.json +128 -0
- package/artifacts/contracts/mock/ReentrancyHolderMock.sol/ReentrancyHolderMock.json +118 -0
- package/artifacts/contracts/mock/ReentrancyMerkleMock.sol/ReentrancyMerkleMock.json +87 -0
- package/artifacts/contracts/mock/ReentrancyMock.sol/ReentrancyMock.json +82 -0
- package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverride.sol/GenArt721RoyaltyOverride.json +208 -0
- package/artifacts/contracts/royalty-registry/GenArt721RoyaltyOverride_PBAB.sol/GenArt721RoyaltyOverride_PBAB.json +301 -0
- package/contracts/AdminACLV0.sol +103 -0
- package/contracts/AdminACLV1.sol +193 -0
- package/contracts/BasicRandomizer.sol +23 -0
- package/contracts/BasicRandomizerV2.sol +36 -0
- package/contracts/DependencyRegistryV0.sol +893 -0
- package/contracts/GenArt721CoreV3.sol +2001 -0
- package/contracts/GenArt721CoreV3_Engine.sol +2061 -0
- package/contracts/engine/GenArt721CoreV2_ENGINE_FLEX.sol +887 -0
- package/contracts/engine/GenArt721CoreV2_PBAB.sol +695 -0
- package/contracts/engine/GenArt721CoreV2_PRTNR.sol +749 -0
- package/contracts/engine/GenArt721MinterBurner_PBAB.sol +467 -0
- package/contracts/engine/GenArt721MinterDAExp_PBAB.sol +614 -0
- package/contracts/engine/GenArt721Minter_PBAB.sol +420 -0
- package/contracts/engine-registry/EngineRegistryV0.sol +72 -0
- package/contracts/engine-registry/future/EngineRegistryV1.sol +86 -0
- package/contracts/explorations/GenArt721CoreV3_Explorations.sol +1989 -0
- package/contracts/interfaces/0.5.x/IBonusContract.sol +10 -0
- package/contracts/interfaces/0.5.x/IGenArt721CoreContractV1.sol +91 -0
- package/contracts/interfaces/0.5.x/IGenArt721CoreV2_PBAB.sol +92 -0
- package/contracts/interfaces/0.5.x/IRandomizer.sol +8 -0
- package/contracts/interfaces/0.8.x/IAdminACLV0.sol +51 -0
- package/contracts/interfaces/0.8.x/IArtblocksRoyaltyOverride.sol +34 -0
- package/contracts/interfaces/0.8.x/IBonusContract.sol +10 -0
- package/contracts/interfaces/0.8.x/IDelegationRegistry.sol +221 -0
- package/contracts/interfaces/0.8.x/IDependencyRegistryCompatibleV0.sol +31 -0
- package/contracts/interfaces/0.8.x/IDependencyRegistryV0.sol +95 -0
- package/contracts/interfaces/0.8.x/IEngineRegistryV0.sol +38 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterDAExpSettlementV0.sol +70 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterDAExpV0.sol +35 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterDAExpV1.sol +16 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterDALinV0.sol +32 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterDALinV1.sol +16 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterHolderV0.sol +68 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterHolderV1.sol +19 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterHolderV2.sol +19 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterMerkleV0.sol +37 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterMerkleV1.sol +19 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterMerkleV2.sol +19 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterV0.sol +74 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterV1.sol +127 -0
- package/contracts/interfaces/0.8.x/IFilteredMinterV2.sol +30 -0
- package/contracts/interfaces/0.8.x/IGenArt721CoreContractV1.sol +73 -0
- package/contracts/interfaces/0.8.x/IGenArt721CoreContractV3.sol +79 -0
- package/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Base.sol +127 -0
- package/contracts/interfaces/0.8.x/IGenArt721CoreContractV3_Engine.sol +80 -0
- package/contracts/interfaces/0.8.x/IGenArt721CoreV2_PBAB.sol +91 -0
- package/contracts/interfaces/0.8.x/IManifold.sol +24 -0
- package/contracts/interfaces/0.8.x/IMinterFilterV0.sol +47 -0
- package/contracts/interfaces/0.8.x/IRandomizer.sol +8 -0
- package/contracts/interfaces/0.8.x/IRandomizerV2.sol +15 -0
- package/contracts/legacy/GenArt721CoreV1.sol +1593 -0
- package/contracts/legacy/GenArt721LegacyMinter.sol +275 -0
- package/contracts/libs/0.5.x/CustomERC721Metadata.sol +52 -0
- package/contracts/libs/0.5.x/IERC20.sol +96 -0
- package/contracts/libs/0.5.x/SafeMath.sol +98 -0
- package/contracts/libs/0.5.x/Strings.sol +92 -0
- package/contracts/libs/0.8.x/BytecodeStorage.sol +314 -0
- package/contracts/libs/0.8.x/Bytes32Strings.sol +66 -0
- package/contracts/libs/0.8.x/ERC721_PackedHashSeed.sol +514 -0
- package/contracts/libs/integration-refs/delegation-registry/DelegationRegistry.sol +663 -0
- package/contracts/libs/integration-refs/gnosis-safe/GnosisSafeMock.sol +6 -0
- package/contracts/libs/integration-refs/gnosis-safe/GnosisSafeProxyFactoryMock.sol +6 -0
- package/contracts/libs/integration-refs/gnosis-safe/MultiSendMock.sol +6 -0
- package/contracts/minter-suite/MinterFilter/MinterFilterV0.sol +291 -0
- package/contracts/minter-suite/MinterFilter/MinterFilterV1.sol +320 -0
- package/contracts/minter-suite/Minters/MinterDAExp/MinterDAExpV2.sol +571 -0
- package/contracts/minter-suite/Minters/MinterDAExp/MinterDAExpV3.sol +622 -0
- package/contracts/minter-suite/Minters/MinterDAExpSettlement/MinterDAExpSettlementV0.sol +1066 -0
- package/contracts/minter-suite/Minters/MinterDALin/MinterDALinV2.sol +527 -0
- package/contracts/minter-suite/Minters/MinterDALin/MinterDALinV3.sol +576 -0
- package/contracts/minter-suite/Minters/MinterHolder/MinterHolderV2.sol +749 -0
- package/contracts/minter-suite/Minters/MinterHolder/MinterHolderV3.sol +798 -0
- package/contracts/minter-suite/Minters/MinterMerkle/MinterMerkleV3.sol +682 -0
- package/contracts/minter-suite/Minters/MinterMerkle/MinterMerkleV4.sol +733 -0
- package/contracts/minter-suite/Minters/MinterSetPrice/MinterSetPriceV2.sol +350 -0
- package/contracts/minter-suite/Minters/MinterSetPrice/MinterSetPriceV3.sol +401 -0
- package/contracts/minter-suite/Minters/MinterSetPrice/deprecated/MinterSetPriceV1.sol +274 -0
- package/contracts/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V2.sol +491 -0
- package/contracts/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V3.sol +542 -0
- package/contracts/minter-suite/Minters/MinterSetPriceERC20/deprecated/MinterSetPriceERC20V0.sol +470 -0
- package/contracts/mock/BytecodeTextCR_DMock.sol +184 -0
- package/contracts/mock/DeadReceiverMock.sol +13 -0
- package/contracts/mock/ERC20Mock.sol +11 -0
- package/contracts/mock/MockAdminACLV0.sol +65 -0
- package/contracts/mock/RandomizerV2_NoAssignMock.sol +43 -0
- package/contracts/mock/ReentrancyHolderMock.sol +50 -0
- package/contracts/mock/ReentrancyMerkleMock.sol +64 -0
- package/contracts/mock/ReentrancyMock.sol +44 -0
- package/contracts/royalty-registry/GenArt721RoyaltyOverride.sol +168 -0
- package/contracts/royalty-registry/GenArt721RoyaltyOverride_PBAB.sol +221 -0
- package/package.json +83 -0
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
// Created By: Art Blocks Inc.
|
|
3
|
+
|
|
4
|
+
import "../interfaces/0.8.x/IGenArt721CoreV2_PBAB.sol";
|
|
5
|
+
|
|
6
|
+
import "@openzeppelin-4.5/contracts/security/ReentrancyGuard.sol";
|
|
7
|
+
import "@openzeppelin-4.5/contracts/utils/math/SafeCast.sol";
|
|
8
|
+
|
|
9
|
+
pragma solidity 0.8.17;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @title A minter contract that allows tokens to be minted with ETH.
|
|
13
|
+
* Pricing is achieved using an automated Dutch-auction mechanism.
|
|
14
|
+
* This is a fork of MinterDAExpV2, which is intended to be used directly
|
|
15
|
+
* with IGenArt721CoreV2_PBAB contracts rather than with IGenArt721CoreContractV3
|
|
16
|
+
* and as such does not conform to IFilteredMinterV0 nor assume presence
|
|
17
|
+
* of a IMinterFilterV0 conforming minter filter.
|
|
18
|
+
* @author Art Blocks Inc.
|
|
19
|
+
* @notice Privileged Roles and Ownership:
|
|
20
|
+
* This contract is designed to be managed, with limited powers.
|
|
21
|
+
* Privileged roles and abilities are controlled by the core contract's allowlisted
|
|
22
|
+
* (`isWhitelisted` conforming) addresses and a project's artist. Both of these
|
|
23
|
+
* roles hold extensive power and can modify minter details.
|
|
24
|
+
* Care must be taken to ensure that the core contract permissions and artist
|
|
25
|
+
* addresses are secure behind a multi-sig or other access control mechanism.
|
|
26
|
+
* ----------------------------------------------------------------------------
|
|
27
|
+
* The following functions are restricted to the core contract's allowlisted
|
|
28
|
+
* (`isWhitelisted` conforming) address(es):
|
|
29
|
+
* - setAllowablePriceDecayHalfLifeRangeSeconds (note: this range is only
|
|
30
|
+
* enforced when creating new auctions)
|
|
31
|
+
* - resetAuctionDetails (note: this will prevent minting until a new auction
|
|
32
|
+
* is created)
|
|
33
|
+
* ----------------------------------------------------------------------------
|
|
34
|
+
* The following functions are restricted to a project's artist:
|
|
35
|
+
* - setAuctionDetails (note: this may only be called when there is no active
|
|
36
|
+
* auction)
|
|
37
|
+
* ----------------------------------------------------------------------------
|
|
38
|
+
* Additional admin and artist privileged roles may be described on other
|
|
39
|
+
* contracts that this minter integrates with.
|
|
40
|
+
*
|
|
41
|
+
* @dev Note that while this minter makes use of `block.timestamp` and it is
|
|
42
|
+
* technically possible that this value is manipulated by block producers, such
|
|
43
|
+
* manipulation will not have material impact on the price values of this minter
|
|
44
|
+
* given the business practices for how pricing is congfigured for this minter
|
|
45
|
+
* and that variations on the order of less than a minute should not
|
|
46
|
+
* meaningfully impact price given the minimum allowable price decay rate that
|
|
47
|
+
* this minter intends to support.
|
|
48
|
+
*/
|
|
49
|
+
contract GenArt721MinterDAExp_PBAB is ReentrancyGuard {
|
|
50
|
+
using SafeCast for uint256;
|
|
51
|
+
|
|
52
|
+
/// Auction details updated for project `projectId`.
|
|
53
|
+
event SetAuctionDetails(
|
|
54
|
+
uint256 indexed projectId,
|
|
55
|
+
uint256 _auctionTimestampStart,
|
|
56
|
+
uint256 _priceDecayHalfLifeSeconds,
|
|
57
|
+
uint256 _startPrice,
|
|
58
|
+
uint256 _basePrice
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
/// Auction details cleared for project `projectId`.
|
|
62
|
+
event ResetAuctionDetails(uint256 indexed projectId);
|
|
63
|
+
|
|
64
|
+
/// Maximum and minimum allowed price decay half lifes updated.
|
|
65
|
+
event AuctionHalfLifeRangeSecondsUpdated(
|
|
66
|
+
uint256 _minimumPriceDecayHalfLifeSeconds,
|
|
67
|
+
uint256 _maximumPriceDecayHalfLifeSeconds
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
/// Core contract address this minter interacts with
|
|
71
|
+
address public immutable genArt721CoreAddress;
|
|
72
|
+
|
|
73
|
+
/// This contract handles cores with interface IGenArt721CoreV2_PBAB
|
|
74
|
+
IGenArt721CoreV2_PBAB private immutable genArtCoreContract;
|
|
75
|
+
|
|
76
|
+
uint256 constant ONE_MILLION = 1_000_000;
|
|
77
|
+
|
|
78
|
+
address payable public ownerAddress;
|
|
79
|
+
uint256 public ownerPercentage;
|
|
80
|
+
|
|
81
|
+
struct ProjectConfig {
|
|
82
|
+
bool maxHasBeenInvoked;
|
|
83
|
+
uint24 maxInvocations;
|
|
84
|
+
// max uint64 ~= 1.8e19 sec ~= 570 billion years
|
|
85
|
+
uint64 timestampStart;
|
|
86
|
+
uint64 priceDecayHalfLifeSeconds;
|
|
87
|
+
uint256 startPrice;
|
|
88
|
+
uint256 basePrice;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
mapping(uint256 => ProjectConfig) public projectConfig;
|
|
92
|
+
|
|
93
|
+
/// Minimum price decay half life: price must decay with a half life of at
|
|
94
|
+
/// least this amount (must cut in half at least every N seconds).
|
|
95
|
+
uint256 public minimumPriceDecayHalfLifeSeconds = 300; // 5 minutes
|
|
96
|
+
/// Maximum price decay half life: price may decay with a half life of no
|
|
97
|
+
/// more than this amount (may cut in half at no more than every N seconds).
|
|
98
|
+
uint256 public maximumPriceDecayHalfLifeSeconds = 3600; // 60 minutes
|
|
99
|
+
|
|
100
|
+
// modifier to restrict access to only addresses specified by the
|
|
101
|
+
// `onlyWhitelisted()` method on the associated core contract
|
|
102
|
+
modifier onlyCoreAllowlisted() {
|
|
103
|
+
require(
|
|
104
|
+
genArtCoreContract.isWhitelisted(msg.sender),
|
|
105
|
+
"Only Core allowlisted"
|
|
106
|
+
);
|
|
107
|
+
_;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// modifier to restrict access to only the artist for a given project
|
|
111
|
+
modifier onlyArtist(uint256 _projectId) {
|
|
112
|
+
require(
|
|
113
|
+
(msg.sender ==
|
|
114
|
+
genArtCoreContract.projectIdToArtistAddress(_projectId)),
|
|
115
|
+
"Only Artist"
|
|
116
|
+
);
|
|
117
|
+
_;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// modifier to restrict access to calls only involving a valid projectId
|
|
121
|
+
// (an existing project)
|
|
122
|
+
modifier onlyValidProjectId(uint256 _projectId) {
|
|
123
|
+
require(
|
|
124
|
+
_projectId < genArtCoreContract.nextProjectId(),
|
|
125
|
+
"Only existing projects"
|
|
126
|
+
);
|
|
127
|
+
_;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @notice Initializes contract to be integrated with
|
|
132
|
+
* Art Blocks core contract at address `_genArt721Address`.
|
|
133
|
+
* @param _genArt721Address Art Blocks core contract address for
|
|
134
|
+
* which this contract will be a minter.
|
|
135
|
+
*/
|
|
136
|
+
constructor(address _genArt721Address) ReentrancyGuard() {
|
|
137
|
+
genArt721CoreAddress = _genArt721Address;
|
|
138
|
+
genArtCoreContract = IGenArt721CoreV2_PBAB(_genArt721Address);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @notice Sets the minter owner (the platform provider) address to `_ownerAddress`.
|
|
143
|
+
* @param _ownerAddress New owner address.
|
|
144
|
+
*/
|
|
145
|
+
function setOwnerAddress(
|
|
146
|
+
address payable _ownerAddress
|
|
147
|
+
) public onlyCoreAllowlisted {
|
|
148
|
+
ownerAddress = _ownerAddress;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @notice Sets the minter owner (the platform provider) revenue % to `_ownerPercentage` percent.
|
|
153
|
+
* @param _ownerPercentage New owner percentage.
|
|
154
|
+
*/
|
|
155
|
+
function setOwnerPercentage(
|
|
156
|
+
uint256 _ownerPercentage
|
|
157
|
+
) public onlyCoreAllowlisted {
|
|
158
|
+
ownerPercentage = _ownerPercentage;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @notice Syncs local maximum invocations of project `_projectId` based on
|
|
163
|
+
* the value currently defined in the core contract. Only used for gas
|
|
164
|
+
* optimization of mints after maxInvocations has been reached.
|
|
165
|
+
* @param _projectId Project ID to set the maximum invocations for.
|
|
166
|
+
* @dev this enables gas reduction after maxInvocations have been reached -
|
|
167
|
+
* core contracts shall still enforce a maxInvocation check during mint.
|
|
168
|
+
* @dev function is intentionally not gated to any specific access control;
|
|
169
|
+
* it only syncs a local state variable to the core contract's state.
|
|
170
|
+
*/
|
|
171
|
+
function setProjectMaxInvocations(uint256 _projectId) external {
|
|
172
|
+
uint256 maxInvocations;
|
|
173
|
+
uint256 invocations;
|
|
174
|
+
(, , invocations, maxInvocations, , , , , ) = genArtCoreContract
|
|
175
|
+
.projectTokenInfo(_projectId);
|
|
176
|
+
// update storage with results
|
|
177
|
+
projectConfig[_projectId].maxInvocations = uint24(maxInvocations);
|
|
178
|
+
if (invocations < maxInvocations) {
|
|
179
|
+
projectConfig[_projectId].maxHasBeenInvoked = false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @notice Warning: Disabling purchaseTo is not supported on this minter.
|
|
185
|
+
* This method exists purely for interface-conformance purposes.
|
|
186
|
+
*/
|
|
187
|
+
function togglePurchaseToDisabled(
|
|
188
|
+
uint256 _projectId
|
|
189
|
+
) external view onlyArtist(_projectId) {
|
|
190
|
+
revert("Action not supported");
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @notice projectId => has project reached its maximum number of
|
|
195
|
+
* invocations? Note that this returns a local cache of the core contract's
|
|
196
|
+
* state, and may be out of sync with the core contract. This is
|
|
197
|
+
* intentional, as it only enables gas optimization of mints after a
|
|
198
|
+
* project's maximum invocations has been reached. A false negative will
|
|
199
|
+
* only result in a gas cost increase, since the core contract will still
|
|
200
|
+
* enforce a maxInvocation check during minting. A false positive is not
|
|
201
|
+
* possible because the V2 engine core contract only allows maximum invocations
|
|
202
|
+
* to be reduced, not increased. Based on this rationale, we intentionally
|
|
203
|
+
* do not do input validation in this method as to whether or not the input
|
|
204
|
+
* `_projectId` is an existing project ID.
|
|
205
|
+
*
|
|
206
|
+
*/
|
|
207
|
+
function projectMaxHasBeenInvoked(
|
|
208
|
+
uint256 _projectId
|
|
209
|
+
) external view returns (bool) {
|
|
210
|
+
return projectConfig[_projectId].maxHasBeenInvoked;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @notice projectId => project's maximum number of invocations.
|
|
215
|
+
* Optionally synced with core contract value, for gas optimization.
|
|
216
|
+
* Note that this returns a local cache of the core contract's
|
|
217
|
+
* state, and may be out of sync with the core contract. This is
|
|
218
|
+
* intentional, as it only enables gas optimization of mints after a
|
|
219
|
+
* project's maximum invocations has been reached.
|
|
220
|
+
* @dev A number greater than the core contract's project max invocations
|
|
221
|
+
* will only result in a gas cost increase, since the core contract will
|
|
222
|
+
* still enforce a maxInvocation check during minting. A number less than
|
|
223
|
+
* the core contract's project max invocations is only possible when the
|
|
224
|
+
* project's max invocations have not been synced on this minter, since the
|
|
225
|
+
* V2 engine core contract only allows maximum invocations to be reduced, not
|
|
226
|
+
* increased. When this happens, the minter will enable minting, allowing
|
|
227
|
+
* the core contract to enforce the max invocations check. Based on this
|
|
228
|
+
* rationale, we intentionally do not do input validation in this method as
|
|
229
|
+
* to whether or not the input `_projectId` is an existing project ID.
|
|
230
|
+
*/
|
|
231
|
+
function projectMaxInvocations(
|
|
232
|
+
uint256 _projectId
|
|
233
|
+
) external view returns (uint256) {
|
|
234
|
+
return uint256(projectConfig[_projectId].maxInvocations);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @notice projectId => auction parameters
|
|
239
|
+
*/
|
|
240
|
+
function projectAuctionParameters(
|
|
241
|
+
uint256 _projectId
|
|
242
|
+
)
|
|
243
|
+
external
|
|
244
|
+
view
|
|
245
|
+
returns (
|
|
246
|
+
uint256 timestampStart,
|
|
247
|
+
uint256 priceDecayHalfLifeSeconds,
|
|
248
|
+
uint256 startPrice,
|
|
249
|
+
uint256 basePrice
|
|
250
|
+
)
|
|
251
|
+
{
|
|
252
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
253
|
+
return (
|
|
254
|
+
_projectConfig.timestampStart,
|
|
255
|
+
_projectConfig.priceDecayHalfLifeSeconds,
|
|
256
|
+
_projectConfig.startPrice,
|
|
257
|
+
_projectConfig.basePrice
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @notice Sets the minimum and maximum values that are settable for
|
|
263
|
+
* `_priceDecayHalfLifeSeconds` across all projects.
|
|
264
|
+
* @param _minimumPriceDecayHalfLifeSeconds Minimum price decay half life
|
|
265
|
+
* (in seconds).
|
|
266
|
+
* @param _maximumPriceDecayHalfLifeSeconds Maximum price decay half life
|
|
267
|
+
* (in seconds).
|
|
268
|
+
*/
|
|
269
|
+
function setAllowablePriceDecayHalfLifeRangeSeconds(
|
|
270
|
+
uint256 _minimumPriceDecayHalfLifeSeconds,
|
|
271
|
+
uint256 _maximumPriceDecayHalfLifeSeconds
|
|
272
|
+
) external onlyCoreAllowlisted {
|
|
273
|
+
require(
|
|
274
|
+
_maximumPriceDecayHalfLifeSeconds >
|
|
275
|
+
_minimumPriceDecayHalfLifeSeconds,
|
|
276
|
+
"Maximum half life must be greater than minimum"
|
|
277
|
+
);
|
|
278
|
+
require(
|
|
279
|
+
_minimumPriceDecayHalfLifeSeconds > 0,
|
|
280
|
+
"Half life of zero not allowed"
|
|
281
|
+
);
|
|
282
|
+
minimumPriceDecayHalfLifeSeconds = _minimumPriceDecayHalfLifeSeconds;
|
|
283
|
+
maximumPriceDecayHalfLifeSeconds = _maximumPriceDecayHalfLifeSeconds;
|
|
284
|
+
emit AuctionHalfLifeRangeSecondsUpdated(
|
|
285
|
+
_minimumPriceDecayHalfLifeSeconds,
|
|
286
|
+
_maximumPriceDecayHalfLifeSeconds
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
////// Auction Functions
|
|
291
|
+
/**
|
|
292
|
+
* @notice Sets auction details for project `_projectId`.
|
|
293
|
+
* @param _projectId Project ID to set auction details for.
|
|
294
|
+
* @param _auctionTimestampStart Timestamp at which to start the auction.
|
|
295
|
+
* @param _priceDecayHalfLifeSeconds The half life with which to decay the
|
|
296
|
+
* price (in seconds).
|
|
297
|
+
* @param _startPrice Price at which to start the auction, in Wei.
|
|
298
|
+
* @param _basePrice Resting price of the auction, in Wei.
|
|
299
|
+
* @dev Note that it is intentionally supported here that the configured
|
|
300
|
+
* price may be explicitly set to `0`.
|
|
301
|
+
*/
|
|
302
|
+
function setAuctionDetails(
|
|
303
|
+
uint256 _projectId,
|
|
304
|
+
uint256 _auctionTimestampStart,
|
|
305
|
+
uint256 _priceDecayHalfLifeSeconds,
|
|
306
|
+
uint256 _startPrice,
|
|
307
|
+
uint256 _basePrice
|
|
308
|
+
) external onlyValidProjectId(_projectId) onlyArtist(_projectId) {
|
|
309
|
+
// CHECKS
|
|
310
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
311
|
+
require(
|
|
312
|
+
_projectConfig.timestampStart == 0 ||
|
|
313
|
+
block.timestamp < _projectConfig.timestampStart,
|
|
314
|
+
"No modifications mid-auction"
|
|
315
|
+
);
|
|
316
|
+
require(
|
|
317
|
+
block.timestamp < _auctionTimestampStart,
|
|
318
|
+
"Only future auctions"
|
|
319
|
+
);
|
|
320
|
+
require(
|
|
321
|
+
_startPrice >= _basePrice,
|
|
322
|
+
"Auction start price must be greater than or equal to auction end price"
|
|
323
|
+
);
|
|
324
|
+
require(
|
|
325
|
+
(_priceDecayHalfLifeSeconds >= minimumPriceDecayHalfLifeSeconds) &&
|
|
326
|
+
(_priceDecayHalfLifeSeconds <=
|
|
327
|
+
maximumPriceDecayHalfLifeSeconds),
|
|
328
|
+
"Price decay half life must fall between min and max allowable values"
|
|
329
|
+
);
|
|
330
|
+
// EFFECTS
|
|
331
|
+
_projectConfig.timestampStart = _auctionTimestampStart.toUint64();
|
|
332
|
+
_projectConfig.priceDecayHalfLifeSeconds = _priceDecayHalfLifeSeconds
|
|
333
|
+
.toUint64();
|
|
334
|
+
_projectConfig.startPrice = _startPrice;
|
|
335
|
+
_projectConfig.basePrice = _basePrice;
|
|
336
|
+
|
|
337
|
+
emit SetAuctionDetails(
|
|
338
|
+
_projectId,
|
|
339
|
+
_auctionTimestampStart,
|
|
340
|
+
_priceDecayHalfLifeSeconds,
|
|
341
|
+
_startPrice,
|
|
342
|
+
_basePrice
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* @notice Resets auction details for project `_projectId`, zero-ing out all
|
|
348
|
+
* relevant auction fields. Not intended to be used in normal auction
|
|
349
|
+
* operation, but rather only in case of the need to halt an auction.
|
|
350
|
+
* @param _projectId Project ID to set auction details for.
|
|
351
|
+
*/
|
|
352
|
+
function resetAuctionDetails(
|
|
353
|
+
uint256 _projectId
|
|
354
|
+
) external onlyCoreAllowlisted onlyValidProjectId(_projectId) {
|
|
355
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
356
|
+
// reset to initial values
|
|
357
|
+
_projectConfig.timestampStart = 0;
|
|
358
|
+
_projectConfig.priceDecayHalfLifeSeconds = 0;
|
|
359
|
+
_projectConfig.startPrice = 0;
|
|
360
|
+
_projectConfig.basePrice = 0;
|
|
361
|
+
|
|
362
|
+
emit ResetAuctionDetails(_projectId);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* @notice Purchases a token from project `_projectId`.
|
|
367
|
+
* @param _projectId Project ID to mint a token on.
|
|
368
|
+
* @return tokenId Token ID of minted token
|
|
369
|
+
*/
|
|
370
|
+
function purchase(
|
|
371
|
+
uint256 _projectId
|
|
372
|
+
) external payable returns (uint256 tokenId) {
|
|
373
|
+
tokenId = purchaseTo_do6(msg.sender, _projectId);
|
|
374
|
+
return tokenId;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* @notice gas-optimized version of purchase(uint256).
|
|
379
|
+
*/
|
|
380
|
+
function purchase_H4M(
|
|
381
|
+
uint256 _projectId
|
|
382
|
+
) external payable returns (uint256 tokenId) {
|
|
383
|
+
tokenId = purchaseTo_do6(msg.sender, _projectId);
|
|
384
|
+
return tokenId;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* @notice Purchases a token from project `_projectId` and sets
|
|
389
|
+
* the token's owner to `_to`.
|
|
390
|
+
* @param _to Address to be the new token's owner.
|
|
391
|
+
* @param _projectId Project ID to mint a token on.
|
|
392
|
+
* @return tokenId Token ID of minted token
|
|
393
|
+
*/
|
|
394
|
+
function purchaseTo(
|
|
395
|
+
address _to,
|
|
396
|
+
uint256 _projectId
|
|
397
|
+
) external payable returns (uint256 tokenId) {
|
|
398
|
+
return purchaseTo_do6(_to, _projectId);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* @notice gas-optimized version of purchaseTo(address, uint256).
|
|
403
|
+
*/
|
|
404
|
+
function purchaseTo_do6(
|
|
405
|
+
address _to,
|
|
406
|
+
uint256 _projectId
|
|
407
|
+
) public payable nonReentrant returns (uint256 tokenId) {
|
|
408
|
+
// CHECKS
|
|
409
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
410
|
+
|
|
411
|
+
// Note that `maxHasBeenInvoked` is only checked here to reduce gas
|
|
412
|
+
// consumption after a project has been fully minted.
|
|
413
|
+
// `_projectConfig.maxHasBeenInvoked` is locally cached to reduce
|
|
414
|
+
// gas consumption, but if not in sync with the core contract's value,
|
|
415
|
+
// the core contract also enforces its own max invocation check during
|
|
416
|
+
// minting.
|
|
417
|
+
require(
|
|
418
|
+
!_projectConfig.maxHasBeenInvoked,
|
|
419
|
+
"Maximum number of invocations reached"
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
// _getPrice reverts if auction is unconfigured or has not started
|
|
423
|
+
uint256 currentPriceInWei = _getPrice(_projectId);
|
|
424
|
+
require(
|
|
425
|
+
msg.value >= currentPriceInWei,
|
|
426
|
+
"Must send minimum value to mint!"
|
|
427
|
+
);
|
|
428
|
+
|
|
429
|
+
// EFFECTS
|
|
430
|
+
tokenId = genArtCoreContract.mint(_to, _projectId, msg.sender);
|
|
431
|
+
|
|
432
|
+
// okay if this underflows because if statement will always eval false.
|
|
433
|
+
// this is only for gas optimization (core enforces maxInvocations).
|
|
434
|
+
unchecked {
|
|
435
|
+
if (tokenId % ONE_MILLION == _projectConfig.maxInvocations - 1) {
|
|
436
|
+
_projectConfig.maxHasBeenInvoked = true;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// INTERACTIONS
|
|
441
|
+
_splitFundsETHAuction(_projectId, currentPriceInWei);
|
|
442
|
+
return tokenId;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* @dev splits ETH funds between sender (if refund), foundation,
|
|
447
|
+
* artist, and artist's additional payee for a token purchased on
|
|
448
|
+
* project `_projectId`.
|
|
449
|
+
* @dev possible DoS during splits is acknowledged, and mitigated by
|
|
450
|
+
* business practices, including end-to-end testing on mainnet, and
|
|
451
|
+
* admin-accepted artist payment addresses.
|
|
452
|
+
* @param _projectId Project ID for which funds shall be split.
|
|
453
|
+
* @param _currentPriceInWei Current price of token, in Wei.
|
|
454
|
+
*/
|
|
455
|
+
function _splitFundsETHAuction(
|
|
456
|
+
uint256 _projectId,
|
|
457
|
+
uint256 _currentPriceInWei
|
|
458
|
+
) internal {
|
|
459
|
+
if (msg.value > 0) {
|
|
460
|
+
bool success_;
|
|
461
|
+
// send refund to sender
|
|
462
|
+
uint256 refund = msg.value - _currentPriceInWei;
|
|
463
|
+
if (refund > 0) {
|
|
464
|
+
(success_, ) = msg.sender.call{value: refund}("");
|
|
465
|
+
require(success_, "Refund failed");
|
|
466
|
+
}
|
|
467
|
+
// split remaining funds between render provider, platform provider,
|
|
468
|
+
// artist, and artist's additional payee
|
|
469
|
+
uint256 remainingFunds = _currentPriceInWei;
|
|
470
|
+
|
|
471
|
+
// Render provider payment
|
|
472
|
+
uint256 renderProviderAmount = (remainingFunds *
|
|
473
|
+
genArtCoreContract.renderProviderPercentage()) / 100;
|
|
474
|
+
if (renderProviderAmount > 0) {
|
|
475
|
+
(success_, ) = genArtCoreContract.renderProviderAddress().call{
|
|
476
|
+
value: renderProviderAmount
|
|
477
|
+
}("");
|
|
478
|
+
require(success_, "Renderer payment failed");
|
|
479
|
+
remainingFunds -= renderProviderAmount;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// Owner (platform provider) payment
|
|
483
|
+
uint256 ownerFunds = (remainingFunds * ownerPercentage) / 100;
|
|
484
|
+
if (ownerFunds > 0) {
|
|
485
|
+
(success_, ) = ownerAddress.call{value: ownerFunds}("");
|
|
486
|
+
require(success_, "Owner payment failed");
|
|
487
|
+
remainingFunds -= ownerFunds;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// Artist additional payee payment
|
|
491
|
+
uint256 additionalPayeePercentage = genArtCoreContract
|
|
492
|
+
.projectIdToAdditionalPayeePercentage(_projectId);
|
|
493
|
+
if (additionalPayeePercentage > 0) {
|
|
494
|
+
uint256 additionalPayeeAmount = (remainingFunds *
|
|
495
|
+
additionalPayeePercentage) / 100;
|
|
496
|
+
if (additionalPayeeAmount > 0) {
|
|
497
|
+
(success_, ) = genArtCoreContract
|
|
498
|
+
.projectIdToAdditionalPayee(_projectId)
|
|
499
|
+
.call{value: additionalPayeeAmount}("");
|
|
500
|
+
require(success_, "Additional payment failed");
|
|
501
|
+
remainingFunds -= additionalPayeeAmount;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// Artist payment
|
|
506
|
+
if (remainingFunds > 0) {
|
|
507
|
+
(success_, ) = genArtCoreContract
|
|
508
|
+
.projectIdToArtistAddress(_projectId)
|
|
509
|
+
.call{value: remainingFunds}("");
|
|
510
|
+
require(success_, "Artist payment failed");
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* @notice Gets price of minting a token on project `_projectId` given
|
|
517
|
+
* the project's AuctionParameters and current block timestamp.
|
|
518
|
+
* Reverts if auction has not yet started or auction is unconfigured.
|
|
519
|
+
* @param _projectId Project ID to get price of token for.
|
|
520
|
+
* @return current price of token in Wei
|
|
521
|
+
* @dev This method calculates price decay using a linear interpolation
|
|
522
|
+
* of exponential decay based on the artist-provided half-life for price
|
|
523
|
+
* decay, `_priceDecayHalfLifeSeconds`.
|
|
524
|
+
*/
|
|
525
|
+
function _getPrice(uint256 _projectId) private view returns (uint256) {
|
|
526
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
527
|
+
// move parameters to memory if used more than once
|
|
528
|
+
uint256 _timestampStart = uint256(_projectConfig.timestampStart);
|
|
529
|
+
uint256 _priceDecayHalfLifeSeconds = uint256(
|
|
530
|
+
_projectConfig.priceDecayHalfLifeSeconds
|
|
531
|
+
);
|
|
532
|
+
uint256 _basePrice = _projectConfig.basePrice;
|
|
533
|
+
|
|
534
|
+
require(block.timestamp > _timestampStart, "Auction not yet started");
|
|
535
|
+
require(_priceDecayHalfLifeSeconds > 0, "Only configured auctions");
|
|
536
|
+
uint256 decayedPrice = _projectConfig.startPrice;
|
|
537
|
+
uint256 elapsedTimeSeconds;
|
|
538
|
+
// Return early if configured in "fixed price mode" for gas efficiency
|
|
539
|
+
if (decayedPrice /* startPrice */ == _basePrice) {
|
|
540
|
+
return _basePrice;
|
|
541
|
+
}
|
|
542
|
+
unchecked {
|
|
543
|
+
// already checked that block.timestamp > _timestampStart above
|
|
544
|
+
elapsedTimeSeconds = block.timestamp - _timestampStart;
|
|
545
|
+
}
|
|
546
|
+
// Divide by two (via bit-shifting) for the number of entirely completed
|
|
547
|
+
// half-lives that have elapsed since auction start time.
|
|
548
|
+
unchecked {
|
|
549
|
+
// already required _priceDecayHalfLifeSeconds > 0
|
|
550
|
+
decayedPrice >>= elapsedTimeSeconds / _priceDecayHalfLifeSeconds;
|
|
551
|
+
}
|
|
552
|
+
// Perform a linear interpolation between partial half-life points, to
|
|
553
|
+
// approximate the current place on a perfect exponential decay curve.
|
|
554
|
+
unchecked {
|
|
555
|
+
// value of expression is provably always less than decayedPrice,
|
|
556
|
+
// so no underflow is possible when the subtraction assignment
|
|
557
|
+
// operator is used on decayedPrice.
|
|
558
|
+
decayedPrice -=
|
|
559
|
+
(decayedPrice *
|
|
560
|
+
(elapsedTimeSeconds % _priceDecayHalfLifeSeconds)) /
|
|
561
|
+
_priceDecayHalfLifeSeconds /
|
|
562
|
+
2;
|
|
563
|
+
}
|
|
564
|
+
if (decayedPrice < _basePrice) {
|
|
565
|
+
// Price may not decay below stay `basePrice`.
|
|
566
|
+
return _basePrice;
|
|
567
|
+
}
|
|
568
|
+
return decayedPrice;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* @notice Gets if price of token is configured, price of minting a
|
|
573
|
+
* token on project `_projectId`, and currency symbol and address to be
|
|
574
|
+
* used as payment. Supersedes any core contract price information.
|
|
575
|
+
* @param _projectId Project ID to get price information for.
|
|
576
|
+
* @return isConfigured true only if project's auction parameters have been
|
|
577
|
+
* configured on this minter
|
|
578
|
+
* @return tokenPriceInWei current price of token on this minter - invalid
|
|
579
|
+
* if auction has not yet been configured
|
|
580
|
+
* @return currencySymbol currency symbol for purchases of project on this
|
|
581
|
+
* minter. This minter always returns "ETH"
|
|
582
|
+
* @return currencyAddress currency address for purchases of project on
|
|
583
|
+
* this minter. This minter always returns null address, reserved for ether
|
|
584
|
+
*/
|
|
585
|
+
function getPriceInfo(
|
|
586
|
+
uint256 _projectId
|
|
587
|
+
)
|
|
588
|
+
external
|
|
589
|
+
view
|
|
590
|
+
returns (
|
|
591
|
+
bool isConfigured,
|
|
592
|
+
uint256 tokenPriceInWei,
|
|
593
|
+
string memory currencySymbol,
|
|
594
|
+
address currencyAddress
|
|
595
|
+
)
|
|
596
|
+
{
|
|
597
|
+
ProjectConfig storage _projectConfig = projectConfig[_projectId];
|
|
598
|
+
|
|
599
|
+
isConfigured = (_projectConfig.startPrice > 0);
|
|
600
|
+
if (block.timestamp <= _projectConfig.timestampStart) {
|
|
601
|
+
// Provide a reasonable value for `tokenPriceInWei` when it would
|
|
602
|
+
// otherwise revert, using the starting price before auction starts.
|
|
603
|
+
tokenPriceInWei = _projectConfig.startPrice;
|
|
604
|
+
} else if (_projectConfig.startPrice == 0) {
|
|
605
|
+
// In the case of unconfigured auction, return price of zero when
|
|
606
|
+
// it would otherwise revert
|
|
607
|
+
tokenPriceInWei = 0;
|
|
608
|
+
} else {
|
|
609
|
+
tokenPriceInWei = _getPrice(_projectId);
|
|
610
|
+
}
|
|
611
|
+
currencySymbol = "ETH";
|
|
612
|
+
currencyAddress = address(0);
|
|
613
|
+
}
|
|
614
|
+
}
|