> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/Rohit-KK15/MetaVault-AI/llms.txt
> Use this file to discover all available pages before exploring further.

# Vault Strategies Overview

> Understanding MetaVault AI's multi-strategy architecture for optimized DeFi yields

## 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:

```solidity theme={null}
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 →](/strategies/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 →](/strategies/aave-leverage-strategy)

## Strategy Router

The `StrategyRouter` contract orchestrates fund allocation across all strategies:

```solidity theme={null}
// 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%)

```solidity theme={null}
// 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:

```solidity theme={null}
// 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

<Warning>
  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.
</Warning>

## Development Status

<Info>
  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
</Info>

## Next Steps

<CardGroup cols={2}>
  <Card title="Aave V3 Strategy" icon="shield-halved" href="/strategies/aave-v3-strategy">
    Learn about the safe lending strategy
  </Card>

  <Card title="Aave Leverage Strategy" icon="chart-line" href="/strategies/aave-leverage-strategy">
    Explore leveraged looping mechanics
  </Card>

  <Card title="Risk Management" icon="triangle-exclamation" href="/strategies/risk-management">
    Understand risk parameters and controls
  </Card>

  <Card title="AI Agents" icon="robot" href="/agents/overview">
    See how AI manages strategies
  </Card>
</CardGroup>
