Skip to main content

AtomicAuctionModule

Git Source

Inherits: IAtomicAuction, AuctionModule

A base contract for atomic auctions

Functions

auctionType

Get the auction type

function auctionType() external pure override returns (AuctionType);

purchase

Purchase tokens from an auction lot

Implements a basic purchase function that:

  • Validates the lot and purchase parameters
  • Calls the implementation-specific function
  • Updates the lot data

This function reverts if:

  • The lot id is invalid
  • The lot is inactive
  • The caller is not an internal module
  • The payout is greater than the remaining capacity

Inheriting contracts should override _purchase to implement auction-specific logic, such as:

  • Validating the auction-specific parameters
  • Storing the purchase data
function purchase(
uint96 lotId_,
uint256 amount_,
bytes calldata auctionData_
) external virtual override onlyInternal returns (uint256 payout, bytes memory auctionOutput);

Parameters

NameTypeDescription
lotId_uint96The lot id
amount_uint256The amount of quote tokens to purchase
auctionData_bytesThe auction-specific data

Returns

NameTypeDescription
payoutuint256The amount of payout tokens to receive
auctionOutputbytesThe auction-specific output

_purchase

Implementation-specific purchase logic

Auction modules should override this to perform any additional logic

function _purchase(
uint96 lotId_,
uint256 amount_,
bytes calldata auctionData_
) internal virtual returns (uint256 payout, bytes memory auctionOutput);

Parameters

NameTypeDescription
lotId_uint96The lot ID
amount_uint256The amount of quote tokens to purchase
auctionData_bytesThe auction-specific data

Returns

NameTypeDescription
payoutuint256The amount of payout tokens to receive
auctionOutputbytesThe auction-specific output