Modules

Overview

Modules handle collateral validation and management for loans. They determine what collateral types are acceptable, manage custody during the loan term, and handle release upon completion or liquidation.

Each term specifies which module to use, enabling different collateral types and validation rules without modifying core protocol logic. Modules are pluggable components that validate collateral before loans are funded, custody assets during the loan term, enforce parameters like LTV limits, and handle liquidation when borrowers default.

Module Lifecycle

The module lifecycle follows four stages:

Setup — When a term is created, the module receives configuration including allowed collateral types, risk parameters, and validation rules.

Before Loan — When a borrower creates a loan, the module receives collateral from the borrower and stores loan-specific data.

Verify — When a lender allocates funds, the module validates loan parameters against term configuration. This includes checking LTV against oracle prices, enforcing duration limits, and ensuring minimum interest requirements.

After Loan — When a loan completes through repayment or liquidation, the module transfers collateral to the appropriate party.

Built-in Modules

ERC20LTV Module

Standard over-collateralized lending with ERC20 tokens. The module provides automated LTV validation using oracle prices, dynamic APR based on risk factors, and collateral custody during the loan term. Configuration includes maximum LTV per collateral type, supported collateral assets, maximum loan durations, and oracle price feeds.

Use case: Standard crypto-backed lending with ETH, stablecoins, and LSTs.

ERC721 Module

NFT-backed peer-to-peer lending. The module provides NFT custody during the loan term with manual lender evaluation—there's no automated pricing or LTV validation. On liquidation, the NFT transfers to the auction buyer.

Use case: Art-backed loans, rare collectibles, gaming assets.

Attestation Module

Identity and credential-based lending using zkTLS proofs. The module supports multiple attestation providers (zkPass, Primus, Reclaim), schema-based verification, and usage limits per borrower. Configuration includes required credential schemas and threshold requirements.

Use case: Under-collateralized lending based on reputation or identity verification.

Custom Modules

Custom modules can be built to support new collateral types or validation logic. Common patterns include stateless modules that rely on token ownership for state, oracle integration for LTV validation, and multi-asset collateral that accepts baskets of tokens.

Modules operate under strict security constraints. Only the LendingManager can call module functions, collateral should never release before loan completion, and safe transfer methods should be used for all token operations.

Module
Collateral
Validation
Use Case

ERC20LTV

ERC20 tokens

Automated LTV

Standard lending

ERC721

NFTs

Manual (P2P)

Art-backed loans

Attestation

Credentials

Schema-based

Identity lending

Last updated