AtomicAuctionHouse
Inherits: IAtomicAuctionHouse, AuctionHouse
As its name implies, the AtomicAuctionHouse is where atomic auction lots are created and purchased. The core protocol logic is implemented here.
Functions
constructor
constructor(
address owner_,
address protocol_,
address permit2_
) AuctionHouse(owner_, protocol_, permit2_);
_auction
Implementation-specific logic for auction creation
Inheriting contracts can implement additional logic, such as:
- Validation
- Prefunding
function _auction(
uint96,
RoutingParams calldata routing_,
IAuction.AuctionParams calldata
) internal view override returns (bool performedCallback);
Parameters
Name | Type | Description |
---|---|---|
<none> | uint96 | |
routing_ | RoutingParams | RoutingParams |
<none> | IAuction.AuctionParams |
Returns
Name | Type | Description |
---|---|---|
performedCallback | bool | true if the implementing function calls the onCreate callback |
_cancel
Implementation-specific logic for auction cancellation
Inheriting contracts can implement additional logic, such as:
- Validation
- Refunding
function _cancel(uint96, bytes calldata) internal pure override returns (bool performedCallback);
Parameters
Name | Type | Description |
---|---|---|
<none> | uint96 | |
<none> | bytes |
Returns
Name | Type | Description |
---|---|---|
performedCallback | bool | true if the implementing function calls the onCancel callback |
_purchase
This function handles the following:
- Calculates the fees for the purchase
- Obtains the payout from the auction module
- Transfers the purchase amount (quote token) from the caller
- Transfers the purchase amount (quote token) to the seller
- Transfers the payout and curator fee amounts (base token) from the seller or executes the callback
- Transfers the payout amount (base token) to the recipient
- Transfers the fee amount (base token) to the curator Note that this function will deduct from the payment amount to cover the protocol and referrer fees. The fees at the time of purchase are used.
This function reverts if:
lotId_
is invalid- The respective auction module reverts
payout
is less thanminAmountOut_
- *The caller does not have sufficient balance of the quote token
- The seller does not have sufficient balance of the payout token
- Any of the callbacks fail
- Any of the token transfers fail
- Re-entrancy is detected
function _purchase(
PurchaseParams memory params_,
bytes calldata callbackData_
) internal returns (uint256 payoutAmount);
purchase
Purchase a lot from an atomic auction
function purchase(
PurchaseParams memory params_,
bytes calldata callbackData_
) external override nonReentrant returns (uint256 payoutAmount);
Parameters
Name | Type | Description |
---|---|---|
params_ | PurchaseParams | Purchase parameters |
callbackData_ | bytes | Custom data provided to the onPurchase callback |
Returns
Name | Type | Description |
---|---|---|
payoutAmount | uint256 | payout Amount of baseToken received by recipient_ (in native decimals) |
multiPurchase
Purchase from multiple lots in a single transaction
function multiPurchase(
PurchaseParams[] memory params_,
bytes[] calldata callbackData_
) external override nonReentrant returns (uint256[] memory payoutAmounts);
Parameters
Name | Type | Description |
---|---|---|
params_ | PurchaseParams[] | Array of purchase parameters |
callbackData_ | bytes[] | Array of custom data provided to the onPurchase callbacks |
Returns
Name | Type | Description |
---|---|---|
payoutAmounts | uint256[] | payouts Array of amounts of baseTokens received by recipient_ (in native decimals) |
_curate
Implementation-specific logic for curation
Inheriting contracts can implement additional logic, such as:
- Validation
- Prefunding
function _curate(uint96, uint256, bytes calldata) internal virtual override returns (bool);
Parameters
Name | Type | Description |
---|---|---|
<none> | uint96 | |
<none> | uint256 | |
<none> | bytes |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | performedCallback true if the implementing function calls the onCurate callback |
Events
Purchase
event Purchase(
uint96 indexed lotId, address indexed buyer, address referrer, uint256 amount, uint256 payout
);
Errors
AmountLessThanMinimum
error AmountLessThanMinimum();
InsufficientFunding
error InsufficientFunding();