Advanced

Lending Protocols (Mechanics) — Lesson outline

Understand collateral, liquidation, and health factor.

Developer Advanced
5/8 — Lending Protocols (Mechanics) — Lesson outline

RouteKeep this order so code inherits from solid math.

Steps
  1. Warm-up:Calculate HF, max borrow, and utilization for sample positions.
  2. Parameter lens:Pick collateral factors, thresholds, and bonuses for two asset types (volatile vs stable).
  3. Oracle guardrails:Define freshness/bounds checks and what happens on failure (pause borrows?).
  4. Implement minimal pool:Deposit, withdraw, borrow, repay, accrue interest.
  5. Liquidation path:Enforce HF, close factor, bonus; emit events.
  6. Tests:Invariants on HF, utilization, and bad debt prevention.
← Previous section
Next section →