Skip to main content

AaveV3Lender

AaveV3Lender​

POOL​

contract IPool POOL

The AAVE pool retrieved from the pool provider.

ADDRESS_PROVIDER​

contract IPoolAddressesProvider ADDRESS_PROVIDER

The AAVE pool address provider.

constructor​

constructor(address addressesProvider) public

contract's constructor

Parameters​

NameTypeDescription
addressesProvideraddressaddress of AAVE's address provider

_approveLender​

function _approveLender(contract IERC20 token, uint256 amount) internal

allows this contract to approve the POOL to transfer some underlying asset on its behalf

this is a necessary step prior to supplying tokens to the POOL or to repay a debt

Parameters​

NameTypeDescription
tokencontract IERC20the underlying asset for which approval is required
amountuint256the approval amount

_exitMarket​

function _exitMarket(contract IERC20 underlying) internal

prevents the POOL from using some underlying as collateral

this call will revert if removing the asset from collateral would put the account into a liquidation state

Parameters​

NameTypeDescription
underlyingcontract IERC20the token one wishes to remove collateral

_enterMarkets​

function _enterMarkets(contract IERC20[] underlyings) internal

allows the POOL to use some underlying tokens as collateral

when supplying a token for the first time, it is automatically set as possible collateral so there is no need to call this function for it.

Parameters​

NameTypeDescription
underlyingscontract IERC20[]the token one wishes to add as collateral

overlying​

function overlying(contract IERC20 asset) public view returns (contract IERC20 aToken)

convenience function to obtain the overlying of a given asset

Parameters​

NameTypeDescription
assetcontract IERC20the underlying asset

Return Values​

NameTypeDescription
aTokencontract IERC20the overlying asset

_redeem​

function _redeem(contract IERC20 token, uint256 amount, address to) internal returns (uint256 redeemed)

redeems funds from the pool

Parameters​

NameTypeDescription
tokencontract IERC20the asset one is trying to redeem
amountuint256of assets one wishes to redeem
toaddressis the address where the redeemed assets should be transferred

Return Values​

NameTypeDescription
redeemeduint256the amount of asset that were transferred to to

_supply​

function _supply(contract IERC20 token, uint256 amount, address onBehalf, bool noRevert) internal returns (bytes32)

supplies funds to the pool

Parameters​

NameTypeDescription
tokencontract IERC20the asset one is supplying
amountuint256of assets to be transferred to the pool
onBehalfaddressaddress of the account whose collateral is being supplied to and which will receive the overlying
noRevertbooldoes not revert if supplies throws

Return Values​

NameTypeDescription
[0]bytes32reason for revert from Aave.

_claimRewards​

function _claimRewards(address[] assets, address to) internal returns (address[] rewardsList, uint256[] claimedAmounts)

rewards claiming.

Parameters​

NameTypeDescription
assetsaddress[]list of overlying for which one is claiming awards
toaddresswhom the rewards should be sent

Return Values​

NameTypeDescription
rewardsListaddress[]the address of assets that have been claimed
claimedAmountsuint256[]the amount of assets that have been claimed

checkAsset​

function checkAsset(contract IERC20 asset) public view returns (bool)

verifies whether an asset can be supplied on pool

Parameters​

NameTypeDescription
assetcontract IERC20the asset one wants to lend

Return Values​

NameTypeDescription
[0]booltrue if the asset can be supplied on pool