TareEngine¶
API reference: TareEngine contract API
ELI5: The brain of TARE — holds your collateral, tracks your loan, checks prices, and lets liquidators fix unsafe positions.
What you can do¶
| Function | Who | Effect |
|---|---|---|
deposit / mint |
User | Lock collateral, borrow TARE |
repay / withdraw |
User | Pay debt, free collateral |
liquidate |
Anyone | Close unsafe positions |
settle_bad_debt |
Anyone | Wind down insolvent positions |
donate_to_surplus |
Anyone | Donate TARE to backstop |
add_collateral |
Owner | List new asset + feeds |
Flywheel fit¶
- Per-second stability fees mint into
surplus→ SurplusSplitter → sTARE + Keep. - CoilFeeRouter donates swapped TARE to same surplus buffer.
- No direct link to veForge — governance affects Keep, not engine custody.
Contract walkthrough¶
Key state from tare_engine.vy:
# Collateral registry — not hard-coded WETH/WBTC slots
struct CollateralConfig:
allowed: bool
price_feed: address
fallback_feed: address
max_oracle_deviation_bps: uint256
liquidation_threshold: uint256
token_decimals: uint256
surplus: public(uint256) # TARE backstop buffer
total_bad_debt: public(uint256) # Transparent bad debt ledger
seized_collateral: public(HashMap[address, uint256])
Health factor (risk-weighted):
Liquidatable when HF < 1e18.
stateDiagram-v2
[*] --> Open: deposit + mint
Open --> Open: repay partial
Open --> Closed: repay all + withdraw
Open --> Liquidated: liquidate (HF < 1)
Open --> BadDebt: settle_bad_debt (insolvent)
Liquidated --> Open: if debt remains
BadDebt --> [*]
Roles¶
| Role | Powers | Cannot |
|---|---|---|
| Owner | List collateral, pause, shutdown | Touch solvent deposits/debt |
| Liquidator | liquidate, settle_bad_debt |
When HF ≥ 1 |
What can go wrong¶
Risks
- Oracle halt → cannot mint/deposit new risk until feeds healthy.
pauseblocks new deposits/mints; exits stay open.emergency_shutdownis one-way — no new minting ever.
Deep dive: circuit breakers
pause — blocks deposit + mint. emergency_shutdown — permanent mint block. Redeem, burn, liquidate, settle always available per SPEC.md.
Source: TARE-Stablecoin/src/tare_engine.vy