What this guide covers
- Supply, borrow, interest-rate, and collateral mechanics
- Liquidation design and price-feed risk
- Governance, risk parameters, and user safeguards
What a DeFi lending platform is
A DeFi lending platform pools supplied assets and lends them to borrowers who lock collateral worth more than the loan. Interest rates move with utilisation: when borrowing demand rises against available supply, rates rise to attract suppliers and discourage borrowing, and vice versa. Smart contracts track each position's health — collateral value against borrowed value — and allow liquidation when health falls below a threshold, repaying lenders before losses spread.
The design choices that matter most are risk parameters, not interface polish: which assets are accepted as collateral, their loan-to-value ratios, liquidation thresholds and penalties, and how prices are sourced. A platform that accepts volatile collateral with generous ratios and a single price feed is one market crash away from bad debt, while a conservative platform may attract fewer users but survive stress.
Core features
Lending protocols compete on risk management. These features keep lenders whole when markets move fast.
- Supply and borrow markets: Let users supply supported assets to earn variable interest and borrow against collateral, with per-asset caps that limit exposure to any single token.
- Dynamic interest-rate models: Adjust rates automatically with utilisation, with published curves so suppliers and borrowers can predict costs before committing.
- Collateral health and liquidation: Show position health clearly, warn before liquidation thresholds, and run fair liquidations with penalties that reward liquidators without punishing borrowers excessively.
- Reliable price feeds: Use multiple oracle sources with deviation checks and fallback behaviour, so a single feed failure cannot trigger wrongful liquidations.
- Risk dashboards and reserves: Publish total supplied, borrowed, utilisation, and reserve funds per market, so users judge protocol health from data, not marketing.
- Governance and parameter controls: Let token holders or a risk committee adjust parameters through timelocked proposals, with emergency pause controls for critical failures.
How it is built
Economic testing matters as much as code testing. Simulate crashes, oracle failures, and bank-run withdrawals before real funds arrive.
- Design markets and risk parameters: Choose initial assets, loan-to-value ratios, liquidation thresholds, interest curves, and caps, with reasoning documented per asset.
- Build core lending contracts: Implement supply, borrow, repay, withdraw, and liquidation logic, with thorough unit and integration tests for edge cases.
- Integrate oracles and safety controls: Connect price feeds with checks and fallbacks, add pause controls, and test oracle failure scenarios explicitly.
- Audit and stress-test: Run independent audits, economic simulations, and a limited launch with caps, monitoring liquidations and bad debt daily.
- Add governance and scaling: Introduce parameter governance, expand asset markets gradually, and publish ongoing risk reports as the protocol grows.
Technology considerations
Smart-contract risk dominates: lending contracts hold pooled funds, so audits, formal verification for core invariants, and bug bounties are standard. Oracle design is the second risk — prices must be manipulation-resistant, timely, and resilient to feed outages, which usually means aggregating several sources with sanity bounds. Liquidation infrastructure needs liquidators who can act quickly; without them, underwater positions become bad debt.
Composability cuts both ways. Other protocols building on top of lending markets bring users, but also mean a failure elsewhere can cascade into this protocol. Frontend honesty matters too: users must see health factors, liquidation prices, and variable-rate risk in plain language, not just attractive headline yields.
Challenges to plan for
- Bad debt in crashes: Fast price falls can leave positions under-collateralised before liquidation completes. Conservative parameters and reserves reduce, but never eliminate, this risk.
- Oracle manipulation: Thin markets let attackers move a price feed and exploit loans. Require deep, aggregated price sources and reject single-exchange feeds for collateral assets.
- Regulatory uncertainty: Lending rules vary by jurisdiction and change over time. Legal review of the operating model belongs in the design phase, not after launch.
Who uses it and what it typically costs
Cost depends on market count, audit scope, and governance complexity. A single-market lending protocol with audited contracts is a substantial build, while a multi-asset platform with governance, oracles, and risk tooling is larger. Confirm audit and economic-modelling costs in any quote, since both are essential and often underestimated.
First release scope
A sensible first release offers one or two well-understood collateral assets with conservative ratios, a tested liquidation path, and capped deposits, before expanding markets. Launch criteria should include an independent audit, stress simulations covering a sharp price crash and an oracle outage, and a liquidation executed successfully on a test network under volatile conditions. Resist launching with generous ratios or exotic collateral to attract users; early growth bought with risk becomes bad debt at the first market shock.
Frequently asked questions
Why must loans be over-collateralised?
Because there is no credit check or legal recourse in a permissionless protocol, collateral worth more than the loan is what protects lenders if a borrower defaults.
What triggers liquidation?
When collateral value falls relative to borrowed value below a threshold, liquidators repay part of the loan and claim collateral plus a penalty, restoring the position to health.
Why do interest rates change?
Rates follow supply and demand. High borrowing demand raises rates, attracting more suppliers and cooling borrowing, which balances each market automatically.
Can I lose supplied funds?
Yes, if bad debt exceeds reserves or a contract fails. Supply risk is real, which is why reserves, caps, and audits matter.
What is a health factor?
A ratio of collateral value to borrowed value adjusted for risk. Above one is safe, near one is at risk, and below one invites liquidation.