Skip to main content

Overview

The StrategyAaveV3 contract implements a straightforward yield strategy by supplying assets to Aave V3 and earning supply-side interest. This is a non-leveraged strategy ideal for stable, low-risk yield generation. Implements: IStrategy Risk Level: Low (no leverage, no borrowing)

State Variables

IERC20
required
Immutable. The underlying asset token (e.g., USDC, LINK).
address
required
Immutable. Address of the Vault contract that owns this strategy.
address
required
Immutable. Address of the StrategyRouter that controls this strategy.
IPool
required
Immutable. Aave V3 Pool contract interface.
IProtocolDataProvider
required
Immutable. Aave Protocol Data Provider for querying reserve data.
uint256
required
Tracks principal deposited (for bookkeeping and APY calculation).

Constructor

address
required
Address of the underlying asset token
address
required
Address of the Vault contract
address
required
Address of the StrategyRouter
address
required
Address of Aave V3 Pool contract
address
required
Address of Aave Protocol Data Provider
Initialization:
  • Approves pool to spend unlimited tokens (gas optimization)
  • Sets all immutable references

IStrategy Interface Implementation

invest

Supply assets to Aave V3 pool.
uint256
required
Amount of assets to invest (must already be transferred to strategy)
Requirements:
  • Only callable by router
  • Strategy must already hold the tokens (via vault.moveToStrategy())
Process:
  1. Calls pool.supply() to deposit tokens into Aave
  2. Receives aTokens (interest-bearing tokens) in return
  3. Updates deposited principal tracker
Example Flow:

withdrawToVault

Withdraw assets from Aave and transfer to vault.
uint256
required
Amount of underlying assets to withdraw
uint256
Actual amount withdrawn and sent to vault
Process:
  1. Calls pool.withdraw() to redeem aTokens for underlying
  2. Transfers underlying tokens to vault
  3. Updates deposited tracker
Example:

harvest

Harvest accrued interest and send to vault. Process:
  1. Queries current aToken balance (includes accrued interest)
  2. Calculates profit: aBal - deposited
  3. Withdraws profit from Aave
  4. Transfers profit to vault
  5. Keeps principal deposited
Note: Principal remains invested; only profits are harvested. Example:

strategyBalance

Get total value of assets held by strategy.
uint256
Total underlying value (principal + accrued interest)
Uses: pool.getUnderlyingValue() to query Aave for current position value.

deleverageAll

No-op function for non-leveraged strategies.
uint256
Ignored (no leverage to unwind)
Note: This strategy doesn’t use leverage, so deleveraging is unnecessary. Kept for interface compliance.

View Functions

estimateAPY

Estimate current APY based on accrued interest.
uint256
Estimated APY scaled by 1e18 (1e18 = 100% APY)
Formula: (currentBalance - deposited) * 1e18 / deposited Note: This is a snapshot estimate, not annualized. For accurate APY, track over time. Example:

Integration Example

Aave V3 Integration Details

Supply Flow

Withdraw Flow

Interest Accrual

Aave V3 aTokens automatically accrue interest through rebasing:
  • aToken balance increases over time
  • No need to claim rewards
  • strategyBalance() reflects current value including interest

Performance Characteristics

Gas Costs (approximate):
  • invest(): ~150k gas (Aave supply)
  • withdrawToVault(): ~200k gas (Aave withdraw + transfer)
  • harvest(): ~250k gas (withdraw + transfer)
  • strategyBalance(): ~30k gas (view function)
Yield:
  • Depends on Aave V3 supply APY for the asset
  • Typically 1-5% for stablecoins
  • Variable based on utilization
Risk:
  • Smart contract risk (Aave V3)
  • No liquidation risk (no borrowing)
  • No impermanent loss (single asset)

Error Handling

Security Considerations

  1. Unlimited Approval: Strategy approves pool for type(uint256).max in constructor. Safe for Aave but consider if pool is compromised.
  2. Router Trust: Only router can call invest/withdraw/harvest. Router must be secure.
  3. Aave Risk: Relies on Aave V3 security. Pool pause could temporarily lock funds.
  4. Reentrancy: Uses SafeERC20 which includes reentrancy protection.

Monitoring & Maintenance

See Also