IFixedPrice

Git Source

Inherits: IMinter

Author: fx(hash)

Minter for distributing tokens at fixed prices

Functions

buy

Purchases tokens at a fixed price

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

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract
_reserveIduint256ID of the reserve
_amountuint256Amount of tokens being purchased
_toaddressAddress receiving the purchased tokens

buyAllowlist

Purchases tokens through an allowlist at a fixed price

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 regarding purchase info inside the BitMap
_proofsbytes32[][]Array of merkle proofs used for verifying the purchase

buyMintPass

Purchases tokens through a mint pass at a fixed price

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

getSaleProceed

Gets the proceed amount from a token sale

function getSaleProceed(address _token) external view returns (uint128);

Parameters

NameTypeDescription
_tokenaddressAddress of the token contract

Returns

NameTypeDescription
<none>uint128Amount of proceeds

merkleRoots

Mapping of token address to reserve ID to merkle roots

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

pause

Pauses all function executions where modifier is applied

function pause() external;

prices

Mapping of token address to reserve ID to prices

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

reserves

Mapping of token address to reserve ID to reserve information

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

setMintDetails

Sets the mint details for token reserves

Mint Details: token price, 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 the sale proceeds to the sale receiver

function withdraw(address _token) external;

Parameters

NameTypeDescription
_tokenaddressAddress of the token withdrawing proceeds from

Events

MintDetailsSet

Event emitted when a new fixed price mint has been set

event MintDetailsSet(
    address indexed _token,
    uint256 indexed _reserveId,
    uint256 _price,
    ReserveInfo _reserveInfo,
    bytes32 _merkleRoot,
    address _mintPassSigner,
    bool _openEdition,
    bool _timeUnlimited
);

Parameters

NameTypeDescription
_tokenaddressAddress of the token being minted
_reserveIduint256ID of the reserve
_priceuint256Amount of fixed price mint
_reserveInfoReserveInfoReserve information for the mint
_merkleRootbytes32The merkle root allowlisted buyers
_mintPassSigneraddressThe signing account for mint passes
_openEditionboolStatus of an open edition mint
_timeUnlimitedboolStatus of a mint with unlimited time

Purchase

Event emitted when a purchase is made

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

Parameters

NameTypeDescription
_tokenaddressAddress of the token being purchased
_reserveIduint256ID of the mint
_buyeraddressAddress purchasing the tokens
_amountuint256Amount of tokens being purchased
_toaddressAddress to which the tokens are being transferred
_priceuint256Price of the purchase

Withdrawn

Event emitted when sale proceeds are withdrawn

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

Parameters

NameTypeDescription
_tokenaddressAddress of the token
_creatoraddressAddress of the project creator
_proceedsuint256Amount of proceeds being withdrawn

Errors

AddressZero

Error thrown when receiver is zero address

error AddressZero();

Ended

Error thrown when the sale has already ended

error Ended();

InsufficientFunds

Error thrown when no funds available to withdraw

error InsufficientFunds();

InvalidAllocation

Error thrown when the allocation amount is zero

error InvalidAllocation();

InvalidPayment

Error thrown when payment does not equal price

error InvalidPayment();

InvalidReserve

Error thrown thrown when reserve does not exist

error InvalidReserve();

InvalidTimes

Error thrown when reserve start and end times are invalid

error InvalidTimes();

InvalidToken

Error thrown when token address is invalid

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();

NoSigningAuthority

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

error NoSigningAuthority();

NotStarted

Error thrown when the auction has not started

error NotStarted();

OnlyAuthorityOrAllowlist

Error thrown when setting both an allowlist and mint signer

error OnlyAuthorityOrAllowlist();

TooMany

Error thrown when amount purchased exceeds remaining allocation

error TooMany();