Building Modules
Modules manage collateral for loans.
Interface
interface ILoanModule {
function setup(address caller, TermKey calldata termKey, bytes calldata data) external returns (bool);
function verify(address caller, TermKey calldata termKey, LoanKey calldata loanKey, bytes calldata data) external returns (bool);
function beforeLoan(address caller, LoanKey calldata loanKey, bytes calldata data) external returns (bool);
function afterLoan(address caller, LoanKey calldata loanKey, bytes calldata data) external returns (bool);
function liquidate(TermKey calldata termKey, LoanKey calldata loanKey, address beneficiary, uint256 repayment, bytes calldata data) external;
}Responsibilities
setup() - Configure module for a term verify() - Validate loan parameters before allocation (must revert if unsafe) beforeLoan() - Lock collateral from borrower afterLoan() - Release collateral after settlement liquidate() - Handle defaulted loans
Built-in Modules
ERC20LTV - Token collateral with LTV validation ERC721 - NFT collateral for P2P lending Attestation - Identity/credential-based lending
Integration Notes
Implement the interface above
Validate thoroughly in
verify()Only release collateral after confirming settlement
Reference deployed contracts for implementation details
Last updated