Skip to main content

Overview

The Aave Leverage Strategy (StrategyAaveLeverage) is an advanced, high-yield strategy that uses leveraged looping to amplify returns. By repeatedly supplying collateral, borrowing against it, swapping, and resupplying, this strategy can achieve yields significantly higher than simple lending. Contract: StrategyAaveLeverage.sol (packages/contracts/contracts/strategy/StrategyAaveLeverage.sol)
High Risk Strategy: This strategy uses leverage and is subject to liquidation risk. Only suitable for users who understand the risks of leveraged DeFi positions.

Key Characteristics

How It Works

Leveraged Looping Mechanism

Example Loop (3 iterations with 60% borrow factor):
  1. Initial: Deposit 100 LINK
  2. Loop 1: Borrow 0.001 WETH → Swap to ~0.015 LINK → Supply 0.015 LINK (Total: 100.015 LINK)
  3. Loop 2: Borrow 0.001 WETH → Swap to ~0.015 LINK → Supply 0.015 LINK (Total: 100.030 LINK)
  4. Loop 3: Borrow 0.001 WETH → Swap to ~0.015 LINK → Supply 0.015 LINK (Total: 100.045 LINK)
Result: ~1.0005x leverage with conservative mock parameters

Investment Flow

Key Safety Features

  1. Conservative Borrow Caps: Limits borrows to 0.001 WETH per loop
  2. Pool Liquidity Checks: Never borrows more than 1% of available pool liquidity
  3. Try-Catch Wrappers: Each step wrapped in try-catch to prevent full revert
  4. Automatic Unwinding: Attempts to repay if swap or supply fails
  5. Pause Mechanism: Can be paused to prevent new investments during volatility

Leverage Parameters

Configurable Settings

maxDepth: Controls how many times the loop executes
  • Range: 1-6 (capped for safety)
  • Default: 3 iterations
  • Higher depth → more leverage → higher risk
borrowFactor: Percentage of collateral value to borrow each loop
  • Range: 0-8000 (0-80%, capped for safety)
  • Default: 6000 (60%)
  • Must be below Aave’s LTV (Loan-to-Value) ratio
  • Includes safety margin to prevent liquidation

Updating Parameters

Parameter Safety Caps:
  • maxDepth capped at 6 to prevent excessive gas costs
  • borrowFactor capped at 80% to maintain safety margin below Aave LTV
  • Typical Aave LTV for LINK: 70-80%
  • Recommended borrowFactor: 60-70% for safe operations

Risk Monitoring

Loan-to-Value (LTV) Tracking

LTV Formula:

Risk Assessment

Risk Thresholds:
  • Safe: LTV < 60%
  • Moderate: LTV 60-70%
  • High: LTV 70-80%
  • Critical: LTV > 80% (liquidation risk)

Leverage State

Deleveraging

When market conditions deteriorate or LTV becomes too high, the strategy can unwind positions:
Deleveraging Process:
  1. Check current WETH debt
  2. Calculate LINK needed (using price oracle + 5% buffer)
  3. Withdraw LINK collateral from Aave
  4. Swap LINK → WETH
  5. Repay WETH debt
  6. Repeat until debt is zero or max loops reached

Balance Calculation

The strategy reports net value accounting for debt:
Formula:

Harvesting

Harvesting withdraws profits (aToken balance exceeding principal) and sends to vault.

Pause Mechanism

When paused:
  • Cannot invest new funds
  • Cannot deleverage
  • Can still withdraw (for emergency exits)
  • Can still harvest

Risk Profile

High Risk Factors

⚠️ Liquidation Risk: If LINK price drops or WETH price rises, LTV increases and position may be liquidated ⚠️ Impermanent Loss: Swap price impact during leverage loops and deleveraging ⚠️ Smart Contract Risk: Exposure to Aave, Uniswap, and strategy contract risks ⚠️ Oracle Risk: Relies on price oracle for deleveraging calculations ⚠️ Market Volatility: Rapid price movements can push position into liquidation ⚠️ Gas Costs: Complex loops require significant gas, reducing net yields

Risk Mitigation

Conservative Parameters: Default 60% borrow factor with safety margin Loop Limits: Max 6 iterations prevents excessive leverage Liquidity Checks: Never borrows more than 1% of pool liquidity Try-Catch Safety: Each step can fail gracefully without reverting entire transaction AI Monitoring: Strategy Sentinel Agent continuously monitors LTV and triggers deleveraging Pause Control: Can halt new investments during volatility Automated Deleveraging: AI automatically reduces leverage when risk thresholds exceeded

APY Calculation

Leveraged APY Formula:
Example (hypothetical):
  • LINK Supply APY: 2%
  • WETH Borrow APY: 3%
  • Leverage: 3x
  • Borrow Ratio: 2x (borrowed 2 WETH per 1 LINK collateral)
Profitability Depends On:
  • Supply APY > Borrow APY (positive spread)
  • AAVE rewards and incentives
  • Efficient leverage ratio
  • Low gas costs relative to position size
Always verify that supply APY exceeds borrow costs before using this strategy.

Development Note

For development and testing, this strategy uses mock contracts:
  • Mock Aave Pool: Simulates borrow, repay, supply, withdraw
  • Mock Swap Router: Simulates Uniswap V2 swaps with fixed rates
  • Mock Price Oracle: Returns programmable prices for LINK/WETH
  • Mock LTV: All liquidation thresholds use mocked logic
This allows predictable testing without mainnet liquidity constraints.

AI Management

The Strategy Sentinel Agent actively manages this strategy:
  1. Continuous Monitoring: Checks LTV every block
  2. Price Tracking: Monitors LINK and WETH prices via oracle
  3. Risk Assessment: Compares current LTV against safe thresholds
  4. Automatic Deleveraging: Calls triggerDeleverage() when LTV > 70%
  5. Rebalancing: Reduces allocation to leverage strategy during high volatility
  6. Pause Control: Pauses strategy during extreme market conditions

Access Control

All critical functions restricted to StrategyRouter:
  • invest()
  • withdrawToVault()
  • harvest()
  • deleverageAll()
  • setLeverageParams()
  • togglePause()

Aave V3 Strategy

Compare with safe lending strategy

Risk Management

Deep dive into risk controls

Strategy Overview

Return to strategies overview

AI Agents

Learn about AI risk management