Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.75 KB

File metadata and controls

58 lines (40 loc) · 1.75 KB

Protocol specification

Auction creation

The seller supplies:

  • sell and buy token;
  • payment recipient;
  • exact sell inventory;
  • start and end normalized prices;
  • start and end timestamps;
  • optional oracle, maximum deviation, and maximum oracle age.

Creation rejects identical token pairs, zero amounts, increasing price curves, schedules longer than 30 days, tokens with more than 18 decimals, and inconsistent oracle settings. The exact sell amount must arrive in escrow.

Price curve

Before or at the start timestamp, the current price is startPriceX18. During the auction:

price =
  startPrice
  - (startPrice - endPrice) × elapsed / duration

At or after the end timestamp the view price equals endPriceX18, but fills are no longer accepted.

Fills

A fill:

  1. verifies the auction is active and in its execution window;
  2. verifies sufficient remaining inventory;
  3. checks the optional oracle floor;
  4. calculates the rounded-up buy amount and snapshotted protocol fee;
  5. checks totalDue <= maxTotalBuyAmount;
  6. updates auction and aggregate escrow accounting;
  7. pulls the exact total due from the solver;
  8. pays the recipient and fee recipient;
  9. transfers sell inventory to the solver.

The auction closes automatically when remainingSell == 0.

Oracle floor

For an oracle price P and deviation d in basis points:

oracleFloor = P × (10_000 - d) / 10_000

The fill reverts when the current auction price is below that floor or the oracle report is zero, from the future, or stale.

Cancellation and closure

  • The seller may cancel only while no inventory has been sold.
  • Anyone may close an active auction at or after its end time.
  • Both paths return remaining inventory to the seller and update returnedAmount.