Overview
Overview
Stormbit is built on a modular architecture that separates core accounting from business logic. This design enables unlimited extensibility without forking the protocol.
The core protocol consists of the LendingManager (central orchestrator), Term Library (lender-side accounting), and Loan Library (borrower-side state). Extensions include Hooks (custom logic injection), Modules (collateral management), and a Liquidator (auction execution).
Core Components
LendingManager
The central orchestrator coordinating all lending operations. It handles term operations (create pools, deposit, withdraw, settle), loan operations (create loans, allocate, repay), fee management, and access control.
Term Library
Manages lender-side accounting including positions (depositor balances), allocations (capital locked in active loans), settlement (interest distribution), and locks (preventing withdrawal of allocated funds).
Loan Library
Manages borrower-side state including loan creation, state transitions (pending, active, repaid, liquidated), maturity tracking, and repayment processing.
Hooks
Inject custom logic at lifecycle events without modifying core protocol. Hook points include term initialization, deposits and withdrawals, loan allocation, and repayment.
Modules
Pluggable collateral validators and managers supporting ERC20 with LTV validation, NFT custody, and attestation verification.
Liquidator
Handles defaulted loans through a declining price auction mechanism.
Design Principles
Separation of Concerns — Core accounting is immutable. New features are added via hooks and modules, not protocol changes.
Gas Efficiency — Optimized state reads, lazy settlement (interest distributed only when users interact), and batch operations.
Composability — Hooks can integrate with other protocols, modules support various collateral types, and terms can be extended with custom logic.
Security — Upgradeable with appropriate safeguards, reentrancy protection on all entry points, and role-based access control.
Protocol Flow
The complete loan lifecycle: a lender creates a term, depositors add funds, a borrower creates a loan request with locked collateral, the lender allocates funds, the loan becomes active and protected until maturity, then either the borrower repays (collateral returned) or defaults (auction process), and interest distributes to lenders.
Next Steps
Terms & Loans — Core primitives
Hooks — Customizing protocol behavior
Modules — Collateral management
Liquidation — Default handling
Risk Pricing — APR calculation
Last updated