Overview
TheAuctionCalculator class is used to calculate taker amounts and auction rates during the lifecycle of a Fusion order. It helps determine how the exchange rate changes over time during the Dutch auction process.
Constructor
Auction start time as Unix timestamp in seconds
Auction duration in seconds
Initial rate bump from the end price (where 10,000,000 = 100%)
Array of auction points defining the rate curve
Optional gas cost information for dynamic rate adjustments
Static Methods
fromAuctionData
Create anAuctionCalculator instance from AuctionDetails.
Auction details containing start time, duration, rate bump, and points
AuctionCalculator
Returns a new AuctionCalculator instance
calcInitialRateBump
Calculate the initial rate bump given start and end amounts.Starting amount for the auction
Ending amount for the auction
number
The initial rate bump value
calcAuctionTakingAmount
Calculate the taking amount for a given rate (static version).Base taking amount
Current rate bump
bigint
The adjusted taking amount based on the rate
calcAuctionMakingAmount
Calculate the making amount for a given rate.Base making amount
Current rate bump
bigint
The adjusted making amount based on the rate
baseFeeToGasPriceEstimate
Encode base fee as gas price estimate forAuctionGasCostInfo.
Base fee in Wei
bigint
Gas price estimate (1000 = 1 Gwei)
calcGasBumpEstimate
CalculategasBumpEstimate for AuctionGasCostInfo.
Minimum return in destination token
Gas cost in destination token
bigint
The gas bump estimate value
Instance Methods
calcRateBump
Calculate the rate bump at a specific time during the auction.Auction timestamp in seconds
Block base fee in Wei. If provided, rate will be calculated as if order executed in block with this base fee
number
The rate bump at the specified time
calcAuctionTakingAmount
Calculate the taking amount for the current auction state.Base taking amount
Current rate bump from calcRateBump
bigint
The adjusted taking amount
Properties
Get the auction finish time (startTime + duration)
Static constant: 10,000,000 (represents 100%)
Example
Related Types
AuctionPoint
Point in time of this point relative to the previous point (in seconds)
Coefficient rate bump from the end of an auction
AuctionGasCostInfo
Rate bump to cover gas price. Defined as a ratio of gasCostInToToken to endTakingAmount. 10,000,000 means 100%
Gas price at estimation time. 1000 means 1 Gwei