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)
Key Characteristics
How It Works
Leveraged Looping Mechanism
Example Loop (3 iterations with 60% borrow factor):- Initial: Deposit 100 LINK
- Loop 1: Borrow 0.001 WETH → Swap to ~0.015 LINK → Supply 0.015 LINK (Total: 100.015 LINK)
- Loop 2: Borrow 0.001 WETH → Swap to ~0.015 LINK → Supply 0.015 LINK (Total: 100.030 LINK)
- Loop 3: Borrow 0.001 WETH → Swap to ~0.015 LINK → Supply 0.015 LINK (Total: 100.045 LINK)
Investment Flow
Key Safety Features
- Conservative Borrow Caps: Limits borrows to 0.001 WETH per loop
- Pool Liquidity Checks: Never borrows more than 1% of available pool liquidity
- Try-Catch Wrappers: Each step wrapped in try-catch to prevent full revert
- Automatic Unwinding: Attempts to repay if swap or supply fails
- Pause Mechanism: Can be paused to prevent new investments during volatility
Leverage Parameters
Configurable Settings
- Range: 1-6 (capped for safety)
- Default: 3 iterations
- Higher depth → more leverage → higher risk
- 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
Risk Monitoring
Loan-to-Value (LTV) Tracking
Risk Assessment
- 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:- Check current WETH debt
- Calculate LINK needed (using price oracle + 5% buffer)
- Withdraw LINK collateral from Aave
- Swap LINK → WETH
- Repay WETH debt
- Repeat until debt is zero or max loops reached
Balance Calculation
The strategy reports net value accounting for debt:Harvesting
Pause Mechanism
- 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 yieldsRisk 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 exceededAPY Calculation
Leveraged APY Formula:- LINK Supply APY: 2%
- WETH Borrow APY: 3%
- Leverage: 3x
- Borrow Ratio: 2x (borrowed 2 WETH per 1 LINK collateral)
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
AI Management
The Strategy Sentinel Agent actively manages this strategy:- Continuous Monitoring: Checks LTV every block
- Price Tracking: Monitors LINK and WETH prices via oracle
- Risk Assessment: Compares current LTV against safe thresholds
- Automatic Deleveraging: Calls
triggerDeleverage()when LTV > 70% - Rebalancing: Reduces allocation to leverage strategy during high volatility
- Pause Control: Pauses strategy during extreme market conditions
Access Control
invest()withdrawToVault()harvest()deleverageAll()setLeverageParams()togglePause()
Related Documentation
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