Skip to content

In-depth lesson · Price oracle manipulation

Typical fixes

Every point the Price oracle manipulation reports back under this heading, best-backed first, each with the reports it is seen in.

Back to the lesson 1 to 13 of 13
  1. Use a manipulation-resistant time-weighted average price or an external oracle instead of instantaneous pool reserves.

    Seen in 6 reports
  2. Require the oracle used for a loan to match the one the counterparty accepted, and reject oracle changes on outstanding loans.

    Seen in 2 reports
  3. Validate round completeness and a non-zero timestamp before consuming Chainlink round data.

    Seen in 1 report
  4. Scale by ten raised to the token's decimals, not by the decimal count itself.

    Seen in 1 report
  5. Average the price over the window rather than averaging pool balances, so a temporary imbalance does not dominate.

    Seen in 1 report
  6. Restrict who can update the oracle and allow more than one observation per epoch.

    Seen in 1 report
  7. Revert on TWAP failure instead of returning the spot price, and correct the inverted history condition.

    Seen in 1 report
  8. Carry forward the accepted per-feed timestamps when rotating to a replacement oracle.

    Seen in 1 report
  9. Pass a non-zero minimum-shares-out to the router on strategy deposits.

    Seen in 1 report
  10. Anchor the minimum output to an independent price source or add a circuit breaker instead of relying on an on-chain quoter.

    Seen in 1 report
  11. Restrict the rebalance function so it cannot be called by anyone during a flash loan.

    Seen in 1 report
  12. Do not treat a permissionlessly reported value as the spot price for collateral valuation.

    Seen in 1 report
  13. Ensure the minimum lock period cannot be set to zero.

    Seen in 1 report