Skip to main content

BatchAuctionHouse

Git Source

Inherits: IBatchAuctionHouse, AuctionHouse

As its name implies, the BatchAuctionHouse is where batch auctions are created, bid on, and settled. 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

Handles auction creation for a batch auction.

This function performs the following:

  • Performs additional validation
  • Collects the payout token from the seller (prefunding)
  • Calls the onCreate callback, if configured

This function reverts if:

  • The specified auction module is not for batch auctions
  • The capacity is in quote tokens
function _auction(
uint96 lotId_,
RoutingParams calldata routing_,
IAuction.AuctionParams calldata params_
) internal override returns (bool performedCallback);

Parameters

NameTypeDescription
lotId_uint96The auction lot ID
routing_RoutingParamsRoutingParams
params_IAuction.AuctionParamsAuctionParams

Returns

NameTypeDescription
performedCallbackbooltrue if the implementing function calls the onCreate callback

_cancel

Implementation-specific logic for auction cancellation

Handles cancellation of a batch auction lot.

This function performs the following:

  • Refunds the base token to the seller (or callback)
  • Calls the onCancel callback, if configured
function _cancel(
uint96 lotId_,
bytes calldata callbackData_
) internal override returns (bool performedCallback);

Parameters

NameTypeDescription
lotId_uint96The auction lot ID
callbackData_bytesCalldata for the callback

Returns

NameTypeDescription
performedCallbackbooltrue if the implementing function calls the onCancel callback

_curate

Implementation-specific logic for curation

Handles curation approval for a batch auction lot.

This function performs the following:

  • Transfers the required base tokens from the seller (or callback)
  • Calls the onCurate callback, if configured
function _curate(
uint96 lotId_,
uint256 curatorFeePayout_,
bytes calldata callbackData_
) internal override returns (bool performedCallback);

Parameters

NameTypeDescription
lotId_uint96The auction lot ID
curatorFeePayout_uint256The amount to pay the curator
callbackData_bytesCalldata for the callback

Returns

NameTypeDescription
performedCallbackbooltrue if the implementing function calls the onCurate callback

bid

Bid on a lot in a batch auction

This function performs the following:

  • Validates the lot ID
  • Records the bid on the auction module
  • Transfers the quote token from the caller
  • Calls the onBid callback

This function reverts if:

  • params_.lotId is invalid
  • The auction module reverts when creating a bid
  • The quote token transfer fails
  • Re-entrancy is detected
function bid(
BidParams memory params_,
bytes calldata callbackData_
) external override nonReentrant returns (uint64 bidId);

Parameters

NameTypeDescription
params_BidParamsBid parameters
callbackData_bytesCustom data provided to the onBid callback

Returns

NameTypeDescription
bidIduint64Bid ID

refundBid

Refund a bid on a lot in a batch auction

This function performs the following:

  • Validates the lot ID
  • Refunds the bid on the auction module
  • Transfers the quote token to the bidder

This function reverts if:

  • The lot ID is invalid
  • The auction module reverts when cancelling the bid
  • Re-entrancy is detected
function refundBid(uint96 lotId_, uint64 bidId_, uint256 index_) external override nonReentrant;

Parameters

NameTypeDescription
lotId_uint96Lot ID
bidId_uint64Bid ID
index_uint256Index of the bid in the auction's bid list

claimBids

Claim bid payouts and/or refunds after a batch auction has settled

This function performs the following:

  • Validates the lot ID
  • Claims the bids on the auction module
  • Allocates the fees for each successful bid
  • Transfers the payout and/or refund to each bidder

This function reverts if:

  • The lot ID is invalid
  • The auction module reverts when claiming the bids
  • Re-entrancy is detected
function claimBids(uint96 lotId_, uint64[] calldata bidIds_) external override nonReentrant;

Parameters

NameTypeDescription
lotId_uint96Lot ID
bidIds_uint64[]Bid IDs

settle

Settle a batch auction

This function handles the following:

  • Settles the auction on the auction module
  • Sends proceeds and/or refund to the seller
  • Executes the onSettle callback
  • Allocates the curator fee to the curator

This function reverts if:

  • The lot ID is invalid
  • The auction module reverts when settling the auction
  • Re-entrancy is detected
function settle(
uint96 lotId_,
uint256 num_,
bytes calldata callbackData_
)
external
override
nonReentrant
returns (uint256 totalIn, uint256 totalOut, bool finished, bytes memory auctionOutput);

Parameters

NameTypeDescription
lotId_uint96Lot ID
num_uint256Number of bids to settle in this pass (capped at the remaining number if more is provided)
callbackData_bytesCustom data provided to the onSettle callback

Returns

NameTypeDescription
totalInuint256Total amount of quote tokens from bids that were filled
totalOutuint256Total amount of base tokens paid out to winning bids
finishedboolBoolean indicating if the settlement was completed
auctionOutputbytesCustom data returned by the auction module

abort

Abort a batch auction that cannot be settled, refunding the seller and allowing bidders to claim refunds

This function handles the following:

  • Validates the lot id
  • Aborts the auction on the auction module
  • Refunds prefunding (in base tokens) to the seller
  • Calls the onCancel callback

This function reverts if:

  • The lot ID is invalid
  • The auction module reverts when aborting the auction
  • The refund amount is zero

Note that this function will not revert if the onCancel callback reverts.

function abort(uint96 lotId_) external override nonReentrant;

Parameters

NameTypeDescription
lotId_uint96The lot ID to abort

getBatchModuleForId

function getBatchModuleForId(uint96 lotId_) public view returns (BatchAuctionModule);

Events

Bid

event Bid(uint96 indexed lotId, uint96 indexed bidId, address indexed bidder, uint256 amount);

RefundBid

event RefundBid(uint96 indexed lotId, uint96 indexed bidId, address indexed bidder);

ClaimBid

event ClaimBid(uint96 indexed lotId, uint96 indexed bidId, address indexed bidder);

Settle

event Settle(uint96 indexed lotId);

Abort

event Abort(uint96 indexed lotId);

Errors

AmountLessThanMinimum

error AmountLessThanMinimum();

InsufficientFunding

error InsufficientFunding();