Skip to main content

IBatchAuction

Git Source

Inherits: IAuction

Interface for batch auctions

The implementing contract should define the following additional areas:

  • Any un-implemented functions
  • State variables for storage and configuration

Functions

dedicatedSettlePeriod

Time period after auction conclusion where bidders cannot refund bids

function dedicatedSettlePeriod() external view returns (uint48);

lotAuctionOutput

Custom auction output for each lot

Stored during settlement

function lotAuctionOutput(uint96 lotId) external view returns (bytes memory);

Parameters

NameTypeDescription
lotIduint96The lot ID

bid

Bid on an auction lot

The implementing function should handle the following:

  • Validate the bid parameters
  • Store the bid data
function bid(
uint96 lotId_,
address bidder_,
address referrer_,
uint256 amount_,
bytes calldata auctionData_
) external returns (uint64 bidId);

Parameters

NameTypeDescription
lotId_uint96The lot id
bidder_addressThe bidder of the purchased tokens
referrer_addressThe referrer of the bid
amount_uint256The amount of quote tokens to bid
auctionData_bytesThe auction-specific data

Returns

NameTypeDescription
bidIduint64The bid id

refundBid

Refund a bid

The implementing function should handle the following:

  • Validate the bid parameters
  • Authorize caller_
  • Update the bid data
function refundBid(
uint96 lotId_,
uint64 bidId_,
uint256 index_,
address caller_
) external returns (uint256 refund);

Parameters

NameTypeDescription
lotId_uint96The lot id
bidId_uint64The bid id
index_uint256The index of the bid ID in the auction's bid list
caller_addressThe caller

Returns

NameTypeDescription
refunduint256The amount of quote tokens to refund

claimBids

Claim multiple bids

The implementing function should handle the following:

  • Validate the bid parameters
  • Update the bid data
function claimBids(
uint96 lotId_,
uint64[] calldata bidIds_
) external returns (BidClaim[] memory bidClaims, bytes memory auctionOutput);

Parameters

NameTypeDescription
lotId_uint96The lot id
bidIds_uint64[]The bid ids

Returns

NameTypeDescription
bidClaimsBidClaim[]The bid claim data
auctionOutputbytesThe auction-specific output

settle

Settle a batch auction lot with on-chain storage and settlement

The implementing function should handle the following:

  • Validate the lot parameters
  • Determine the winning bids
  • Update the lot data
function settle(
uint96 lotId_,
uint256 num_
)
external
returns (
uint256 totalIn,
uint256 totalOut,
uint256 capacity,
bool finished,
bytes memory auctionOutput
);

Parameters

NameTypeDescription
lotId_uint96The lot id
num_uint256The number of winning bids to settle (capped at the remaining number if more is provided)

Returns

NameTypeDescription
totalInuint256Total amount of quote tokens from bids that were filled
totalOutuint256Total amount of base tokens paid out to winning bids
capacityuint256The original capacity of the lot
finishedboolWhether the settlement is finished
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

The implementing function should handle the following:

  • Validate the lot is in the correct state
  • Set the auction in a state that allows bidders to claim refunds
function abort(uint96 lotId_) external;

Parameters

NameTypeDescription
lotId_uint96The lot id

getNumBids

Get the number of bids for a lot

function getNumBids(uint96 lotId_) external view returns (uint256 numBids);

Parameters

NameTypeDescription
lotId_uint96The lot ID

Returns

NameTypeDescription
numBidsuint256The number of bids

getBidIds

Get the bid IDs from the given index

function getBidIds(
uint96 lotId_,
uint256 start_,
uint256 count_
) external view returns (uint64[] memory bidIds);

Parameters

NameTypeDescription
lotId_uint96The lot ID
start_uint256The index to start retrieving bid IDs from
count_uint256The number of bids to retrieve

Returns

NameTypeDescription
bidIdsuint64[]The bid IDs

getBidIdAtIndex

Get the bid ID at the given index

function getBidIdAtIndex(uint96 lotId_, uint256 index_) external view returns (uint64 bidId);

Parameters

NameTypeDescription
lotId_uint96The lot ID
index_uint256The index

Returns

NameTypeDescription
bidIduint64The bid ID

getBidClaim

Get the claim data for a bid

This provides information on the outcome of a bid, independent of the claim status

function getBidClaim(
uint96 lotId_,
uint64 bidId_
) external view returns (BidClaim memory bidClaim);

Parameters

NameTypeDescription
lotId_uint96The lot ID
bidId_uint64The bid ID

Returns

NameTypeDescription
bidClaimBidClaimThe bid claim data

Errors

Auction_DedicatedSettlePeriod

error Auction_DedicatedSettlePeriod(uint96 lotId);

Auction_InvalidBidId

error Auction_InvalidBidId(uint96 lotId, uint96 bidId);

Auction_NotBidder

error Auction_NotBidder();

Structs

BidClaim

Contains data about a bidder's outcome from an auction

Only used in memory so doesn't need to be packed

struct BidClaim {
address bidder;
address referrer;
uint256 paid;
uint256 payout;
uint256 refund;
}

Properties

NameTypeDescription
bidderaddressThe bidder
referreraddressThe referrer
paiduint256The amount of quote tokens paid (including any refunded tokens)
payoutuint256The amount of base tokens paid out
refunduint256The amount of quote tokens refunded