Oracles¶
ELI5: Blockchains cannot see the outside world. An oracle is a feed that writes asset prices on-chain (e.g. ETH/USD from Chainlink). TARE uses two feeds per collateral and stops if they disagree too much.
Why oracles matter¶
Without a price, the engine cannot know:
- How much TARE you may mint (collateral value)
- Whether you are liquidatable
- How much collateral to seize
Wrong price → wrong mints or unfair liquidations. TARE's design halts instead of guessing.
TARE's redundant oracle¶
From oracle_lib.vy:
- Read primary and fallback Chainlink feeds.
- Each feed must be fresh (≤ 3 hour staleness) and positive.
- If both healthy → require agreement within
max_oracle_deviation_bps(e.g. 5%). - If one healthy → use it.
- If none → revert (no price, no new risk).
# Simplified logic — see oracle_lib.vy for full implementation
# Both feeds healthy → check deviation, return primary
# One feed healthy → return that feed
# No healthy feed → revert
Flywheel connection¶
- TareEngine — all CDP math uses oracle prices.
- CoilMakerStrategy — uses pool EMA floor for fill bounds (different mechanism, same idea: don't trade blind).
- Keep strategies — APR is keeper-set off-chain, not oracle-driven on-chain.
See Collateral & oracles.
What can go wrong¶
Oracle failure modes
- Stale feed — deposits/mints may revert until feed updates.
- Feed divergence — pricing halts (safer than picking a manipulated feed).
- Wrong collateral listing — engine owner must list feeds correctly; operational risk.
Deep dive: deviation math
Deviation bps = |primary - fallback| * 10000 / primary. Exceeds max_oracle_deviation_bps → "OracleLib: feed deviation".