Skip to main content

FixedPriceSale

Git Source

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

NameTypeDescription
lotId_uint96The lot ID
lot_LotThe lot data
params_bytesABI-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

NameTypeDescription
lotId_uint96The 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

NameTypeDescription
lotId_uint96The lot ID
amount_uint256The amount of quote tokens to purchase
auctionData_bytesABI-encoded data of type IFixedPriceSale.PurchaseParams

Returns

NameTypeDescription
payoutuint256The amount of payout tokens to receive
<none>bytesauctionOutput 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

NameTypeDescription
lotId_uint96ID of the auction lot
amount_uint256Amount of quoteToken to purchase with (in native decimals)

Returns

NameTypeDescription
<none>uint256payout 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

NameTypeDescription
lotId_uint96ID of the auction lot
payout_uint256Amount of baseToken (in native decimals) to be received by the buyer

Returns

NameTypeDescription
<none>uint256price 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

NameTypeDescription
lotId_uint96ID of the auction lot

Returns

NameTypeDescription
<none>uint256payout 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

NameTypeDescription
lotId_uint96ID of the auction lot

Returns

NameTypeDescription
<none>uint256maxAmount The maximum amount of quoteToken (in native decimals) that can be accepted by the auction