ICallback
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
Name | Type | Description |
---|---|---|
lotId | uint96 | The ID of the lot |
seller | address | The address of the seller |
baseToken | address | The address of the base token |
quoteToken | address | The address of the quote token |
capacity | uint256 | The capacity of the auction |
preFund | bool | If true, the calling contract expects base tokens to be sent to it |
callbackData | bytes | Custom 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
Name | Type | Description |
---|---|---|
lotId | uint96 | The ID of the lot |
refund | uint256 | The refund amount |
preFunded | bool | If true, the calling contract will have sent base tokens prior to the call |
callbackData | bytes | Custom 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
Name | Type | Description |
---|---|---|
lotId | uint96 | The ID of the lot |
curatorFee | uint256 | The curator fee payout |
preFund | bool | If true, the calling contract expects base tokens to be sent to it |
callbackData | bytes | Custom 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
Name | Type | Description |
---|---|---|
lotId | uint96 | The ID of the lot |
buyer | address | The address of the buyer |
amount | uint256 | The amount of quote tokens purchased |
payout | uint256 | The amount of base tokens to receive |
preFunded | bool | If true, the calling contract has already been provided the base tokens. Otherwise, they must be provided. |
callbackData | bytes | Custom 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
Name | Type | Description |
---|---|---|
lotId | uint96 | The ID of the lot |
bidId | uint64 | The ID of the bid |
buyer | address | The address of the buyer |
amount | uint256 | The amount of quote tokens bid |
callbackData | bytes | Custom 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
Name | Type | Description |
---|---|---|
lotId | uint96 | The ID of the lot |
proceeds | uint256 | The proceeds amount |
refund | uint256 | The refund amount |
callbackData | bytes | Custom data provided by the seller |