Overview
TheStrategyAaveV3 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
- Approves pool to spend unlimited tokens (gas optimization)
- Sets all immutable references
IStrategy Interface Implementation
invest
uint256
required
Amount of assets to invest (must already be transferred to strategy)
- Only callable by router
- Strategy must already hold the tokens (via
vault.moveToStrategy())
- Calls
pool.supply()to deposit tokens into Aave - Receives aTokens (interest-bearing tokens) in return
- Updates
depositedprincipal tracker
withdrawToVault
uint256
required
Amount of underlying assets to withdraw
uint256
Actual amount withdrawn and sent to vault
- Calls
pool.withdraw()to redeem aTokens for underlying - Transfers underlying tokens to vault
- Updates
depositedtracker
harvest
- Queries current aToken balance (includes accrued interest)
- Calculates profit:
aBal - deposited - Withdraws profit from Aave
- Transfers profit to vault
- Keeps principal deposited
strategyBalance
uint256
Total underlying value (principal + accrued interest)
pool.getUnderlyingValue() to query Aave for current position value.
deleverageAll
uint256
Ignored (no leverage to unwind)
View Functions
estimateAPY
uint256
Estimated APY scaled by 1e18 (1e18 = 100% APY)
(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)
- Depends on Aave V3 supply APY for the asset
- Typically 1-5% for stablecoins
- Variable based on utilization
- Smart contract risk (Aave V3)
- No liquidation risk (no borrowing)
- No impermanent loss (single asset)
Error Handling
Security Considerations
- Unlimited Approval: Strategy approves pool for
type(uint256).maxin constructor. Safe for Aave but consider if pool is compromised. - Router Trust: Only router can call invest/withdraw/harvest. Router must be secure.
- Aave Risk: Relies on Aave V3 security. Pool pause could temporarily lock funds.
- Reentrancy: Uses SafeERC20 which includes reentrancy protection.
Monitoring & Maintenance
See Also
- StrategyRouter - Controls this strategy
- Vault - Receives profits
- StrategyAaveLeverage - Leveraged version
- Aave V3 Documentation - Aave integration details