Lesson 0414 min
ORACLE · STALE PRICE · BAD DEBT

Who Gets Pushed into Bad Debt by a Wrong Price?

Separate market and oracle prices to see stale data delay liquidation and leave debt after collateral is exhausted.

ObjectivesAfter this lesson, you should be able to:
  • Separate outside market price from the oracle price used for risk
  • Explain why stale data makes health look too high
  • Understand how uncovered debt becomes bad debt
COURSE POSITIONStep 4 of 4
  1. PREVIOUSAt What Price Can a Liquidator Take Over?
  2. CURRENTWho Gets Pushed into Bad Debt by a Wrong Price?

    Separate market and oracle prices to see stale data delay liquidation and leave debt after collateral is exhausted.

  3. NEXTFree sandbox
BEFORE YOU READ

Think about these questions first.

Choose an answer before opening the explanation. You can add anything unexpected to your review list.

Q01The market crashed, but the oracle has not updated. Why does the account still look safe?
SHORT ANSWER

The contract reads the recorded onchain price, not an exchange screen. A stale value temporarily overstates collateral until the update reveals accumulated risk.

Compared with your prediction:

A lending protocol does not read every market trade directly. It depends on an oracle to write a verifiable price into risk logic. A market crash does not mean the protocol has seen it, and a wrong oracle price does not make a position safe.

Put two prices side by side

The lab shows:

  • Market price: what outside traders would trade at now.
  • Oracle price: what the protocol currently uses for collateral value, capacity, and liquidation.

If market price falls to 72 while the oracle remains at 120, health factor can still look high. Only an oracle update recomputes the boundary.

LENDING SIMULATIONVirtual collateral · no advice
LENDING 001 · COLLATERAL / HEALTH / LIQUIDATION

TOKEN collateral → credits

Put one loan into the state machine and watch price, interest, oracle, and keeper actions reshape the account.

Current stateNo debtHealth
01Collateral
02Debt
03Risk moves
04Liquidation
Health
Oracle price120credits / TOKEN
Collateral value00 TOKEN
Current debt0Available 0
Healthliquidation line 1.00
Liquidation priceoracle reading
FOCUS EXPERIMENT · ORACLEOracle and bad debt

Drop the market price without updating the oracle, then compare the risk readings.

Account & collateral poolNo debt
Locked TOKEN
0
Debt / value
0
Wallet TOKEN
100
Account cash
5,000
Protocol liquidity
100,000
Liquidator TOKEN
0

Collateral is locked once deposited; a withdrawal first simulates the resulting health factor.

PRICE INPUTS · ORACLE BOUNDARYMarket price is not protocol price

Move the outside market, then choose when the oracle updates. Current gap 0.00%.

LIQUIDATION KEEPERCan a liquidator take over?

Line 1.00; bonus 5.00%. The button unlocks only after health crosses the boundary.

Liquidator credits50,000
LiquidatableNO
Bad debt0
Observation prompt

Deposit collateral, then borrow near the capacity. Capacity, health, and pool liquidity are three different boundaries.

Lending events1 EVENTS
  1. 01

    抵押池创建:100 TOKEN, 初始价格 120 credits.

ACTION HISTORYExperiment timeline
1 state snapshots

Use the slider to return to an earlier step. Continuing from there replaces the later history with a new sequence.

Initial state
View experiment records →

Debt after collateral is exhausted is bad debt

If price moves too fast or collateral was insufficient, a liquidator can repay only what the seized assets cover. Any remaining liability has no matching asset. That is not an ordinary pending order; it is a gap the protocol must absorb.

Buffers include lower LTV, insurance, reserves, liquidation incentives, and better data sources. None guarantees zero bad debt; each changes its probability and who bears it.

Expand: how this step works
marketPrice != oraclePrice

healthFactor = value(oraclePrice) * threshold / debt
if marketPrice moves first:
  risk is invisible until oracle updates

if all collateral is seized and debt > 0:
  badDebt = debt

Onchain execution is deterministic relative to the input it reads; it cannot prove that the input is the correct real-world price.

KNOWLEDGE CHECK

What is the most accurate description when market price falls but the oracle still returns the old price?

LESSON RECAPComplete the exercise and knowledge check first