FixedPriceSale
Inherits: AtomicAuctionModule, IFixedPriceSale
A module for creating fixed price sale (atomic) auctions
State Variables
auctionData
Returns the AuctionData
for a lot
mapping(uint96 lotId => AuctionData) public auctionData;
Functions
constructor
constructor(address auctionHouse_) AuctionModule(auctionHouse_);
VEECODE
7 byte, versioned identifier for the module. 2 characters from 0-9 that signify the version and 3-5 characters from A-Z.
function VEECODE() public pure override returns (Veecode);
_auction
Implementation-specific auction creation logic
This function assumes:
- The lot ID has been validated
- The start and duration of the lot have been validated
This function reverts if:
- The parameters cannot be decoded into the correct format
- The price is zero
- The max payout percent is greater than 100% or less than 1%
function _auction(uint96 lotId_, Lot memory lot_, bytes memory params_) internal override;
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | The lot ID |
lot_ | Lot | The lot data |
params_ | bytes | ABI-encoded data of type IFixedPriceSale.AuctionDataParams |
_cancelAuction
Implementation-specific auction cancellation logic
This function assumes the following:
- The lot ID has been validated
- The caller has been authorized
- The auction has not concluded
function _cancelAuction(uint96 lotId_) internal pure override;
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | The lot ID |
_purchase
Implementation-specific purchase logic
This function assumes the following:
- The lot ID has been validated
- The caller has been authorized
- The auction is active
This function reverts if:
- The payout is less than the minAmountOut specified by the purchaser
- The payout is greater than the max payout
function _purchase(
uint96 lotId_,
uint256 amount_,
bytes calldata auctionData_
) internal view override returns (uint256 payout, bytes memory);
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | The lot ID |
amount_ | uint256 | The amount of quote tokens to purchase |
auctionData_ | bytes | ABI-encoded data of type IFixedPriceSale.PurchaseParams |
Returns
Name | Type | Description |
---|---|---|
payout | uint256 | The amount of payout tokens to receive |
<none> | bytes | auctionOutput The auction-specific output |
payoutFor
Returns the payout for a given lot and amount
function payoutFor(uint96 lotId_, uint256 amount_) public view override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | ID of the auction lot |
amount_ | uint256 | Amount of quoteToken to purchase with (in native decimals) |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | payout Amount of baseToken (in native decimals) to be received by the buyer |
priceFor
Returns the price for a given lot and payout
function priceFor(uint96 lotId_, uint256 payout_) public view override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | ID of the auction lot |
payout_ | uint256 | Amount of baseToken (in native decimals) to be received by the buyer |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | price The purchase price in terms of the quote token |
maxPayout
Returns the max payout for a given lot
function maxPayout(uint96 lotId_) public view override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | ID of the auction lot |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | payout The maximum amount of baseToken (in native decimals) that can be received by the buyer |
maxAmountAccepted
Returns the max amount accepted for a given lot
function maxAmountAccepted(uint96 lotId_) public view override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | ID of the auction lot |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | maxAmount The maximum amount of quoteToken (in native decimals) that can be accepted by the auction |