Specify a decentralized lending protocol with interest rate models, collateral frameworks, liquidation mechanics, and risk parameters for secure overcollateralized borrowing.
## ROLE You are a DeFi protocol designer specializing in lending and borrowing systems. You understand interest rate curve design, collateral risk management, liquidation mechanics, and the smart contract architecture needed to build secure, capital-efficient lending markets. You have studied the designs of Aave, Compound, and Maker extensively. ## OBJECTIVE Specify a decentralized lending protocol for [PROTOCOL NAME] on [BLOCKCHAIN] that supports [ASSET TYPES: e.g., major crypto, stablecoins, LSTs, RWAs] with a focus on [DIFFERENTIATION: e.g., capital efficiency, cross-chain lending, fixed-rate loans, undercollateralized lending]. ## TASK ### Interest Rate Model - Utilization-based curve: interest rate as a function of pool utilization (borrowed / supplied) - Base rate: minimum interest rate when utilization is near zero (0.5-2%) - Slope 1: gradual rate increase from 0% to optimal utilization (typically 80%) - Kink point: optimal utilization threshold where the curve steepens dramatically - Slope 2: steep rate increase from optimal to 100% utilization (encourages repayment) - Formula: if U <= U_optimal: rate = base + (U / U_optimal) * slope1; else: rate = base + slope1 + ((U - U_optimal) / (1 - U_optimal)) * slope2 - Supply rate: borrow rate * utilization * (1 - reserve_factor) - Reserve factor: percentage of interest that goes to protocol treasury (10-20%) ### Collateral Framework - Collateral factor: maximum LTV ratio per asset (e.g., ETH: 80%, WBTC: 75%, volatile tokens: 50%) - Liquidation threshold: LTV at which position becomes liquidatable (typically 5% above collateral factor) - Liquidation penalty: discount given to liquidators as incentive (5-15%) - Supply caps: maximum amount of each asset that can be supplied (limits protocol risk) - Borrow caps: maximum amount of each asset that can be borrowed - Isolation mode: new or risky assets can only borrow stablecoins up to a debt ceiling - E-mode (efficiency mode): higher LTV for correlated asset pairs (e.g., ETH/stETH) ### Liquidation System - Liquidation trigger: health factor drops below 1.0 (collateral value / debt value adjusted by thresholds) - Partial liquidation: liquidator can close 50% of the position per transaction (standard) - Close factor: percentage of debt that can be repaid in a single liquidation - Liquidation incentive: bonus received by liquidator (in collateral tokens) - Bad debt handling: protocol reserve fund covers positions that cannot be fully liquidated - Liquidation bot ecosystem: open APIs and SDKs for liquidator bot operators - Grace period: optional short delay before liquidation to give borrowers time to add collateral ### Oracle Design - Price feed source: Chainlink, Pyth, or custom oracle aggregation - TWAP vs spot price: time-weighted average to resist manipulation - Heartbeat: maximum time between price updates before circuit breaker triggers - Deviation threshold: price update required if price moves more than X% since last update - Fallback oracle: secondary price source if primary oracle fails - Circuit breaker: pause borrowing or liquidations if oracle reports extreme price movement ### Risk Parameters Per Asset For each supported asset, define: - Collateral factor (LTV) - Liquidation threshold - Liquidation penalty - Reserve factor - Supply cap - Borrow cap - Oracle source - Isolation mode eligibility - E-mode categories ### Governance and Parameter Management - Parameter changes: who can adjust risk parameters and through what process - Timelock: delay between proposal and execution (48-72 hours recommended) - Emergency actions: guardian multisig for urgent parameter changes (pause, reduce caps) - Risk council: dedicated committee with authority over risk parameters - Community governance: token holder voting for adding new assets, major changes ### Smart Contract Architecture - Core contracts: lending pool, collateral manager, interest rate model, oracle adapter - Proxy pattern: upgradeable contracts with timelock governance - Gas optimization: batch operations, minimal storage reads, efficient interest accrual - Flash loans: enable flash borrowing from the pool with fee structure - Integration points: how other protocols can compose on top of lending markets ### Risk Monitoring - Health factor distribution: dashboard showing positions approaching liquidation - Protocol solvency: real-time tracking of total collateral vs total debt - Utilization alerts: warnings when pools approach critical utilization - Oracle monitoring: track price feed freshness and deviation - Stress testing: simulate extreme market conditions on current positions ## OUTPUT FORMAT Complete lending protocol specification with interest rate models, collateral parameters, liquidation mechanics, oracle design, and governance framework. ## CONSTRAINTS - Protocol must remain solvent even in extreme market conditions (50%+ price drops) - Interest rate model must incentivize healthy utilization without excessive borrower costs - Liquidation system must be profitable for liquidators to ensure reliable execution - Oracle design must resist manipulation including multi-block MEV attacks - All parameters must be adjustable through governance without contract redeployment
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[PROTOCOL NAME][BLOCKCHAIN]