Skip to content

The oracle and stale prices

Source: kadia-lending at commit f9c0bdd (f9c0bdd766155fa8afa24e29e0e0cc13508e2d05), with corrections checked by kadia-lending against 66f4aca, with D60 (rs-coins priced at their underlying coin) from 8a94705: docs/specs/economic-model-v1.md (EM v1) and docs/specs/lending-design.md (LD).

Every price is in US dollars. Each asset has one source, fixed per network at launch (EM v1 §3.1, D56):

  • A Kadia oracle feed, wherever the network has one for that asset when lending launches. Moving an asset to a Kadia feed later takes a release.
  • Otherwise, an older source:
    • ERG: the ERG/USD oracle pool;
    • the rs-coins: cannonQ’s AVL multi-feed;
    • SigUSD: the SigmaUSD bank itself. SigUSD counts at $1 while the bank holds at least 100% reserves, and less, pro rata, below that (EM v1 §3.3).
  • Prices round against the borrower: collateral rounds down and debt rounds up. A price that works out to zero is refused (EM v1 §3.1).

The LP market keeps its own rule: it reads the Kadia DEX ERG/USE market for the pool’s reserves only, never as a price, as they stood at the start of the block, so a same-block donation can’t inflate an LP token’s value (LD D29).

  • Testnet: tUSE is counted at $1, on both sides. There’s no tUSE feed, so a fall below $1 isn’t seen. That’s why USE collateral has lower limits (EM v1 §3.5).
  • Mainnet: lending launches only after USE is redeployed and the Kadia oracle has a USE feed. USE as collateral will be valued at the feed’s published price, and USE as debt at the higher of its market price and Dexy’s rate (EM v1 §3.5).
  • Testnet: the first Kadia feeds lending reads are ERG/USD and rsBTC.
  • Mainnet (planned): USE from its Kadia feed, and the other assets from whichever Kadia feeds exist and are past their observation period when lending launches; otherwise from the older sources.
  • An rs-coin is priced at its underlying coin (BTC for rsBTC, and so on), by a Kadia feed or the AVL feed alike. A bridge failure doesn’t show in the price; it shows only as the oracle’s peg-or-bridge warning, which stops new loans against that coin (EM v1 §3.1, D60).
Source Allowed age for new loans Allowed age for liquidations
A Kadia feed (proposal: three heartbeats) 30 blocks for ERG/USD, 90 for the rs-coins the same
The older sources 15 blocks 90 blocks

(EM v1 §3.2, D34, D56.) New loans here means borrowing, and removing collateral from a loan that still has debt.

  • tUSE at $1 has no source, so it’s never out of date.
  • Repaying, adding collateral and lender withdrawals don’t depend on price age. Removing collateral from a loan with debt does, like borrowing. Adding collateral is how you protect your loan while a feed is stalled.
  • A liquidation on an out-of-date price is refused, never counted as “not liquidatable”. Liquidations resume at the next up-to-date price. An old price is never used for or against a borrower.
  • Nothing needs an administrator to resume after a stale feed: once it posts a fresh confirmed price, liquidations and new loans resume. A guardian pause (at most 30 days, unless renewed) and a pending upgrade notice still close new risk until they end.

A Kadia feed carries flags. Lending reads them for every feed an action uses, on both sides of the loan (EM v1 §3.6, D56):

The feed shows… New loans Liquidations
Its observation period (a new feed isn’t used yet) refused refused
Out of date refused refused
A large move held for confirmation refused at the last confirmed price
A fast move refused after one more confirmed round
A peg or bridge gap, on either asset refused at the last confirmed price
Fewer operators than the committee’s 5, fewer than 4 in band, or an operator removal pending refused at the last confirmed price
An oracle script upgrade announced refused at the last confirmed price
The oracle paused, or an informational flag no effect no effect
  • Repaying and adding collateral never read a flag. They only make a loan safer, and blocking them would stop rescues during a fast move.
  • After a fast move, liquidations wait one confirmed round after lending’s price record first sees the flag: about 3 to 6 blocks (EM v1 §3.6, §3.7).
  • The observation period is at least 10,080 blocks on mainnet (20,160 for ERG/USD and USE, 21,600 for the rs-coins). Testnet uses 720 blocks, about a day (EM v1 §14).

Lending keeps one price record per Kadia feed, shared by every pool. Anyone can update it with each newly confirmed price, and lending’s keeper is planned to. It holds the lowest and highest confirmed prices over two 30-block windows (EM v1 §3.7, D57).

  • New loans use the cautious price: collateral at the lowest of the current price and the recent record, and the borrowed asset at the highest.
  • Nobody can make it better than the current price, and only prices the feed confirmed can enter it. If nobody updates it, it falls back to the current price alone.

A price can move on exchanges before a feed posts it. Kadia limits what anyone can borrow at an old price:

  • The maximum LTV leaves room for a round of lag (LD D35).
  • A borrow cap: new borrowing in each 15-block window is limited to 5% of the pool (launch parameters; LD D35).
  • The cautious price above, on Kadia feeds.

Large, fast moves beyond that are a disclosed risk. See Risks.