Functions
is_auction_complete
Check if an order’s auction period has ended.
order- The order to checkslot- Current blockchain slot
true if the auction is complete, false otherwise
Notes:
- Orders with
auction_duration == 0are immediately complete - Auction ends when
current_slot >= order.slot + order.auction_duration
get_auction_price
Calculate the current auction price for an order.
order- The order being evaluatedslot- Current blockchain slotprice- Current oracle price (only used for oracle orders)
Fixed Auction Mechanism
For Market, Limit, TriggerMarket, and TriggerLimit orders, the auction uses a fixed price range.Price Calculation
The auction price moves linearly fromauction_start_price to auction_end_price over the auction duration.
For Long Orders:
Example
Oracle Offset Auction Mechanism
For Oracle orders, the auction price is calculated as an offset from the current oracle price.Price Calculation
The offset moves fromauction_start_price to auction_end_price, then added to the oracle price.
Formula:
Example
Auction Mechanics Overview
Why Auctions?
Auctions serve several purposes:- MEV Protection: Prevents front-running by giving the user time to cancel if price moves unfavorably
- Better Execution: Allows market makers to compete for fills, potentially improving user price
- Fair Access: Gives all market participants equal opportunity to fill orders
- Decentralization: Reduces reliance on specific keepers or market makers
Auction Parameters
Orders specify their auction behavior via:auction_duration- How many slots the auction lasts (0-255)auction_start_price- Starting price (aggressive fill)auction_end_price- Ending price (market price)