IAaveV3Adapter
Title: IAaveV3Adapter
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from Aave V3 (https://github.com/aave-dao/aave-v3-origin)
Aave-v3-specific configuration ABI for the Lattice Aave adapter. The adapter also
implements IStrategy (asset/totalAssetsManaged/withdraw) and IProtocolAdapter
(deploy/harvest/emergencyWithdraw/health views).
Errors generic to all adapters live in IProtocolAdapter; only Aave-specific config
errors/events live here.
Functions
addressesProvider
Returns the Aave PoolAddressesProvider this adapter resolves the Pool from.
function addressesProvider() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
aToken
Returns the live aToken for the configured asset (resolved via the provider).
function aToken() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
vault
Returns the vault this adapter returns withdrawn funds to.
function vault() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
eModeCategory
Returns the current eMode category id set on the Pool for this adapter.
function eModeCategory() external view returns (uint8);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint8 |
rewardsController
Returns the configured Aave rewards controller (address(0) if unset).
function rewardsController() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
setEMode
Sets the Aave eMode category (admin only). Used to enable correlated-asset looping.
function setEMode(uint8 categoryId) external;Parameters
| Name | Type | Description |
|---|---|---|
| categoryId | uint8 |
setMinHealthFactor
Sets the minimum health-factor floor in WAD (admin only). Must be >= 1e18.
function setMinHealthFactor(uint256 minHealthFactorWad) external;Parameters
| Name | Type | Description |
|---|---|---|
| minHealthFactorWad | uint256 |
setRewardRecipient
Sets the reward recipient (admin only).
function setRewardRecipient(address recipient) external;Parameters
| Name | Type | Description |
|---|---|---|
| recipient | address |
setRewardsController
Sets the Aave rewards controller (admin only).
function setRewardsController(address controller) external;Parameters
| Name | Type | Description |
|---|---|---|
| controller | address |
lever
Borrows borrowAmount of the asset and re-supplies it, increasing leverage.
Reverts ProtocolAdapterHealthFactorBreached if the resulting HF < the floor.
function lever(uint256 borrowAmount) external;Parameters
| Name | Type | Description |
|---|---|---|
| borrowAmount | uint256 |
delever
Withdraws collateralToPull of the asset from supply and repays that much debt,
decreasing leverage and restoring HF.
function delever(uint256 collateralToPull) external returns (uint256 repaid);Parameters
| Name | Type | Description |
|---|---|---|
| collateralToPull | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| repaid | uint256 | The amount of debt repaid. |
Events
AaveV3AdapterConfigured
Emitted once at init with the immutable-ish wiring (provider, asset, vault).
event AaveV3AdapterConfigured(address indexed provider, address indexed asset, address indexed vault);Parameters
| Name | Type | Description |
|---|---|---|
| provider | address | |
| asset | address | |
| vault | address |
EModeSet
Emitted when the eMode category is changed.
event EModeSet(uint8 categoryId);Parameters
| Name | Type | Description |
|---|---|---|
| categoryId | uint8 |
MinHealthFactorSet
Emitted when the minimum health factor floor is changed.
event MinHealthFactorSet(uint256 minHealthFactorWad);Parameters
| Name | Type | Description |
|---|---|---|
| minHealthFactorWad | uint256 |
Levered
Emitted after a lever op (borrow asset then re-supply it).
event Levered(uint256 borrowed);Parameters
| Name | Type | Description |
|---|---|---|
| borrowed | uint256 |
Delevered
Emitted after a delever op (withdraw collateral then repay debt).
event Delevered(uint256 repaid);Parameters
| Name | Type | Description |
|---|---|---|
| repaid | uint256 |
RewardsControllerSet
Emitted when the Aave rewards controller is set.
event RewardsControllerSet(address indexed controller);Parameters
| Name | Type | Description |
|---|---|---|
| controller | address |
Errors
AaveV3AdapterReserveNotListed
The configured asset's reserve has no aToken (asset not listed on Aave).
error AaveV3AdapterReserveNotListed(address asset);Parameters
| Name | Type | Description |
|---|---|---|
| asset | address |
AaveV3AdapterInvalidMinHealthFactor
A min-health-factor below 1e18 (== 1.0) was supplied; that permits instant liquidation.
error AaveV3AdapterInvalidMinHealthFactor(uint256 supplied);Parameters
| Name | Type | Description |
|---|---|---|
| supplied | uint256 |
AaveV3AdapterZeroLeverAmount
A lever amount of zero was requested.
error AaveV3AdapterZeroLeverAmount();