Overview
The AuctionDetails class encapsulates auction parameters including:
- Auction start time and duration
- Initial rate bump (starting premium)
- Price curve definition via points
- Gas cost adjustments
These parameters define how the order’s price improves over time, creating a Dutch auction where resolvers compete to fill the order at the best price.
Constructor
Creates a new AuctionDetails instance.
Auction configuration parametersUnix timestamp in seconds when the auction begins
Auction duration in seconds (max: 16,777,215)
Starting price premium as ratio of startTakingAmount to endTakingAmount.
Scale: 10,000,000 = 100%. Example: 50,000 = 0.5%
Array defining the price curveRate bump for auctionEndAmount at this point. Scale: 10,000,000 = 100%
Time in seconds relative to previous point (or auction start for first point)
Gas cost estimation for dynamic adjustmentsRate bump to cover gas costs. Ratio of gasCostInToToken to endTakingAmount.
Scale: 10,000,000 = 100%
Gas price at estimation time. Scale: 1000 = 1 Gwei
Methods
encode()
Serializes auction data to bytes for on-chain use.
const encoded = details.encode()
// => '0x63c051750000b400c350009c40000a009c40000a'
Hex-encoded auction data with 0x prefix
encodeInto()
Serializes auction data into a BytesBuilder.
Optional BytesBuilder instance (creates new if not provided)
const builder = new BytesBuilder()
details.encodeInto(builder)
Builder with encoded auction data
Properties
Auction start timestamp (Unix seconds)
Auction duration in seconds
Gas cost configurationRate bump to cover gas (10,000,000 = 100%)
Estimated gas price (1000 = 1 Gwei)
Static Methods
decode()
Decodes auction details from hex bytes.
Hex-encoded auction data with 0x prefix
import {AuctionDetails} from '@1inch/fusion-sdk'
const details = AuctionDetails.decode('0x63c051750000b400c350009c40000a009c40000a')
Decoded AuctionDetails instance
decodeFrom()
Decodes auction details from a BytesIter.
iter
BytesIter<bigint | string>
required
BytesIter positioned at auction data
const iter = BytesIter.BigInt('0x...')
const details = AuctionDetails.decodeFrom(iter)
Decoded AuctionDetails instance
fromExtension()
Extracts auction details from a limit order extension.
Extension object containing auction data
const details = AuctionDetails.fromExtension(extension)
Extracted AuctionDetails instance
Example
import {AuctionDetails} from '@1inch/fusion-sdk'
const details = new AuctionDetails({
duration: 180n, // 3 minutes
startTime: 1673548149n, // Unix timestamp
/**
* Starting premium: 0.5%
* Defined as ratio of startTakingAmount to endTakingAmount
* 10,000,000 = 100%
*/
initialRateBump: 50000,
/**
* Points defining the price curve:
*
* y(rate) ▲
* │
* 5000 │\\
* │ \\
* │ \\
* 4000 │ \\───────
* │ \\
* │ \\
* 3000 │ \\
* │ \\
* └─────────────────────────►
* 0 10 20 end x(time)
*/
points: [
{
delay: 10, // 10 seconds from auction start
coefficient: 40000 // 0.4% rate bump
},
{
delay: 10, // 10 seconds from previous point
coefficient: 40000 // 0.4% rate bump
}
],
/**
* Adjusts estimated gas costs to actual onchain costs
*/
gasCost: {
/**
* Rate bump to cover gas: 0.1%
* Ratio of gasCostInToToken to endTakingAmount
*/
gasBumpEstimate: 10_000n,
/**
* Gas price estimate: 1 Gwei
*/
gasPriceEstimate: 1000n
}
})
const encoded = details.encode()
// => '0x63c051750000b400c350009c40000a009c40000a'
// Decode back
const decoded = AuctionDetails.decode(encoded)
Price Curve Mechanics
The auction price starts high and decreases over time according to the defined points:
- Initial Rate Bump: Premium at auction start
- Points: Define how quickly price decreases
- Coefficient: Rate adjustment at each point
- Delay: Time between points
Resolvers monitor the price curve and fill when profitable. Earlier fills get worse prices but guaranteed execution; later fills get better prices but risk being frontrun.
Gas Cost Adjustment
The gasCost parameter allows dynamic gas compensation:
- gasBumpEstimate: Expected gas cost as rate bump
- gasPriceEstimate: Gas price when estimate was made
On-chain, actual gas costs are calculated and adjusted proportionally, ensuring resolvers are compensated for current gas prices rather than estimated prices.