priceScale — derived, never written down
The selected base token, USDT, and the feed can use different decimals. An incorrect scale produces materially incorrect quotes, so the scaling factor is derived at initialisation from the live contracts and recalculated whenever the oracle changes.+4 carries the basis-point denominator so band and premium arithmetic stay integral.
Addition is performed before subtraction so IDRX’s 2 decimals do not underflow against USDT’s 6.
The reference is a five-minute Orakl TWAP
Rondo callstwap(300, maxOracleAge, 5) on the selected Orakl feed. The returned answer averages
the observations published during the previous five minutes and requires at least five of them.
getOraclePrice() returns this value together with the latest observation timestamp and a stale
flag; it does not return the latest individual round.
The same reference is used for Fixed-order band checks, Pegged-order creation, live Pegged quotes,
and Pegged fills. A stale latest observation, a non-positive answer, or an unavailable five-minute
average blocks those oracle-dependent actions. Fixed fills and cancellations remain independent of
the feed.
The two quote paths
- Fixed
- Pegged
Premium and fee — who actually pays
The premium is defined as the taker’s realised edge after the desk fee, not as an approximation of it. That single decision determines who funds the fee, and it is the thing most likely to be misread from outside.One fill, end to end
The following is a JPYC-market example: pegged JPYC-sell · premium 40 bps · fee 30 bps · oracle answer632836 (8 dp).
Two-sided pegged execution
Filling a pegged JPYC-sell and a pegged USDT-sell in one transaction nets 2 × premium, independent of the fee, because the fee divides out of the pegged ratio on both legs.This is the intended economic model. The desk exists for fast rebalancing, and the premium pays
for it. A bot closing both legs completes both makers’ rebalances instantly and takes exactly the
edge those makers advertised. The lever on it is
maxPremiumBps, not the fee.Pricing on the gross amount and forcing premiumBps ≤ feeBps would make the round trip
unprofitable, but it would also give the taker premium − fee ≤ 0, so pegged orders could never
pay a taker anything.
