Skip to main content

AtomicAuctionHouse

Git Source

Inherits: IAtomicAuctionHouse, AuctionHouse

As its name implies, the AtomicAuctionHouse is where atomic auction lots are created and purchased. The core protocol logic is implemented here.

Functions

constructor

constructor(
address owner_,
address protocol_,
address permit2_
) AuctionHouse(owner_, protocol_, permit2_);

_auction

Implementation-specific logic for auction creation

Inheriting contracts can implement additional logic, such as:

  • Validation
  • Prefunding
function _auction(
uint96,
RoutingParams calldata routing_,
IAuction.AuctionParams calldata
) internal view override returns (bool performedCallback);

Parameters

NameTypeDescription
<none>uint96
routing_RoutingParamsRoutingParams
<none>IAuction.AuctionParams

Returns

NameTypeDescription
performedCallbackbooltrue if the implementing function calls the onCreate callback

_cancel

Implementation-specific logic for auction cancellation

Inheriting contracts can implement additional logic, such as:

  • Validation
  • Refunding
function _cancel(uint96, bytes calldata) internal pure override returns (bool performedCallback);

Parameters

NameTypeDescription
<none>uint96
<none>bytes

Returns

NameTypeDescription
performedCallbackbooltrue if the implementing function calls the onCancel callback

_purchase

This function handles the following:

  1. Calculates the fees for the purchase
  2. Obtains the payout from the auction module
  3. Transfers the purchase amount (quote token) from the caller
  4. Transfers the purchase amount (quote token) to the seller
  5. Transfers the payout and curator fee amounts (base token) from the seller or executes the callback
  6. Transfers the payout amount (base token) to the recipient
  7. Transfers the fee amount (base token) to the curator Note that this function will deduct from the payment amount to cover the protocol and referrer fees. The fees at the time of purchase are used.

This function reverts if:

  • lotId_ is invalid
  • The respective auction module reverts
  • payout is less than minAmountOut_
  • *The caller does not have sufficient balance of the quote token
  • The seller does not have sufficient balance of the payout token
  • Any of the callbacks fail
  • Any of the token transfers fail
  • Re-entrancy is detected
function _purchase(
PurchaseParams memory params_,
bytes calldata callbackData_
) internal returns (uint256 payoutAmount);

purchase

Purchase a lot from an atomic auction

function purchase(
PurchaseParams memory params_,
bytes calldata callbackData_
) external override nonReentrant returns (uint256 payoutAmount);

Parameters

NameTypeDescription
params_PurchaseParamsPurchase parameters
callbackData_bytesCustom data provided to the onPurchase callback

Returns

NameTypeDescription
payoutAmountuint256payout Amount of baseToken received by recipient_ (in native decimals)

multiPurchase

Purchase from multiple lots in a single transaction

function multiPurchase(
PurchaseParams[] memory params_,
bytes[] calldata callbackData_
) external override nonReentrant returns (uint256[] memory payoutAmounts);

Parameters

NameTypeDescription
params_PurchaseParams[]Array of purchase parameters
callbackData_bytes[]Array of custom data provided to the onPurchase callbacks

Returns

NameTypeDescription
payoutAmountsuint256[]payouts Array of amounts of baseTokens received by recipient_ (in native decimals)

_curate

Implementation-specific logic for curation

Inheriting contracts can implement additional logic, such as:

  • Validation
  • Prefunding
function _curate(uint96, uint256, bytes calldata) internal virtual override returns (bool);

Parameters

NameTypeDescription
<none>uint96
<none>uint256
<none>bytes

Returns

NameTypeDescription
<none>boolperformedCallback true if the implementing function calls the onCurate callback

Events

Purchase

event Purchase(
uint96 indexed lotId, address indexed buyer, address referrer, uint256 amount, uint256 payout
);

Errors

AmountLessThanMinimum

error AmountLessThanMinimum();

InsufficientFunding

error InsufficientFunding();