BaseCallback
Inherits: ICallback
This contract implements standard behaviours for callbacks to the Axis auction system. Developers can extend this contract to implement custom logic for their callbacks.
State Variables
AUCTION_HOUSE
The AuctionHouse that this callback is linked to
address public immutable AUCTION_HOUSE;
lotIdRegistered
Records lot ids against their registration status
mapping(uint96 => bool) public lotIdRegistered;
Functions
constructor
constructor(address auctionHouse_, Callbacks.Permissions memory permissions_);
onlyAuctionHouse
modifier onlyAuctionHouse();
onlyRegisteredLot
modifier onlyRegisteredLot(uint96 lotId_);
onCreate
Callback configuration. Used by AuctionHouse to know which functions are implemented on this contract.
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)
function onCreate(
uint96 lotId_,
address seller_,
address baseToken_,
address quoteToken_,
uint256 capacity_,
bool prefund_,
bytes calldata callbackData_
) external override onlyAuctionHouse returns (bytes4);
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | |
seller_ | address | |
baseToken_ | address | |
quoteToken_ | address | |
capacity_ | uint256 | |
prefund_ | bool | |
callbackData_ | bytes |
_onCreate
function _onCreate(
uint96 lotId_,
address seller_,
address baseToken_,
address quoteToken_,
uint256 capacity_,
bool prefund_,
bytes calldata callbackData_
) internal virtual;
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 override onlyAuctionHouse onlyRegisteredLot(lotId_) returns (bytes4);
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | |
refund_ | uint256 | |
prefunded_ | bool | |
callbackData_ | bytes |
_onCancel
function _onCancel(
uint96 lotId_,
uint256 refund_,
bool prefunded_,
bytes calldata callbackData_
) internal virtual;
onCurate
Called when curate is called for an auction.
function onCurate(
uint96 lotId_,
uint256 curatorFee_,
bool prefund_,
bytes calldata callbackData_
) external override onlyAuctionHouse onlyRegisteredLot(lotId_) returns (bytes4);
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | |
curatorFee_ | uint256 | |
prefund_ | bool | |
callbackData_ | bytes |
_onCurate
function _onCurate(
uint96 lotId_,
uint256 curatorFee_,
bool prefund_,
bytes calldata callbackData_
) internal virtual;
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 override onlyAuctionHouse onlyRegisteredLot(lotId_) returns (bytes4);
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | |
buyer_ | address | |
amount_ | uint256 | |
payout_ | uint256 | |
prefunded_ | bool | |
callbackData_ | bytes |
_onPurchase
function _onPurchase(
uint96 lotId_,
address buyer_,
uint256 amount_,
uint256 payout_,
bool prefunded_,
bytes calldata callbackData_
) internal virtual;
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 override onlyAuctionHouse onlyRegisteredLot(lotId_) returns (bytes4);
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | |
bidId | uint64 | The ID of the bid |
buyer_ | address | |
amount_ | uint256 | |
callbackData_ | bytes |
_onBid
function _onBid(
uint96 lotId_,
uint64 bidId,
address buyer_,
uint256 amount_,
bytes calldata callbackData_
) internal virtual;
onSettle
function onSettle(
uint96 lotId_,
uint256 proceeds_,
uint256 refund_,
bytes calldata callbackData_
) external override onlyAuctionHouse onlyRegisteredLot(lotId_) returns (bytes4);
_onSettle
function _onSettle(
uint96 lotId_,
uint256 proceeds_,
uint256 refund_,
bytes calldata callbackData_
) internal virtual;
Errors
Callback_InvalidParams
error Callback_InvalidParams();
Callback_NotAuthorized
error Callback_NotAuthorized();
Callback_NotImplemented
error Callback_NotImplemented();