What is being lent, and who moves what?
Before reading any wallet code, nail the economic story: two assets, two parties, one deadline.
Two assets, two roles
The protocol is peer-to-peer collateralized lending on Liquid. Docs illustrate USDT (loan asset) against LBTC (collateral), but any tokenized pair works.
| Role | Starts with | Wants |
|---|---|---|
| Borrower | Collateral (asset A) | Principal (asset B) now; collateral back later |
| Lender | Principal (asset B) | Interest/fee on asset B; collateral if borrower defaults |
Terms are agreed before acceptance: collateral amount, principal amount, lending term (deadline), loan fee (fixed interest), optional origination fee, protocol fee share.
The lifecycle in plain language
- Propose — Borrower locks collateral and publishes terms. Offer is visible to lenders (via indexer / demo UI).
- Cancel — While still pending, borrower can abort and recover collateral.
- Accept — A lender sends principal; loan becomes active.
- Repay — Before the deadline, borrower returns principal + loan fee; collateral is released.
- Liquidate — After the deadline without full repayment, lender claims the collateral.
See the diagram in Offer state machine or try the live demo as a lender browsing pending offers.
Terms you will see in code reviews
- Pending offer — collateral locked, waiting for a lender
- Active loan — principal delivered, clock running
- Covenant — Simplicity program locking a UTXO until a valid witness path is provided
- Loan fee / interest — in the simplified contract, a fixed fee on repayment (reference impl: basis points on principal)
Full definitions: Glossary.
Check your understanding
Pick the best answer. Options are equal length on purpose.
1. When a lender accepts a pending offer, what happens?
2. After the lending term expires without repayment, who gets the collateral?
3. What is the indexer’s main job for lenders?
Anything unclear? Ask in chat — e.g. “what’s the difference between loan fee and origination fee?” or “walk me through the demo as a borrower.”