Skip to content

Interface

Interface

See the ERC6909 Interface reference for additional information

Functions

getBid

Get the bid from a bidder for a specific slot and round.

function getBid(uint256 slot) external view returns (uint256[] memory packedBids);

Parameters

Name Type Description
slot uint256 The auction slot.

Returns

Name Type Description
packedBids uint256[] Array of bids (in a packed format). uint256(uint128(bidPrice),uint120(itemsToBuy),uint8(biderId))

newBidder

Add a new bidder to the auction.

function newBidder(address additionalBidder) external onlyOwner returns (uint8 newId);

Parameters

Name Type Description
additionalBidder address The address of the additional bidder.

removeBidder

Remove a bidder from the auction.

function removeBidder(uint8 bidderId) external onlyOwner;

Parameters

Name Type Description
bidderId uint8 The index of the bidder to be removed.

addOperator

Add a new operator to the auction.

function addOperator(address newOperator) external onlyOwner;

Parameters

Name Type Description
newOperator address The address of the new operator

removeOperator

Remove an operator from the auction.

function removeOperator(address oldOperator) external onlyOwner;

Parameters

Name Type Description
oldOperator address Address of operator to be removed.

openAuction

Open a new auction for a specific slot.

function openAuction(uint256 slot, uint120 itemsForSale) external onlyOperator;

Parameters

Name Type Description
slot uint256 The auction slot.
itemsForSale uint120 The number of items available for sale in the auction.

bid

Bid function for bidders to submit manual bids.

function bid(uint256 slot, uint256[] memory packedBids) external;

Parameters

Name Type Description
slot uint256 The auction slot.
packedBids uint256[] Array of packed bids

run

Execute the auction for a specific slot.

function run(uint256 slot) public onlyOperator;

Parameters

Name Type Description
slot uint256 The auction slot.

settle

Settle the auction for a specific slot.

function settle(uint256 slot, address recipient) public onlyOperator;

Parameters

Name Type Description
slot uint256 The auction slot.
recipient address The address of the recipient of the settled funds.

runAndSettle

function runAndSettle(uint256 slot, address recipient) external onlyOperator;

getBidderInfo

Retrieve information about a bidder after auction settlement.

function getBidderInfo(uint256 slot, address bidder) external view returns (uint120 itemsBought, uint128 amountOwed);

Parameters

Name Type Description
slot uint256 The slot identifier of the auction.
bidder address The address of the bidder for whom information is requested.

Returns

Name Type Description
itemsBought uint120 The number of items bought by the bidder in the specified auction.
amountOwed uint128 The amount owed by the bidder for the items bought in the specified auction. Requirements: - The auction must have been settled. - The provided bidder address must be valid and have participated in the auction.

packBid

Packed Bid details into a uint256 for submission.

function packBid(uint256 bidPrice, uint256 itemsToBuy, uint256 bidderId) external pure returns (uint256 packedBid);

Parameters

Name Type Description
bidPrice uint256 Price per item.
itemsToBuy uint256 Items to buy in the auction.
bidderId uint256 Id for bidder

Returns

Name Type Description
packedBid uint256 for auction submission

decodeBid

Decode the packed bid information.

function decodeBid(uint256 packedBid) internal pure returns (uint8 bidderId, uint120 itemsToBuy, uint128 bidPrice);

Parameters

Name Type Description
packedBid uint256 The packed bid information.

Returns

Name Type Description
bidderId uint8 The bidder's ID.
itemsToBuy uint120 The number of items the bidder wants to buy.
bidPrice uint128 The price per item in the bid.

checkAndStoreBid

Check the validity of a bid.

function checkAndStoreBid(
    bool revertInvalid,
    address bidder,
    uint256 slot,
    uint256 itemsForSale,
    uint256[] memory packedBids
) internal;

Parameters

Name Type Description
revertInvalid bool true for manual bids causing reverts for invalid data
bidder address Address of bidder.
slot uint256 The auction slot.
itemsForSale uint256 Total items for sale for the slot.
packedBids uint256[] Array of packed bids Requirements: - The number of items in the bid must not exceed the available items for sale in the auction. - The bidder must have enough funds to cover the bid amount.

Structs

Auction

struct Auction {
    uint120 itemsForSale;
    bool isOpen;
    bool isSettled;
    mapping(address => BidderInfo) biddersInfo;
}

BidderInfo

struct BidderInfo {
    uint120 itemsBought;
    uint128 amountOwed;
}

Events

OperatorAdded

event OperatorAdded(address newOperator);

OperatorRemoved

event OperatorRemoved(address oldOperator);

AuctionSettled

event AuctionSettled(uint256 indexed slot);

BidderAdded

event BidderAdded(address indexed bidder, uint8 bidderId);

BidderRemoved

event BidderRemoved(address indexed bidder, uint8 bidderId);

AuctionOpened

event AuctionOpened(uint256 indexed slot, uint120 itemsForSale);

Errors

InvalidId

error InvalidId();

Unauthorized

error Unauthorized();

InvalidBidItems

error InvalidBidItems();

InsufficientFunds

error InsufficientFunds();

AuctionNotOpen

error AuctionNotOpen(uint256 slot);

AuctionNotClosed

error AuctionNotClosed(uint256 slot);

AuctionAlreadyOpen

error AuctionAlreadyOpen(uint256 slot);

AuctionAlreadySettled

error AuctionAlreadySettled(uint256 slot);

BidderNotRegistered

error BidderNotRegistered(address bidder);

BidderAlreadyExists

error BidderAlreadyExists(address bidder);