Skip to main content

Introduction

MetaVault AI employs a sophisticated multi-strategy architecture to maximize yields while managing risk across different DeFi protocols. The vault dynamically allocates user funds between multiple strategies based on market conditions, risk parameters, and AI-driven analysis.

Strategy Architecture

All strategies implement the standardized IStrategy interface, ensuring consistent interaction patterns:
interface IStrategy {
    function strategyBalance() external view returns (uint256);
    function invest(uint256 amount) external;
    function withdrawToVault(uint256 amount) external returns (uint256);
    function harvest() external;
    function deleverageAll(uint256 maxLoops) external;
}

Core Functions

  • invest(uint256 amount): Deploys capital into the strategy’s protocol
  • withdrawToVault(uint256 amount): Withdraws funds back to the vault
  • harvest(): Collects accrued yields and sends profits to the vault
  • strategyBalance(): Returns the current value of assets managed by the strategy
  • deleverageAll(uint256 maxLoops): Unwinds leveraged positions (no-op for non-leveraged strategies)

Available Strategies

MetaVault AI currently supports two distinct strategies:

1. Aave V3 Strategy (Safe)

Contract: StrategyAaveV3.sol
  • Risk Level: Low
  • Mechanism: Simple lending on Aave V3
  • Collateral: USDC
  • Yield Source: Aave V3 supply APY
  • Leverage: None
Learn more about Aave V3 Strategy →

2. Aave Leverage Strategy (Aggressive)

Contract: StrategyAaveLeverage.sol
  • Risk Level: High
  • Mechanism: Leveraged looping (supply → borrow → swap → supply)
  • Collateral: LINK
  • Borrowed Asset: WETH
  • Leverage: Up to 3x (configurable)
  • Yield Source: Amplified Aave supply APY minus borrow costs
Learn more about Aave Leverage Strategy →

Strategy Router

The StrategyRouter contract orchestrates fund allocation across all strategies:
// From StrategyRouter.sol:36-39
constructor(address _vault, address _owner) Ownable(_owner) {
    require(_vault != address(0), "vault=0");
    vault = IVault(_vault);
}

Portfolio Management

Allocation Targets: Strategies are assigned target allocations in basis points (10000 = 100%)
// From StrategyRouter.sol:45-64
function setStrategies(address[] calldata _strats, uint256[] calldata _bps)
    external
    onlyOwner
{
    require(_strats.length == _bps.length, "len mismatch");
    delete strategies;
    
    uint256 total;
    for (uint256 i = 0; i < _strats.length; i++) {
        require(_strats[i] != address(0), "zero strat");
        strategies.push(_strats[i]);
        targetBps[_strats[i]] = _bps[i];
        total += _bps[i];
    }
    
    require(total == 10000, "targets must sum 10000");
}
Rebalancing: The router automatically rebalances to maintain target allocations:
  1. Withdraws excess from overweight strategies
  2. Recalculates total managed assets
  3. Deploys capital to underweight strategies

Harvesting

The router coordinates yield harvesting across all strategies:
// From StrategyRouter.sol:273-298
function harvestAll() external onlyOwner {
    address[] memory list = strategies;
    
    for (uint256 i = 0; i < list.length; i++) {
        address strat = list[i];
        uint256 beforeBal = vault.totalAssets();
        
        try IStrategy(strat).harvest() {
        } catch (bytes memory reason) {
            emit StrategyWithdrawFailed(strat, _decodeRevertReason(reason));
            continue;
        }
        
        uint256 afterBal = vault.totalAssets();
        if (afterBal > beforeBal) {
            uint256 profit = afterBal - beforeBal;
            vault.handleHarvestProfit(profit);
            emit Harvested(strat, profit);
        }
    }
}

AI-Driven Management

The Strategy Sentinel Agent continuously monitors and manages strategies:
  • Health Monitoring: Tracks LTV ratios, liquidation risk, and protocol health
  • Market Analysis: Monitors token prices (LINK/WETH) for market-aware decisions
  • Risk Management: Automatically pauses strategies or reduces leverage during volatility
  • Rebalancing: Adjusts portfolio weights based on market conditions
  • Harvesting: Optimizes yield collection and compounding timing
All strategies currently run on mock contracts for development and testing. Mock contracts simulate Aave mechanics, liquidity indices, borrowing flows, and interest behavior for predictable testing environments.

Development Status

For development and testing purposes:
  • Aave V3 Strategy: Uses mock Aave pool with simulated liquidity index (1e18)
  • Aave Leverage Strategy: Uses mock Aave pool, mock swap router, and mock price oracle
  • All liquidation thresholds and LTV calculations use mocked logic
  • Interest accrual is driven by programmatically updated mock indices

Next Steps

Aave V3 Strategy

Learn about the safe lending strategy

Aave Leverage Strategy

Explore leveraged looping mechanics

Risk Management

Understand risk parameters and controls

AI Agents

See how AI manages strategies

Build docs developers (and LLMs) love