FixedPrice
Inherits: IFixedPrice, Allowlist, MintPass, Ownable, Pausable
Author: fx(hash)
See the documentation in {IFixedPrice}
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;
saleProceeds
Mapping of token address to sale proceeds
LibMap.Uint128Map internal saleProceeds;
merkleRoots
Mapping of token address to reserve ID to merkle roots
mapping(address => mapping(uint256 => bytes32)) public merkleRoots;
prices
Mapping of token address to reserve ID to prices
mapping(address => uint256[]) public prices;
reserves
Mapping of token address to reserve ID to reserve information
mapping(address => ReserveInfo[]) public reserves;
Functions
buy
Purchases tokens at a fixed price
function buy(address _token, uint256 _reserveId, uint256 _amount, address _to) external payable whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
_token | address | Address of the token contract |
_reserveId | uint256 | ID of the reserve |
_amount | uint256 | Amount of tokens being purchased |
_to | address | Address 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 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 regarding 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 fixed price
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 |
setMintDetails
Mint Details: token price, merkle root, and signer address
function setMintDetails(ReserveInfo calldata _reserve, bytes calldata _mintDetails) external whenNotPaused;
withdraw
Withdraws the sale proceeds to the sale receiver
function withdraw(address _token) external whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
_token | address | Address of the token withdrawing proceeds from |
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 |
getSaleProceed
Gets the proceed amount from a token sale
function getSaleProceed(address _token) public view returns (uint128);
Parameters
Name | Type | Description |
---|---|---|
_token | address | Address of the token contract |
Returns
Name | Type | Description |
---|---|---|
<none> | uint128 | Amount of proceeds |
_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
Sets earliest valid reserve
function _setFirstValidReserve(address _token, uint256 _reserveId) internal;
_setSaleProceeds
Sets the proceed amount from the token sale
function _setSaleProceeds(address _token, uint256 _amount) internal;
_getMerkleRoot
Gets the merkle root of a token reserve
function _getMerkleRoot(address _token, uint256 _reserveId) internal view override returns (bytes32);