Terms & Loans
Overview
Terms and Loans are the two fundamental primitives in Stormbit. Terms represent lender positions—lending pools with specific parameters. Loans represent borrower obligations—fixed-term borrowing agreements.
Collateral types, oracles, and risk parameters vary by term. Each Lending Manager configures their own term parameters. There are no protocol-wide fixed parameters; browse available terms to see current options.
Terms
A Term is a lending pool created by a lender with specific parameters. Every term is uniquely identified by the lender address, the asset being lent, the lender's fee on interest, and the hook contract for custom behavior.
Depositing
Depositors add funds to a term's liquidity pool. Deposits increase the lender's position and make capital available for loans. The deposit process includes hook validation before updating balances and transferring tokens.
Withdrawing
Withdrawals are subject to lock constraints—funds allocated to active loans cannot be withdrawn. Lenders must also settle pending interest before withdrawing. The withdrawable amount equals total balance minus locked amount.
Freezing
A frozen account receives no share of interest from loans allocated after the freeze. Frozen accounts cannot deposit, only withdraw. The account auto-unfreezes when the balance reaches zero.
Use case: Exiting a pool without taking new risk exposure.
Loans
A Loan represents a fixed-term borrowing agreement. Every loan is uniquely identified by the borrower address, the borrowed asset, principal amount, fixed interest amount, duration, and the module handling collateral.
Loan States
Pending
Created, awaiting lender allocation
Active
Funded, loan in progress
Repaid
Successfully repaid
Cancelled
Cancelled before allocation
Liquidated
Defaulted and liquidated
Creating a Loan
When creating a loan, the borrower locks collateral in the module and the loan enters pending state. An allocation deadline is set for lenders to fund the request.
Allocation
Allocation validates that the term has sufficient unallocated balance, the loan is pending and within deadline, the module approves (LTV check), and the hook approves (whitelist check). After allocation, maturity is calculated from duration, funds transfer to the borrower, and lender positions lock proportionally.
Repaying
On-time repayment returns collateral to the borrower and distributes interest to lenders. After maturity, the module initiates repayment through liquidation, collateral goes to the liquidator, and any shortfall is absorbed by fees first.
Settlement
When loans repay, interest isn't immediately distributed. A settlement record captures allocation context, and lenders claim their share when they interact with the protocol—through deposit, withdraw, or explicit settle calls.
This lazy settlement design supports unlimited lenders without requiring active distribution, making it gas-efficient at scale.
Lock Mechanism
When loans are allocated, lender positions lock proportionally. The lock amount corresponds to each lender's share of the allocated capital. When loans repay, positions unlock proportionally.
Lenders can only withdraw their unlocked balance. Active loans reduce available liquidity until repayment.
Fee Structure
On every repayment, interest distributes as protocol fee to treasury, lender fee to term owner, and net interest to depositors. If a loan defaults with shortfall, fees absorb losses before principal—protocol fee first, then lender fee, then net interest, with principal taking only remaining losses.
Owner
Lender
Borrower
Purpose
Provide liquidity
Request credit
Key params
Asset, fee, hook
Asset, amount, duration
Lifecycle
Infinite until closed
Fixed term
Last updated