Skip to main content

AaveStrategy

AaveStrategy

referralCode

uint16 referralCode

incentivesController

contract IAaveIncentivesController incentivesController

stkAave

contract IAaveStakedToken stkAave

constructor

constructor(struct InitializableAbstractStrategy.BaseStrategyConfig _stratConfig) public

Parameters

NameTypeDescription
_stratConfigstruct InitializableAbstractStrategy.BaseStrategyConfigThe platform and OToken vault addresses

initialize

function initialize(address[] _rewardTokenAddresses, address[] _assets, address[] _pTokens, address _incentivesAddress, address _stkAaveAddress) external

Initializer for setting up strategy internal state. This overrides the InitializableAbstractStrategy initializer as AAVE needs several extra addresses for the rewards program.

Parameters

NameTypeDescription
_rewardTokenAddressesaddress[]Address of the AAVE token
_assetsaddress[]Addresses of supported assets
_pTokensaddress[]Platform Token corresponding addresses
_incentivesAddressaddressAddress of the AAVE incentives controller
_stkAaveAddressaddressAddress of the stkAave contract

deposit

function deposit(address _asset, uint256 _amount) external

Deposit asset into Aave

Parameters

NameTypeDescription
_assetaddressAddress of asset to deposit
_amountuint256Amount of asset to deposit

_deposit

function _deposit(address _asset, uint256 _amount) internal

Deposit asset into Aave

Parameters

NameTypeDescription
_assetaddressAddress of asset to deposit
_amountuint256Amount of asset to deposit

depositAll

function depositAll() external

Deposit the entire balance of any supported asset into Aave

withdraw

function withdraw(address _recipient, address _asset, uint256 _amount) external

Withdraw asset from Aave

Parameters

NameTypeDescription
_recipientaddressAddress to receive withdrawn asset
_assetaddressAddress of asset to withdraw
_amountuint256Amount of asset to withdraw

withdrawAll

function withdrawAll() external

Remove all assets from platform and send them to Vault contract.

checkBalance

function checkBalance(address _asset) external view returns (uint256 balance)

Get the total asset value held in the platform

Parameters

NameTypeDescription
_assetaddressAddress of the asset

Return Values

NameTypeDescription
balanceuint256Total value of the asset in the platform

supportsAsset

function supportsAsset(address _asset) public view returns (bool)

Returns bool indicating whether asset is supported by strategy

Parameters

NameTypeDescription
_assetaddressAddress of the asset

safeApproveAllTokens

function safeApproveAllTokens() external

Approve the spending of all assets by their corresponding aToken, if for some reason is it necessary.

_abstractSetPToken

function _abstractSetPToken(address _asset, address _aToken) internal

Internal method to respond to the addition of new asset / aTokens We need to give the AAVE lending pool approval to transfer the asset.

Parameters

NameTypeDescription
_assetaddressAddress of the asset to approve
_aTokenaddressAddress of the aToken

_getATokenFor

function _getATokenFor(address _asset) internal view returns (address)

Get the aToken wrapped in the IERC20 interface for this asset. Fails if the pToken doesn't exist in our mappings.

Parameters

NameTypeDescription
_assetaddressAddress of the asset

Return Values

NameTypeDescription
[0]addressCorresponding aToken to this asset

_getLendingPool

function _getLendingPool() internal view returns (contract IAaveLendingPool)

Get the current address of the Aave lending pool, which is the gateway to depositing.

Return Values

NameTypeDescription
[0]contract IAaveLendingPoolCurrent lending pool implementation

collectRewardTokens

function collectRewardTokens() external

Collect stkAave, convert it to AAVE send to Vault.