Skip to content
Lattice

IAaveV3Adapter

Git Source

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

NameTypeDescription
<none>address

aToken

Returns the live aToken for the configured asset (resolved via the provider).

function aToken() external view returns (address);

Returns

NameTypeDescription
<none>address

vault

Returns the vault this adapter returns withdrawn funds to.

function vault() external view returns (address);

Returns

NameTypeDescription
<none>address

eModeCategory

Returns the current eMode category id set on the Pool for this adapter.

function eModeCategory() external view returns (uint8);

Returns

NameTypeDescription
<none>uint8

rewardsController

Returns the configured Aave rewards controller (address(0) if unset).

function rewardsController() external view returns (address);

Returns

NameTypeDescription
<none>address

setEMode

Sets the Aave eMode category (admin only). Used to enable correlated-asset looping.

function setEMode(uint8 categoryId) external;

Parameters

NameTypeDescription
categoryIduint8

setMinHealthFactor

Sets the minimum health-factor floor in WAD (admin only). Must be >= 1e18.

function setMinHealthFactor(uint256 minHealthFactorWad) external;

Parameters

NameTypeDescription
minHealthFactorWaduint256

setRewardRecipient

Sets the reward recipient (admin only).

function setRewardRecipient(address recipient) external;

Parameters

NameTypeDescription
recipientaddress

setRewardsController

Sets the Aave rewards controller (admin only).

function setRewardsController(address controller) external;

Parameters

NameTypeDescription
controlleraddress

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

NameTypeDescription
borrowAmountuint256

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

NameTypeDescription
collateralToPulluint256

Returns

NameTypeDescription
repaiduint256The 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

NameTypeDescription
provideraddress
assetaddress
vaultaddress

EModeSet

Emitted when the eMode category is changed.

event EModeSet(uint8 categoryId);

Parameters

NameTypeDescription
categoryIduint8

MinHealthFactorSet

Emitted when the minimum health factor floor is changed.

event MinHealthFactorSet(uint256 minHealthFactorWad);

Parameters

NameTypeDescription
minHealthFactorWaduint256

Levered

Emitted after a lever op (borrow asset then re-supply it).

event Levered(uint256 borrowed);

Parameters

NameTypeDescription
borroweduint256

Delevered

Emitted after a delever op (withdraw collateral then repay debt).

event Delevered(uint256 repaid);

Parameters

NameTypeDescription
repaiduint256

RewardsControllerSet

Emitted when the Aave rewards controller is set.

event RewardsControllerSet(address indexed controller);

Parameters

NameTypeDescription
controlleraddress

Errors

AaveV3AdapterReserveNotListed

The configured asset's reserve has no aToken (asset not listed on Aave).

error AaveV3AdapterReserveNotListed(address asset);

Parameters

NameTypeDescription
assetaddress

AaveV3AdapterInvalidMinHealthFactor

A min-health-factor below 1e18 (== 1.0) was supplied; that permits instant liquidation.

error AaveV3AdapterInvalidMinHealthFactor(uint256 supplied);

Parameters

NameTypeDescription
supplieduint256

AaveV3AdapterZeroLeverAmount

A lever amount of zero was requested.

error AaveV3AdapterZeroLeverAmount();