Supporting covenants
Small Simplicity programs the main LendingOffer covenant composes with. Source: simplicity-lending simf.
| Covenant | Role in lending |
|---|---|
| ScriptAuth | Locks the lender NFT to the LendingOffer script hash. Unlocks when the parent covenant spends (e.g. accept). Prevents lender NFT moving independently before acceptance. |
| AssetAuth | Locks principal to the borrower NFT until conditions met. On accept, borrower’s principal output is wrapped in AssetAuth. |
| AssetAuthVault | Holds repaid principal. Keeper NFT (lender or protocol) authorizes withdrawal; supplier NFT (borrower) governs deposits during repayment. Active vs finalized variants. |
| IssuanceFactory | Mints per-offer utility NFTs (Lesson 2). |
| LendingOffer | Main lifecycle covenant: pending → active → repay / liquidate / cancel. |
How they chain (accept example)
- Spend
pending_offerwithOfferAcceptancewitness - Co-spend lender NFT via
ScriptAuthunlock - Update storage:
is_active = true - Create new
active_offeroutput +AssetAuthprincipal for borrower
PR #13 wires these for pending creation only (ScriptAuth.attach_creation for lender NFT). Accept/repay paths come in later PRs.