DutchAuction
Inherits: IDutchAuction, Allowlist, MintPass, Ownable, Pausable
Author: fx(hash)
See the documentation in {IDutchAuction}
State Variables
claimedMerkleTreeSlots
Mapping of token address to reserve ID to Bitmap of claimed merkle tree slots
mapping(address => mapping(uint256 => LibBitmap.Bitmap)) internal claimedMerkleTreeSlots;
claimedMintPasses
Mapping of token address to reserve ID to Bitmap of claimed mint passes
mapping(address => mapping(uint256 => LibBitmap.Bitmap)) internal claimedMintPasses;
latestUpdates
Mapping of token address to timestamp of latest update made for token reserves
LibMap.Uint40Map internal latestUpdates;
firstValidReserve
Mapping of token to the last valid reserveId that can mint on behalf of the token
LibMap.Uint40Map internal firstValidReserve;
auctions
Mapping of token address to reserve ID to reserve information
mapping(address => AuctionInfo[]) public auctions;
merkleRoots
Mapping of token address to reserve ID to merkle root
mapping(address => mapping(uint256 => bytes32)) public merkleRoots;
refunds
Mapping of token address to reserve ID to refund amount
mapping(address => mapping(uint256 => RefundInfo)) public refunds;
reserves
Mapping of token address to reserve ID to reserve information (allocation, price, max mint)
mapping(address => ReserveInfo[]) public reserves;
saleProceeds
Mapping of token address to reserve ID to amount of sale proceeds
mapping(address => mapping(uint256 => uint256)) public saleProceeds;
numberMinted
Mapping of token address to reserve ID to number of tokens minted
mapping(address => mapping(uint256 => uint256)) public numberMinted;
Functions
buy
Purchases tokens at a linear price over fixed amount of time
function buy(address _token, uint256 _reserveId, uint256 _amount, address _to) external payable whenNotPaused;
Parameters
| Name | Type | Description | 
|---|---|---|
| _token | address | Address of the token being purchased | 
| _reserveId | uint256 | ID of the reserve | 
| _amount | uint256 | Amount of tokens to purchase | 
| _to | address | Address receiving the purchased tokens | 
buyAllowlist
Purchases tokens through an allowlist at a linear price over fixed amount of time
function buyAllowlist(
    address _token,
    uint256 _reserveId,
    address _to,
    uint256[] calldata _indexes,
    bytes32[][] calldata _proofs
) external payable whenNotPaused;
Parameters
| Name | Type | Description | 
|---|---|---|
| _token | address | Address of the token being purchased | 
| _reserveId | uint256 | ID of the reserve | 
| _to | address | Address receiving the purchased tokens | 
| _indexes | uint256[] | Array of indices containing purchase info inside the BitMap | 
| _proofs | bytes32[][] | Array of merkle proofs used for verifying the purchase | 
buyMintPass
Purchases tokens through a mint pass at a linear price over fixed amount of time
function buyMintPass(
    address _token,
    uint256 _reserveId,
    uint256 _amount,
    address _to,
    uint256 _index,
    bytes calldata _signature
) external payable whenNotPaused;
Parameters
| Name | Type | Description | 
|---|---|---|
| _token | address | Address of the token being purchased | 
| _reserveId | uint256 | ID of the reserve | 
| _amount | uint256 | Number of tokens being purchased | 
| _to | address | Address receiving the purchased tokens | 
| _index | uint256 | Index of puchase info inside the BitMap | 
| _signature | bytes | Array of merkle proofs used for verifying the purchase | 
refund
Refunds an auction buyer with their rebate amount
function refund(address _token, uint256 _reserveId, address _buyer) external whenNotPaused;
Parameters
| Name | Type | Description | 
|---|---|---|
| _token | address | Address of the token contract | 
| _reserveId | uint256 | ID of the mint | 
| _buyer | address | Address of the buyer receiving the refund | 
setMintDetails
Mint Details: struct of auction information, merkle root, and signer address
function setMintDetails(ReserveInfo calldata _reserve, bytes calldata _mintDetails) external whenNotPaused;
withdraw
Withdraws sale processed of primary sales to receiver
function withdraw(address _token, uint256 _reserveId) external whenNotPaused;
Parameters
| Name | Type | Description | 
|---|---|---|
| _token | address | Address of the token contract | 
| _reserveId | uint256 | ID of the reserve | 
pause
Pauses all function executions where modifier is applied
function pause() external onlyOwner;
unpause
Unpauses all function executions where modifier is applied
function unpause() external onlyOwner;
getFirstValidReserve
Returns the earliest valid reserveId that can mint a token
function getFirstValidReserve(address _token) public view returns (uint256);
getLatestUpdate
Gets the latest timestamp update made to token reserves
function getLatestUpdate(address _token) public view returns (uint40);
Parameters
| Name | Type | Description | 
|---|---|---|
| _token | address | Address of the token contract | 
Returns
| Name | Type | Description | 
|---|---|---|
| <none> | uint40 | Timestamp of latest update | 
getPrice
Gets the current auction price
function getPrice(address _token, uint256 _reserveId) public view returns (uint256);
Parameters
| Name | Type | Description | 
|---|---|---|
| _token | address | Address of the token contract | 
| _reserveId | uint256 | ID of the reserve | 
Returns
| Name | Type | Description | 
|---|---|---|
| <none> | uint256 | price Price of the token | 
_buy
Purchases arbitrary amount of tokens at auction price and mints tokens to given account
function _buy(address _token, uint256 _reserveId, uint256 _amount, address _to) internal;
_setLatestUpdate
Sets timestamp of the latest update to token reserves
function _setLatestUpdate(address _token, uint256 _timestamp) internal;
_setFirstValidReserve
function _setFirstValidReserve(address _token, uint256 _reserveId) internal;
_getMerkleRoot
Gets the merkle root of a token reserve
function _getMerkleRoot(address _token, uint256 _reserveId) internal view override returns (bytes32);
_getPrice
Gets the current price of auction reserve
function _getPrice(ReserveInfo memory _reserve, AuctionInfo storage _daInfo) internal view returns (uint256);
_recordLastPrice
function _recordLastPrice(ReserveInfo memory _reserve, address _token, uint256 _reserveId)
    internal
    returns (uint256 lastPrice);
_validateInput
Validates token address, reserve information and given account
function _validateInput(address _token, uint256 _reserveId, address _buyer) internal view;