Skip to main content

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:
Prevents unauthorized fund movements and ensures all strategy operations go through the audited StrategyRouter. Try-Catch Error Handling:
Graceful degradation ensures single strategy failures don’t halt the entire system.

Layer 2: Parameter Constraints

Leverage Caps (StrategyAaveLeverage.sol:106-107):
Allocation Validation (StrategyRouter.sol:61):

Layer 3: AI-Driven Monitoring

Strategy Sentinel Agent continuously:
  1. Monitors LTV ratios across all leveraged positions
  2. Tracks real-time token prices (LINK/WETH)
  3. Assesses market volatility
  4. Triggers automatic deleveraging when risk thresholds exceeded
  5. Adjusts portfolio allocations based on market conditions

Risk Parameters by Strategy

Aave V3 Strategy (Low Risk)

Risk Score: 2/10

Aave Leverage Strategy (High Risk)

Risk Score: 8/10
Critical Risk: LINK/WETH price ratio changes directly impact LTV. A 20% drop in LINK or 20% rise in WETH can push LTV from 60% to 72%, approaching liquidation.

Loan-to-Value (LTV) Management

What is LTV?

Formula:
Example:
  • Deposited: 100 LINK (1,500@1,500 @ 15/LINK)
  • Borrowed: 0.5 WETH (1,000@1,000 @ 2,000/WETH)
  • LTV = 1,000/1,000 / 1,500 = 66.7%

LTV Risk Zones

LTV Monitoring

Contract Function:
AI Monitoring Loop:

Deleveraging Mechanics

When Deleveraging Triggers

  1. LTV Threshold Breach: LTV > 70%
  2. Market Volatility: LINK price drops > 15% in 1 hour
  3. Manual Override: Admin/AI agent triggers manually
  4. Health Factor: Aave health factor < 1.2

Deleveraging Process

Steps:
  1. Calculate current WETH debt
  2. Determine LINK needed (price oracle + 5% slippage buffer)
  3. Withdraw LINK from Aave
  4. Swap LINK → WETH on Uniswap
  5. Repay WETH debt to Aave
  6. Repeat until debt eliminated or max loops reached

Router Integration

Router can trigger deleveraging with configurable loop count:
  • 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):
High Volatility Detected:
Critical Risk:

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

Oracle Manipulation: Flash loan attacks or oracle failures could provide incorrect prices, leading to:
  • Under/over deleveraging
  • Incorrect balance reporting
  • Unexpected liquidations
Mitigation:
  • Use Chainlink price feeds (battle-tested, manipulation-resistant)
  • Implement price sanity checks
  • Add time-weighted average price (TWAP) validation

Liquidity Risk

Aave Pool Liquidity

The Leverage Strategy checks pool liquidity before borrowing:
Safety Measures:
  • 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
Current Implementation:
Slippage Risk: Current implementation has amountOutMin = 0, accepting unlimited slippage.Recommendation: Implement slippage protection:

Emergency Controls

Pause Mechanism

When to Pause:
  • LTV > 80% (critical zone)
  • Oracle failures detected
  • Aave pool liquidity crisis
  • Smart contract exploit discovered
  • Extreme market volatility (>30% daily move)
Effects:
  • ✅ 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

Safety Features:
  1. Graceful Degradation: If one strategy fails, tries next
  2. Balance Verification: Measures actual vault balance changes
  3. Revert Protection: Try-catch prevents single strategy from blocking withdrawals
  4. Sufficiency Check: Ensures full requested amount withdrawn

Smart Contract Risks

Protocol Dependencies

Multi-Protocol Risk: Leverage strategy exposes users to Aave, Uniswap, and price oracle risks simultaneously. A vulnerability in any component could affect user funds.

Upgrade Risk

Immutable Contracts: Strategy contracts use immutable for critical addresses:
Implications:
  • ✅ 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
3 Loops (default): 1.4M gas ($50-200 depending on gas prices) 6 Loops (max): 2.8M gas ($100-400)
High gas costs can erase yields for small positions. Recommended minimum position size: $10,000+ for leverage strategy.

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
This allows comprehensive testing without mainnet constraints, but production deployment requires integration with real protocols.

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

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