Skip to content

Commit

Permalink
doc(auction-details): add gasCost desc (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbrvk committed May 8, 2024
1 parent 88f30d7 commit d4d097d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
26 changes: 24 additions & 2 deletions src/fusion-order/auction-details/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- duration of an auction
- initial rate bump
- auction price curve
- gas cost

**Examples:**

Expand All @@ -15,7 +16,12 @@ import {AuctionDetails} from '@1inch/fusion-sdk'
const details = new AuctionDetails({
duration: 180n, // in seconds,
startTime: 1673548149n, // unix timestamp (in sec),
initialRateBump: 50000, // difference between max and min amount in percents, 10000000 = 100%
/**
* It defined as a ratio of startTakingAmount to endTakingAmount. 10_000_000 means 100%
*
* @see `AuctionCalculator.calcInitialRateBump`
*/
initialRateBump: 50000,
/**
* Points which define price curve.
* Each point contains `delay` - relative to previous point (auction start for first)
Expand Down Expand Up @@ -44,7 +50,23 @@ const details = new AuctionDetails({
delay: 10, // relative to previous point
coefficient: 40000
}
]
],
/**
* Allows to ajust estimated gas costs to real onchain gas costs
*/
gasCost: {
/**
* Rate bump to cover gas price.
* It defined as a ratio of gasCostInToToken to endTakingAmount. 10_000_000 means 100%
*
* @see `AuctionCalculator.calcGasBumpEstimate`
*/
gasBumpEstimate: 10_000n,
/**
* Gas price at estimation time. 1000 means 1 Gwei
*/
gasPriceEstimate: 1000n
}
})

details.encode()
Expand Down
5 changes: 5 additions & 0 deletions src/fusion-order/auction-details/auction-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export class AuctionDetails {

constructor(auction: {
startTime: bigint
/**
* It defined as a ratio of startTakingAmount to endTakingAmount. 10_000_000 means 100%
*
* @see `AuctionCalculator.calcInitialRateBump`
*/
initialRateBump: number
duration: bigint
points: AuctionPoint[]
Expand Down
5 changes: 4 additions & 1 deletion src/fusion-order/auction-details/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export type AuctionPoint = {

export type AuctionGasCostInfo = {
/**
* Rate bump to cover gas price. 10_000_000 means 100%
* Rate bump to cover gas price.
* It defined as a ratio of gasCostInToToken to endTakingAmount. 10_000_000 means 100%
*
* @see `AuctionCalculator.calcGasBumpEstimate`
*/
gasBumpEstimate: bigint

Expand Down

0 comments on commit d4d097d

Please sign in to comment.