Skip to content

Collateral & oracles

API reference: oracle_lib · TareEngine

ELI5: Before TARE lets you borrow, it checks how much your collateral is worth using Chainlink price feeds — with a backup feed and a disagreement alarm.

What you can do

Action Who
Deposit listed collateral User
Mint against collateral User (if HF OK)
List new collateral type Engine owner

Launch collateral on Sepolia: MockWETH, MockWBTC with Chainlink USD feeds.

Flywheel fit

Oracle correctness protects the entire flywheel — bad mints would dilute TARE, breaking sTARE, PegKeeper, and ve locks.

Contract walkthrough

oracle_lib._get_price(primary, fallback, max_dev_bps):

  1. Read feeds via defensive raw_call.
  2. Healthy = fresh (≤3h), complete round, positive answer.
  3. Both healthy → require |primary - fallback| / primary ≤ max_dev_bps.
  4. One healthy → use it.
  5. None → revert "OracleLib: no healthy feed".

Per-collateral config in TareEngine:

Parameter Meaning Example
liquidation_threshold % of value for HF 50 → 200% min ratio
max_oracle_deviation_bps Max feed disagreement 500 = 5%
price_feed / fallback_feed Chainlink addresses Sepolia ETH/USD

USD value scaling:

value = price × 1e10 × amount / 10^decimals

(Chainlink USD feeds use 8 decimals; scaled to WAD.)

Sepolia oracles

Feed Address
ETH/USD 0x694AA1769357215DE4FAC081bf1f309aDC325306
BTC/USD 0x1b44F3514812d835EB1BDB0acB33d3fA3351Ee43

What can go wrong

Oracle risks

  • Stale feed → pricing reverts → user cannot add risk.
  • Divergence → intentional halt, not silent pick of wrong price.
  • Owner lists wrong feed address → operational/config risk.

See Oracles.

Source: TARE-Stablecoin/src/oracle_lib.vy