IDutchAuction

Git Source

Inherits: IMinter

Author: fx(hash)

Minter for distributing tokens at linear prices over fixed periods of time

Functions

auctions

Mapping of token address to reserve ID to reserve information

function auctions(address, uint256) external view returns (bool, uint248);

buy

Purchases tokens at a linear price over fixed amount of time

function buy(address _token, uint256 _reserveId, uint256 _amount, address _to) external payable;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_amountuint256Amount of tokens to purchase
_toaddressAddress 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;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_toaddressAddress receiving the purchased tokens
_indexesuint256[]Array of indices containing purchase info inside the BitMap
_proofsbytes32[][]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;

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_amountuint256Number of tokens being purchased
_toaddressAddress receiving the purchased tokens
_indexuint256Index of puchase info inside the BitMap
_signaturebytesArray of merkle proofs used for verifying the purchase

getFirstValidReserve

Returns the earliest valid reserveId that can mint a token

function getFirstValidReserve(address _token) external view returns (uint256);

getLatestUpdate

Gets the latest timestamp update made to token reserves

function getLatestUpdate(address _token) external view returns (uint40);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract

Returns

NameTypeDescription
<none>uint40Timestamp of latest update

getPrice

Gets the current auction price

function getPrice(address _token, uint256 _reserveId) external view returns (uint256);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve

Returns

NameTypeDescription
<none>uint256price Price of the token

merkleRoots

Mapping of token address to reserve ID to merkle root

function merkleRoots(address, uint256) external view returns (bytes32);

numberMinted

Mapping of token address to reserve ID to number of tokens minted

function numberMinted(address _token, uint256 _reserveId) external view returns (uint256);

pause

Pauses all function executions where modifier is applied

function pause() external;

refund

Refunds an auction buyer with their rebate amount

function refund(address _token, uint256 _reserveId, address _buyer) external;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the mint
_buyeraddressAddress of the buyer receiving the refund

refunds

Mapping of token address to reserve ID to refund amount

function refunds(address, uint256) external view returns (uint256);

reserves

Mapping of token address to reserve ID to reserve information (allocation, price, max mint)

function reserves(address _token, uint256 _reserveId) external view returns (uint64, uint64, uint128);

saleProceeds

Mapping of token address to reserve ID to amount of sale proceeds

function saleProceeds(address _token, uint256 _reserveId) external view returns (uint256);

setMintDetails

Sets the mint details for token reserves

Mint Details: struct of auction information, merkle root, and signer address

function setMintDetails(ReserveInfo calldata _reserveInfo, bytes calldata _mintDetails) external;

Parameters

NameTypeDescription
_reserveInfoReserveInfoReserve information for the token
_mintDetailsbytesDetails of the mint pertaining to the minter

unpause

Unpauses all function executions where modifier is applied

function unpause() external;

withdraw

Withdraws sale processed of primary sales to receiver

function withdraw(address _token, uint256 _reserveId) external;

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve

Events

MintDetailsSet

Event emitted when the mint details for a Dutch auction are set

event MintDetailsSet(
    address indexed _token,
    uint256 indexed _reserveId,
    ReserveInfo _reserveInfo,
    bytes32 _merkleRoot,
    address _mintPassSigner,
    AuctionInfo _auctionInfo
);

Parameters

NameTypeDescription
_tokenaddressAddress of the token being minted
_reserveIduint256ID of the reserve
_reserveInfoReserveInfoThe reserve info of the Dutch auction
_merkleRootbytes32The merkle root allowlisted buyers
_mintPassSigneraddressThe signing account for mint passes
_auctionInfoAuctionInfoDutch auction information

Purchase

Event emitted when a purchase is made during the auction

event Purchase(
    address indexed _token,
    uint256 indexed _reserveId,
    address indexed _buyer,
    address _to,
    uint256 _amount,
    uint256 _price
);

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the reserve
_buyeraddressAddress of the buyer
_toaddressAddress where the purchased tokens will be sent
_amountuint256Amount of tokens purchased
_priceuint256Price at which the tokens were purchased

RefundClaimed

Event emitted when a refund is claimed by a buyer

event RefundClaimed(address indexed _token, uint256 indexed _reserveId, address indexed _buyer, uint256 _refundAmount);

Parameters

NameTypeDescription
_tokenaddressAddress of the token for which the refund is claimed
_reserveIduint256ID of the reserve
_buyeraddressAddress of the buyer claiming the refund
_refundAmountuint256Amount of refund claimed

Withdrawn

Event emitted when the sale proceeds are withdrawn

event Withdrawn(address indexed _token, uint256 indexed _reserveId, address indexed _creator, uint256 _proceeds);

Parameters

NameTypeDescription
_tokenaddressAddress of the token
_reserveIduint256ID of the reserve
_creatoraddressAddress of the creator of the project
_proceedsuint256Amount of sale proceeds withdrawn

Errors

AddressZero

Error thrown when receiver is zero address

error AddressZero();

InsufficientFunds

Error thrown when no funds available to withdraw

error InsufficientFunds();

InsufficientPrice

Error thrown when the price is insufficient

error InsufficientPrice();

InvalidAllocation

Error thrown when the allocation amount is zero

error InvalidAllocation();

InvalidAmount

Error thrown when the purchase amount is zero

error InvalidAmount();

InvalidPayment

Error thrown when payment does not equal price

error InvalidPayment();

InvalidPrice

Error thrown when the price is zero

error InvalidPrice();

InvalidPriceCurve

Error thrown when the passing a price curve with less than 2 points

error InvalidPriceCurve();

InvalidReserve

Error thrown when a reserve does not exist

error InvalidReserve();

InvalidStep

Error thrown when the step length is not equally divisible by the auction duration

error InvalidStep();

InvalidToken

Error thrown when the token is address zero

error InvalidToken();

NoAllowlist

Error thrown when buying through allowlist and no allowlist exists

error NoAllowlist();

NoPublicMint

Error thrown when calling buy when either an allowlist or signer exists

error NoPublicMint();

NoRefund

Error thrown when there is no refund available

error NoRefund();

NoSigningAuthority

Error thrown when buy with a mint pass and no signing authority exists

error NoSigningAuthority();

NotEnded

Error thrown if auction has not ended

error NotEnded();

NonRefundableDA

Error thrown if auction is not a refundable dutch auction

error NonRefundableDA();

NotStarted

Error thrown when the auction has not started

error NotStarted();

OnlyAuthorityOrAllowlist

Error thrown when setting both an allowlist and mint signer

error OnlyAuthorityOrAllowlist();

PricesOutOfOrder

Error thrown when the prices are out of order

error PricesOutOfOrder();