Using Callbacks
For a primer on callbacks, read the Concepts - Callbacks page.
This guide will provide an example of how to create an auction that utilises a callbacks contract. The inclusion of a callbacks contract will result in that contract being called during the lifecycle of the auction.
Auction Creation
The only difference in auction creation (see the guide) is the inclusion of an address for the Routing.callbacks
parameter.
Assuming that a callbacks contract is defined at address 0x72dcc35060e17a6a7a5f7fdcf86d2cd9e825679d
, the Routing parameters will be modified to:
// Define the auction routing parameters
IAuctionHouse.RoutingParams memory routingParams = IAuctionHouse.RoutingParams({
auctionType: toKeycode("EMPA"),
baseToken: address(baseToken),
quoteToken: address(quoteToken),
curator: address(0), // Optional
callbacks: ICallback(address(0x72dcc35060e17a6a7a5f7fdcf86d2cd9e825679d)),
callbackData: abi.encode(""), // Optional, provided to `onCreate()` callback
derivativeType: toKeycode(""), // Optional
derivativeParams: abi.encode(""), // Optional
wrapDerivative: false
});