Skip to main content
The only real choice a maker makes is whether their price is allowed to move.

Fixed

Stores a ratio. Band-checked once, at creation, then never consults the oracle again. Predictable, and it keeps trading through a feed outage.

Pegged

Stores no price. Every fill is priced off Orakl’s five-minute reference and discounted so the taker’s realised edge lands exactly on the premium. Tracks the market instead of going stale.

Fixed — createOrder

1

Pair and size

buyToken must be the counter-token. sellAmount ≥ minOrderAmount[sellToken].
2

Expiry

expiry > block.timestamp and expiry ≤ now + maxOrderDuration.
3

Oracle read — strict

Reverts on a missing, non-positive or stale five-minute average. During a feed outage no new orders can be posted, of either kind.
4

Price band

Checked once. The band never applies again, so an order filled much later can sit far from the market — that is deliberate, not an oversight.
5

Escrow and record

safeTransferFrom(maker → this, sellAmount), the fee rate is snapshotted, an id is assigned and the order is added to both index sets.
buyAmount is the total the maker receives on a complete fill. Every partial fill uses that same ratio.

Pegged — createPeggedOrder

1

Premium

premiumBps ≤ maxPremiumBps ≤ MAX_PREMIUM_BPS (1000). A later configuration change does not alter orders already on the book.
2

A floor is mandatory

minRate == 0 is refused outright, so “no protection” can never be the quiet default that happens when a field is left alone.
3

The floor must be fillable at creation

minRate ≤ peggedRateNow(...), else FloorAboveMarket — otherwise a maker could post an order that passes creation and can never fill.
4

Escrow and record

As Fixed. buyAmount is stored as 0, because there is no price to store.

What the floor bounds, and why it matters

It bounds the money that changes hands, not the oracle answer. That is deliberate: if a newly selected feed uses different decimals, priceScale changes with it. Checking the settled amount keeps the maker’s floor expressed against the actual transfer value.
Below its floor a pegged order pauses itself and resumes on its own when the price recovers. Escrow is untouched, and protocol pause/oracle state never disables cancellation. A refund can still fail if the sell-token contract itself rejects the transfer; see the security model.

The Order struct

The first five fields share a single 32-byte slot. minRate lives inside the struct, which lives inside a mapping, so adding it consumed no contract storage slot.