Skip to main content

ICallback

Git Source

Interface for callback contracts use in the Axis system

Functions

onCreate

Callback configuration. Used by AuctionHouse to know which functions are implemented on this contract.

Called when an auction is created. Reverts if validation fails.

8-bit map of which callbacks are implemented on this contract. The last two bits designate whether the callback should be expected send base tokens and receive quote tokens.

If the contract does not send/receive, then the AuctionHouse will expect the tokens to be sent/received directly by the seller wallet.

  • Bit 1: onCreate
  • Bit 2: onCancel
  • Bit 3: onCurate
  • Bit 4: onPurchase
  • Bit 5: onBid
  • Bit 6: onSettle
  • Bit 7: Receives quote tokens
  • Bit 8: Sends base tokens (and receives them if refunded)

The implementing function should:

  • Register the lot ID on the Callback contract
  • Validate that the seller is allowed to use the Callback contract
function onCreate(
uint96 lotId,
address seller,
address baseToken,
address quoteToken,
uint256 capacity,
bool preFund,
bytes calldata callbackData
) external returns (bytes4);

Parameters

NameTypeDescription
lotIduint96The ID of the lot
selleraddressThe address of the seller
baseTokenaddressThe address of the base token
quoteTokenaddressThe address of the quote token
capacityuint256The capacity of the auction
preFundboolIf true, the calling contract expects base tokens to be sent to it
callbackDatabytesCustom data provided by the seller

onCancel

Called when an auction is cancelled.

If the Callback is configured to receive tokens and the auction was prefunded, then the refund will be sent prior to the call.

function onCancel(
uint96 lotId,
uint256 refund,
bool preFunded,
bytes calldata callbackData
) external returns (bytes4);

Parameters

NameTypeDescription
lotIduint96The ID of the lot
refunduint256The refund amount
preFundedboolIf true, the calling contract will have sent base tokens prior to the call
callbackDatabytesCustom data provided by the seller

onCurate

Called when curate is called for an auction.

function onCurate(
uint96 lotId,
uint256 curatorFee,
bool preFund,
bytes calldata callbackData
) external returns (bytes4);

Parameters

NameTypeDescription
lotIduint96The ID of the lot
curatorFeeuint256The curator fee payout
preFundboolIf true, the calling contract expects base tokens to be sent to it
callbackDatabytesCustom data provided by the seller

onPurchase

Called when a buyer purchases from an atomic auction. Reverts if validation fails.

If the Callback is configured to receive quote tokens, then the user purchase amount of quote tokens will be sent prior to this call.

If the Callback is configured to send base tokens, then the AuctionHouse will expect the payout of base tokens to be sent back.

function onPurchase(
uint96 lotId,
address buyer,
uint256 amount,
uint256 payout,
bool preFunded,
bytes calldata callbackData
) external returns (bytes4);

Parameters

NameTypeDescription
lotIduint96The ID of the lot
buyeraddressThe address of the buyer
amountuint256The amount of quote tokens purchased
payoutuint256The amount of base tokens to receive
preFundedboolIf true, the calling contract has already been provided the base tokens. Otherwise, they must be provided.
callbackDatabytesCustom data provided by the buyer

onBid

Called when a buyer bids on a batch auction. Reverts if validation fails.

function onBid(
uint96 lotId,
uint64 bidId,
address buyer,
uint256 amount,
bytes calldata callbackData
) external returns (bytes4);

Parameters

NameTypeDescription
lotIduint96The ID of the lot
bidIduint64The ID of the bid
buyeraddressThe address of the buyer
amountuint256The amount of quote tokens bid
callbackDatabytesCustom data provided by the buyer

onSettle

Called when a batch auction is settled.

If the Callback is configured to receive tokens, then the proceeds and/or refund will be sent prior to the call.

function onSettle(
uint96 lotId,
uint256 proceeds,
uint256 refund,
bytes calldata callbackData
) external returns (bytes4);

Parameters

NameTypeDescription
lotIduint96The ID of the lot
proceedsuint256The proceeds amount
refunduint256The refund amount
callbackDatabytesCustom data provided by the seller