Skip to main content

Abort Auction

This guide will provide steps for aborting a batch auction through direct integration with the contracts.

As described in the guide on settlement, after a batch auction concludes, there is a dedicated settlement period in which the auction seller is exclusively able to settle the auction lot. Subsequent to this, anyone may abort the auction. This is necessary in order to prevent the seller from reviewing the bids and preventing settlement, which would lock bidders' funds. Aborting the auction causes all deposits (quote tokens) to be available for claiming.

Setup

First, define the BatchAuctionHouse that will be used. This should correspond to the same BatchAuctionHouse in which the auction lot was created.

// Define the deployed BatchAuctionHouse
IBatchAuctionHouse auctionHouse = IBatchAuctionHouse(_batchAuctionHouse);

Inputs

We obtain from the LOT_ID environment variable the lot ID that identifies each auction lot. The lot ID is a uint96 number, so should be checked before being downcast.

// Obtain the lot from the environment variable
uint256 lotIdRaw = vm.envUint("LOT_ID");
if (lotIdRaw > type(uint96).max) {
revert("LOT_ID must be less than uint96 max");
}
uint96 lotId = uint96(lotIdRaw);

The lot ID is returned from the auction creation function. See the Create Auction Guide for more details.

Contract Call

Lastly, the contract call is made:

// Perform the abort
// The abort call can be performed by anyone
auctionHouse.abort(lotId);
console2.log("Abort completed. Lot ID:", lotId);

It is worthwhile noting that the abort call may fail for the following reasons:

  • The lot ID is invalid
  • The lot is in a state that does not support aborting (such as already being settled)

Source Code

The source code for the guide is located in the abort.s.sol file.