Skip to main content
Avana logo

Price Oracles

The LPOracle prices one market's vault token for Aave; the DebtOracle prices each non-GHO debt asset. Both use validated Chainlink routes and report a price state that Avana's contracts enforce.

Overview

A market is one chain, AMM protocol, pool and exact position shape, with one vault token and one collateral reserve on its CDP Spoke. Each market has its own LPOracle proxy. Each AMM protocol has one LPOracle implementation per chain, and every market of that protocol on that chain is a proxy of it. Today that means one implementation each for Uniswap v3 and Uniswap v4 on Ethereum and one for Aerodrome Slipstream on Base.

The LPOracle has two layers:

  • A price-state core that does not depend on the AMM. It validates Chainlink prices for each of the market's tokens, selects one quote per token, runs failover, agreement, freshness, second-source, sequencer and timer rules, and serves a conservative price when the market cannot be trusted.
  • A pricing module per AMM protocol, compiled into that protocol's implementation. It supplies the composition of the position at an oracle price vector, the AMM consistency check and the listing checks. The AMM integration uses the same composition function, so pricing and unwinding agree.

The LPOracle does two jobs. For Aave, it returns the USD value of one whole vault token with 8 decimals, which the CDP Spoke's AaveOracle reads for health factors and seizure sizing. For Avana, its views report the price state, the source timestamp and age limits of the served price, whether a borrow may rely on the price, the disagreement pause, the recovery grace window, the last accepted price and an hourly checkpoint. The RiskModule and LPVaultSwap enforce their gates from these views.

The LPOracle applies no haircut: all risk adjustment sits in the CDP Spoke's collateral factor. It does not price debt, enforce gates, choose feeds or move tokens. No token, ETH or approval ever moves through it.

The four price states and what each one allows are described on the price states page: Price States.

Vault Token Price

The price of one whole vault token is the value of the tokens the position would hold if the pool price equalled the price implied by the oracle price vector. This is the fair composition. It is the cheapest holding the position can reach: moving the pool price can only raise the value of what the position actually holds, so a pool manipulation cannot inflate collateral and the LPOracle never needs the pool's spot price.

value = Σ amountᵢ(oracle price vector) × priceᵢ
  • Prices are the validated Chainlink quotes of each token, with every USD-pegged stable capped at $1.00 for valuation. A stable trading above $1 does not make the collateral safer, so the premium is never credited.
  • For concentrated liquidity, the oracle price ratio is clamped to the market's tick range before the amounts are computed.
  • Every amount is floored and then reduced by one raw unit. Every division and square root rounds down, against the borrower.
  • Uncollected fees are excluded: owed tokens, fee growth and any fee the AMM keeps apart from the position never count, because a wash trader can raise them within one transaction.
  • The result has 8 decimals and is at least 1. The price never reverts except with an out-of-gas guard and never returns 0, because Aave rejects a non-positive price.

Vault-token decimals

One vault-token base unit is one unit of the position measure the AMM integration credits: for Uniswap v3 and Slipstream, one unit of liquidity of the market's exact range. The decimals are fixed at listing as the smallest value between 6 and 18 for which one whole token is worth at least $1 at the listing prices, so a whole token is worth between $1 and $10. Listing fails if no such value exists.

Example

Example values; each market's parameters are set at listing.

StepValue
MarketUSDC/USDT on the tick range −10 to 10, 10 vault-token decimals
Valuation pricesUSDC $0.99987, USDT $1.00000
Composition of one whole token5,648,563 raw USDC and 4,348,479 raw USDT
After the one-unit deduction5,648,562 and 4,348,478
Price564,782,768 + 434,847,800 = 999,630,568 ($9.99630568)

Concentrated Liquidity

The concentrated-liquidity pricing module serves every Uniswap v3 market on Ethereum and every Aerodrome Slipstream market on Base. Slipstream uses the same tick, square-root price and liquidity math, so the module is shared; only the pool reads differ, and the module never reads the pool's spot state for valuation.

  • The two token prices are converted to a pool square-root price in 512-bit arithmetic, including the decimals factor. The conversion never reverts; an out-of-bounds result is clamped and the market is reported as Drifting.
  • The oracle square-root price is clamped to the range between the market's lower and upper tick. Outside its range a position holds only one token, and the clamp makes the composition exactly that one-token holding.
  • Amounts follow Uniswap's liquidity-amount formulas at the clamped price, rounding down at every step.
  • When the clamp changes the price, the oracle ratio has left the range, which for a stable pair means a token has depegged. The market is Drifting with the price-clamped reason: new pledges and new debt stop, top-ups and liquidation continue.
Example: USDC/USDT on the range −100 to 100 (about ±1%), 9 decimals. USDT depegs to $0.952 with USDC at $1. The ratio is above the range, so one whole token holds 0 USDC and 9,999,541 raw USDT and is priced at $9.52. Without the clamp, the same formulas would give 29,887,349 raw USDT, valued at $28.45, 2.99 times the real holding.

LPPriceMath

LPPriceMath is an internal library with no external calls and no storage. It holds the pure arithmetic of the price path and is compiled into every LPOracle implementation and the DebtOracle, so each formula maps to one function and one verification model. The oracles call it with values they have already validated.

FunctionComputes
normalizeAnswerA Chainlink answer scaled to 8 decimals, rounding down
routeValueThe USD price of a one-leg or two-leg route; a two-leg route takes the timestamp of its oldest leg
feedMaxAgeA leg's heartbeat plus the chain's heartbeat margin
vaultDecimalsThe vault-token decimals chosen at listing
lpPriceThe price of one whole vault token from the pricing module's composition
inUsdBandWhether a stable market is inside the USD band
servedTimestampThe source timestamp of the served price: its oldest input
ageLimitsThe borrow and liquidation age limits of the served price
servedPriceThe collateral price served in each state
debtServedPriceThe debt price served in each state, including the stress rise
secondSourceAgreesThe second-source agreement test
sequencerStatusUp, down, grace or unknown from the sequencer-uptime feed
minObservationsThe pool observation buffer needed for the TWAP window on the chain
gasForCallThe gas check made before every external read

Heartbeats and Age Limits

A Chainlink feed publishes a new round when its answer moves by its deviation threshold or when its heartbeat elapses. A feed that is still operating is therefore never older than its heartbeat plus a publication delay. Each leg's age limit is its own published heartbeat, recorded at listing, plus the chain's heartbeat margin of 1,800 seconds on Ethereum and on Base.

feedMaxAge = feedHeartbeat + heartbeatMargin
FeedHeartbeatAge limit
Ethereum USDC/USD, USDS/USD82,800 s84,600 s
Ethereum USDT/USD, GHO/USD86,400 s88,200 s
Ethereum DAI/USD, ETH/USD3,600 s5,400 s
Base USD stablecoin feeds86,400 s88,200 s

A calm stablecoin feed legitimately ages up to its 23- or 24-hour heartbeat. A 20-hour-old USDC/USD answer is fresh; a borrow against it also needs the second source to agree. There is no separate heartbeat ceiling for primaries, because the agreement check and the second source bound what a feed's age can hide.

  • liquidationPriceMaxAge equals the age limit of each feed.
  • borrowPriceMaxAge is at most that limit. It equals it unless governance lowers it at the short delay during an incident.
  • While a token is priced from its alternate route, every alternate leg is held to its borrow age for liquidation too. Past it, the market's seizure is blocked as if Cached while the market stays Live.
  • The oracle reports the deadline of the served price as an age relative to its oldest input, so a slow stablecoin leg and a fast ETH/USD leg in the same market are each held to their own cadence.

Second Source

A deviation-triggered feed is trusted for up to a day between rounds, so a borrow must not rely on one oracle network alone. Each token has an independent second source: another oracle network's aggregator, or a time-weighted price of a deep pool that is not the market's own pool, multiplied by the reference token's validated quote. A token is confirmed when the second source is valid and agrees with the token's quote within its tolerance, at most 500 bps.

borrowAllowed = (state == Live) ∧ sequencerReady ∧ every token confirmed ∧ (now − servedUpdatedAt ≤ borrowPriceMaxAge)
  • Borrowing and withdrawals that leave debt need this flag for the account's market and for the DebtOracle of the borrowed debt reserve.
  • The second source never gates liquidation and never changes the state, the served price or any timer, so a broken second source can stop borrowing but never protects an unhealthy account.
  • Each token can record a standby second source. Either guardian can switch to it at once; switching back goes through the timelock.
Example: tolerance 100 bps, quote $1.0002. A second source of $0.9940 confirms the token; $0.9890 does not, and borrowing stops while the market stays Live.

TWAP Consistency Check

The pool's time-weighted price is an independent check on Chainlink. It gates the price and never feeds it. The check reads only the market's own pool, fixed at listing, through its observation history over the window W.

  • The reference tick is computed from the uncapped Chainlink quotes. The mean tick over the window is rounded toward negative infinity.
  • The check passes when the two ticks differ by at most the tolerance τ. One tick is a price step of 1.0001, about 1 bp. The launch tolerance is 50 ticks; it can never be set below 10.
  • A failed check, or an observation read that reverts or cannot cover the window, makes the market Drifting. No view reverts because of it.

Observation buffer per chain

A pool writes at most one observation per block, so an attacker who swaps dust in every block could shrink the buffer's time span. The pool must hold enough observations to cover the window at the chain's block time:

twapMinObservations = ⌈twapWindow / CHAIN_BLOCK_TIME⌉ + 1
ChainBlock timetwapWindowtwapMinObservations
Ethereum12 s1,800 s151
Base2 s1,800 s901

Avana raises the pool's observation cardinality at listing and pays for it, over several transactions if needed. The Ethereum value used on Base would cover only 300 seconds.

USD Band

When every token moves together, through a common-mode feed error or a correlated depeg, the pool ratio and the agreement check can look normal. The USD band catches the absolute level. It applies to markets whose tokens are all USD-pegged stables, which includes every stablecoin market; other markets use 0 and the maximum value, so the test always passes.

  • The band is 0.90 to 1.02 at launch, tested on the geometric mean of the token prices.
  • The lower bound is tested on the uncapped quotes, because a downward common-mode move is what the band exists for.
  • The upper bound is tested on the prices capped at $1, so GHO markets stay Live while GHO trades at a premium.
  • A breach makes the market Drifting. It blocks new borrowing and withdrawals that leave debt; pledges, repay and liquidation continue, liquidation while both routes of each token are fresh and agree.
Example: GHO at $1.047 and USDC at $1.00 is in band, because the capped prices give 1.00 against an upper limit of 1.0404; tested uncapped, it would have breached. Both tokens at $0.89 give 0.7921 against a lower limit of 0.81, so the market is Drifting.

Quote-Change Cap

Every AMM protocol has a per-block quote-change cap, maxQuoteChangeBps, set per market (100 bps, 1%, at launch). When a poke computes a price that differs from an accepted price stored in the same block by more than the cap, the LPOracle does not accept it. It emits a capped event and serves the market as Cached for that block; a later block that still computes the new price accepts it.

Example: accepted price $2.10. A quote of $2.13 in the same block is refused (3 × 10¹⁰ > 2.1 × 10¹⁰); $2.11 is accepted. A one-block move never reaches borrowing power, and a real move is accepted one block later.

Poke and Checkpoint

Views compute the state on every read. poke() is the only call that writes price, timer or latch storage. It is permissionless, makes only static calls, takes no lock and returns the state.

What a poke stores

  • The accepted price, only when the market is Live and its inputs are newer than the last accepted price. Re-reading the same rounds never refreshes the timestamp.
  • The first failed read of a failure episode and the first observation of a route disagreement.
  • The grace latch and the recovery time after an outage that reached Expired.
  • The route version of each token, so a standby switch restarts the disagreement window.
  • The checkpoint: a copy of the accepted price, taken at most once per hour.

Who pokes

  • Collateralization pokes the pledged market before each pledge check.
  • The RiskModule pokes the account's market and every non-GHO DebtOracle of the account before a borrow or a withdrawal with debt.
  • LPVaultSwap pokes the collateral market and debt oracles of the account it liquidates.
  • Keepers poke every LPOracle and DebtOracle at least once per hour and once per heartbeat of the fastest leg in force, in every block while a market is not Live, and in the block after a standby switch, restore or sequencer change.
  • Repay, fee collection and debt-free withdrawal never read or poke an oracle.

Gas guard

Each external read gets an explicit gas amount: 50,000 for a feed, 100,000 for a pool or pricing-module read, 40,000 for a registry, store or token call. Before each read the oracle checks that enough gas remains to forward the full amount and reverts with InsufficientGas otherwise. A caller who picks the transaction's gas limit therefore cannot make a healthy feed look failed. poke() also requires pokeMinGas at entry (551,588 in the reference measurement).

Checkpoint and price-drop alert

priceCheckpoint() returns the accepted price copied by a poke at most once per 3,600 seconds. It is always a validated Live price. Monitoring compares the served price with a checkpoint from the last two hours and alerts when it is 3% lower. The price drop is an alert to the guardians only, never an on-chain trip.

Base Sequencer Feed

On Base, every LPOracle, DebtOracle and the RiskModule read the Chainlink L2 sequencer-uptime feed 0xBCF85224fc0756B9Fa45aA7892530B47e10b6433 with a grace period of 3,600 seconds. Ethereum has no sequencer feed, and the sequencer is always treated as ready there.

Sequencer statusEffect
DownBorrowing blocked and seizure paused, because borrowers cannot react while only L1-forced transactions run
Grace (first 3,600 s after restart)Borrowing stays blocked; only accounts below the grace health factor (0.95) can be liquidated
Unknown (unreadable feed)Borrowing blocked; liquidation continues, so a broken uptime feed never stops liquidation
ReadyNo effect

The sequencer status never changes the price state, the served price or any timer.

DebtOracle

GHO is priced by Aave's fixed $1 source and has no DebtOracle. Each other debt asset (USDC, USDT or WETH, enabled per CDP Spoke) has exactly one DebtOracle proxy per chain, used as the Aave price source of that asset's reserve on every CDP Spoke of the chain that lends it. It applies the same leg, route, failover, agreement, freshness, second-source, sequencer and timer rules to one token, with no pool, no consistency check, no USD band and no $1 ceiling: a debt asset above $1 is priced above $1.

A debt price that cannot be trusted is never below the last accepted price, so it can only lower health factors:

StateServed debt price
LiveThe fresh quote
Drifting (routes disagree)The higher of the two routes and the accepted price
CachedThe accepted price
ExpiredThe accepted price raised by the asset's stress rise, rounded up

The stress rise, debtStressRiseBps, is set per asset between 100 and 5,000 bps at its first debt-reserve listing (500 bps for USDC at launch). LPVaultSwap repays a debt reserve in a liquidation only while its DebtOracle is Live within its liquidation age; otherwise the call reverts DebtPriceStale for that reserve, and the account's other reserves stay liquidatable.

Example: USDC with an accepted price of $0.9999 and a 500 bps stress rise. Once Expired, the served price is $1.049895, so 10,000 USDC of debt counts as $10,498.95 instead of $9,999 in the health factor.

Views, Events and Errors

LPOracle functionReturns
latestAnswer()The served price, 8 decimals, at least 1
latestRoundData()The served price with the source timestamp of its oldest input
decimals()Always 8
getPriceState()State, reasons, served, fresh and accepted prices, per-token routes and legs with ages, second-source and consistency data, USD level, sequencer readiness, borrow flag, timers, disagreement pause and grace window
getClPriceState()Concentrated-liquidity detail: clamp, both square-root prices, mean and reference ticks, tolerance and observation cardinality
getTokenPrices()The capped valuation price of each token, used by LPVaultSwap for its recovery floor and per-leg minimum outputs
lastAcceptedPrice()The last accepted price and its source timestamp, used for caps, the minimum pledge value and previews
priceCheckpoint()The hourly checkpoint
borrowPriceMaxAge()Age limit of the served price for borrowing; 0 when the market is failed
liquidationPriceMaxAge()Age limit of the served price for liquidation; 0 when the market is failed
poke()Evaluates and stores; returns the state
checkConfig(OracleConfig)A bitmap of failed listing checks; 0 means every check passes

Every view returns the same result for every caller in the same block, and no view reverts except with the gas guard.

Events to index

  • LPOracle: PriceSeeded, PriceAccepted, PriceStateChanged, RouteChanged, FailureRecorded, FailureCleared, DisagreementRecorded, DisagreementCleared, OutageExpiredLatched, GraceStarted, QuoteChangeCapped, PriceCheckpointed, PriceRouteVersionObserved, PokeMinGasUpdated
  • DebtOracle: DebtPriceSeeded, DebtPriceAccepted, DebtPriceStateChanged, DebtRouteChanged, DebtFailureRecorded, DebtFailureCleared, DebtDisagreementRecorded, DebtDisagreementCleared, DebtOutageExpiredLatched, DebtGraceStarted, DebtRouteVersionObserved

Errors

  • InsufficientGas(gasLeft, required)
  • ConfigCheckFailed(failedChecks)
  • NotLive(state, reasons)
  • PokeMinGasOutOfBounds(value)
  • AdminRoleOnlyTimelock(role, account)
  • NotDebtAsset(asset) (DebtOracle only)

Changes and Upgrades

  • Each LPOracle and DebtOracle is a UUPS proxy. Its admin roles can be held only by the chain's Avana timelock, and every upgrade waits the normal delay of 5 days and can be cancelled while queued.
  • A market's LPOracle address stays the Aave price source and the vault token's oracle for the life of the market. A new pricing model or a fix is an upgrade of that proxy, never a new address. If Aave's price source must change, the Aave payload executes only together with the matching Avana timelock operation, and liquidation keeps running on the LPOracle's own state meanwhile.
  • New price sources and any change to price computation take the normal delay. Tightening a tolerance or lowering a borrow age takes the short delay of 12 hours.
  • Only two route changes take effect without a delay: the automatic failover to the alternate, and a guardian's switch to the standby route recorded at listing.
  • No role can push a price or set a timer. The accepted price and every timer change only through initialization and pokes.
  • At listing, initialization requires every configuration check to pass and a Live price, which it seeds as the first accepted price.