Overview
MetaVault AI employs a comprehensive risk management framework combining smart contract safety mechanisms, configurable risk parameters, and AI-driven monitoring to protect user funds while optimizing yields.Risk Framework Architecture
Multi-Layer Risk Protection
Layer 1: Smart Contract Controls
Access Control:Layer 2: Parameter Constraints
Leverage Caps (StrategyAaveLeverage.sol:106-107):
StrategyRouter.sol:61):
Layer 3: AI-Driven Monitoring
Strategy Sentinel Agent continuously:- Monitors LTV ratios across all leveraged positions
- Tracks real-time token prices (LINK/WETH)
- Assesses market volatility
- Triggers automatic deleveraging when risk thresholds exceeded
- Adjusts portfolio allocations based on market conditions
Risk Parameters by Strategy
Aave V3 Strategy (Low Risk)
| Parameter | Value | Risk Impact |
|---|---|---|
| Leverage | None (1x) | No liquidation risk |
| Asset Type | USDC (Stablecoin) | Minimal price volatility |
| Protocol Exposure | Aave V3 only | Single protocol risk |
| Complexity | Simple supply | Low operational risk |
| LTV | N/A | Not applicable |
Aave Leverage Strategy (High Risk)
| Parameter | Default | Range | Risk Impact |
|---|---|---|---|
| maxDepth | 3 loops | 1-6 | Higher = more leverage = higher risk |
| borrowFactor | 6000 (60%) | 0-8000 (0-80%) | Higher = closer to liquidation |
| Collateral | LINK | N/A | Volatile asset (±10-30% daily) |
| Borrowed Asset | WETH | N/A | Volatile asset (±5-15% daily) |
| Max LTV | ~80% | N/A | Liquidation threshold |
| Target LTV | 60% | N/A | Operating target with safety margin |
Loan-to-Value (LTV) Management
What is LTV?
Formula:- Deposited: 100 LINK (15/LINK)
- Borrowed: 0.5 WETH (2,000/WETH)
- LTV = 1,500 = 66.7%
LTV Risk Zones
| Zone | LTV Range | Status | Actions |
|---|---|---|---|
| Safe | 0-40% | Very low risk | Continue normal operations |
| Moderate | 40-60% | Acceptable risk | Monitor closely |
| Target | 60-70% | Optimal efficiency | Default operating zone |
| High | 70-80% | Elevated risk | AI triggers deleveraging |
| Critical | 80%+ | Liquidation risk | Emergency deleverage + pause |
LTV Monitoring
Contract Function:Deleveraging Mechanics
When Deleveraging Triggers
- LTV Threshold Breach: LTV > 70%
- Market Volatility: LINK price drops > 15% in 1 hour
- Manual Override: Admin/AI agent triggers manually
- Health Factor: Aave health factor < 1.2
Deleveraging Process
- Calculate current WETH debt
- Determine LINK needed (price oracle + 5% slippage buffer)
- Withdraw LINK from Aave
- Swap LINK → WETH on Uniswap
- Repay WETH debt to Aave
- Repeat until debt eliminated or max loops reached
Router Integration
- Partial Deleverage:
maxLoops = 1-3(reduce risk gradually) - Full Deleverage:
maxLoops = 10(emergency unwind)
Portfolio Rebalancing
Dynamic Allocation
The StrategyRouter adjusts allocations based on risk levels: Normal Conditions (Low Volatility):Rebalance Function
Price Oracle Risk
Oracle Dependency
The Leverage Strategy relies on price oracle for:- Calculating LTV ratios
- Determining deleverage amounts
- Computing strategy balance
Oracle Risks
Liquidity Risk
Aave Pool Liquidity
The Leverage Strategy checks pool liquidity before borrowing:- Never borrows more than 1% of available pool liquidity
- Prevents draining small pools
- Reduces borrow rejection risk
Swap Liquidity
Uniswap V2 swaps may experience high slippage during:- Low liquidity pairs
- Large trade sizes
- Market volatility
Emergency Controls
Pause Mechanism
- LTV > 80% (critical zone)
- Oracle failures detected
- Aave pool liquidity crisis
- Smart contract exploit discovered
- Extreme market volatility (>30% daily move)
- ✅ Prevents new investments
- ✅ Prevents deleveraging (to avoid forced selling during panic)
- ❌ Does NOT prevent withdrawals (users can always exit)
- ❌ Does NOT prevent harvesting (collect yields)
Strategy Isolation
Each strategy operates independently:- Failure in one strategy doesn’t affect others
- Router’s try-catch prevents cascade failures
- Users can withdraw from healthy strategies even if one fails
Withdrawal Safety
Multi-Strategy Withdrawal
- Graceful Degradation: If one strategy fails, tries next
- Balance Verification: Measures actual vault balance changes
- Revert Protection: Try-catch prevents single strategy from blocking withdrawals
- Sufficiency Check: Ensures full requested amount withdrawn
Smart Contract Risks
Protocol Dependencies
| Protocol | Exposure | Risk Level | Audit Status |
|---|---|---|---|
| Aave V3 | All strategies | Medium | Audited by multiple firms |
| Uniswap V2 | Leverage strategy swaps | Medium | Audited, battle-tested |
| OpenZeppelin | ERC20, Ownable, SafeERC20 | Low | Industry standard |
| MetaVault Contracts | Core vault logic | High | [Audit status unknown] |
Upgrade Risk
Immutable Contracts: Strategy contracts useimmutable for critical addresses:
- ✅ Cannot be changed after deployment (prevents malicious upgrades)
- ❌ Cannot fix bugs or change protocols without deploying new strategy
- ⚠️ Requires careful testing before deployment
Gas Cost Risks
Leverage Loop Costs
Each leverage loop iteration costs gas:- Supply LINK: ~150k gas
- Borrow WETH: ~200k gas
- Swap: ~120k gas
- Total per loop: ~470k gas
Development Environment
Mock Contracts for Testing:All strategies currently use mock implementations:
- Mock Aave Pool: Simulates supply, borrow, withdraw, repay
- Mock Liquidity Index: Programmatically controlled interest accrual
- Mock Swap Router: Fixed exchange rates for predictable testing
- Mock Price Oracle: Returns configurable prices
- Mock LTV Calculations: Simplified risk calculations
Risk Checklist for Users
Before depositing, users should verify:- Understand liquidation risks for leveraged strategies
- Check current LTV ratios (should be < 70%)
- Verify Aave pool has sufficient liquidity
- Confirm supply APY > borrow APY for leverage strategy
- Review current portfolio allocation (safe vs. aggressive)
- Check if strategies are paused
- Understand that smart contracts are not insured
- Be aware of potential oracle manipulation risks
- Know that withdrawals may take time during high LTV
- Understand performance fees will be deducted
AI Risk Management
The Strategy Sentinel Agent provides:Real-Time Monitoring
- LTV tracking (every 60 seconds)
- Price feed monitoring (LINK, WETH)
- Aave pool health checks
- Gas price monitoring (for cost-effective operations)
Automated Responses
- LTV 60-70%: Log warning, increase monitoring frequency
- LTV 70-75%: Trigger partial deleverage (3 loops)
- LTV 75-80%: Trigger aggressive deleverage (10 loops)
- LTV >80%: Emergency pause + full deleverage
- Price drops >15%: Reduce leverage strategy allocation
- Oracle failures: Pause all leveraged operations
Portfolio Optimization
- Rebalances allocation based on market volatility
- Harvests yields at optimal gas prices
- Compounds profits back into strategies
- Adjusts leverage parameters during calm markets
Related Documentation
Aave V3 Strategy
Low-risk lending strategy details
Aave Leverage Strategy
High-risk leveraged strategy details
Strategy Overview
Multi-strategy architecture
AI Agents
AI-driven risk management