Skip to main content

ILendingPoolAddressesProvider

ILendingPool

Functions

deposit

function deposit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external

Deposits an amount of underlying asset into the reserve, receiving in return overlying aTokens.

  • E.g. User deposits 100 USDC and gets in return 100 aUSDC

Parameters

NameTypeDescription
assetaddressThe address of the underlying asset to deposit
amountuint256The amount to be deposited
onBehalfOfaddressThe address that will receive the aTokens, same as msg.sender if the user

wants to receive them on his own wallet, or a different address if the beneficiary of aTokens is a different wallet | | referralCode | uint16 | Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man |

withdraw

function withdraw(
address asset,
uint256 amount,
address to
) external returns (uint256)

Withdraws an amount of underlying asset from the reserve, burning the equivalent aTokens owned E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC

Parameters

NameTypeDescription
assetaddressThe address of the underlying asset to withdraw
amountuint256The underlying amount to be withdrawn
- Send the value type(uint256).max in order to withdraw the whole aToken balance
toaddressAddress that will receive the underlying, same as msg.sender if the user

wants to receive it on his own wallet, or a different address if the beneficiary is a different wallet |

Return Values

NameTypeDescription
[0]uint256The final amount withdrawn

borrow

function borrow(
address asset,
uint256 amount,
uint256 interestRateMode,
uint16 referralCode,
address onBehalfOf
) external

Allows users to borrow a specific amount of the reserve underlying asset, provided that the borrower already deposited enough collateral, or he was given enough allowance by a credit delegator on the corresponding debt token (StableDebtToken or VariableDebtToken)

  • E.g. User borrows 100 USDC passing as onBehalfOf his own address, receiving the 100 USDC in his wallet and 100 stable/variable debt tokens, depending on the interestRateMode

Parameters

NameTypeDescription
assetaddressThe address of the underlying asset to borrow
amountuint256The amount to be borrowed
interestRateModeuint256The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
referralCodeuint16Code used to register the integrator originating the operation, for potential rewards.
0 if the action is executed directly by the user, without any middle-man
onBehalfOfaddressAddress of the user who will receive the debt. Should be the address of the borrower itself

calling the function if he wants to borrow against his own collateral, or the address of the credit delegator if he has been given credit delegation allowance |

repay

function repay(
address asset,
uint256 amount,
uint256 rateMode,
address onBehalfOf
) external returns (uint256)

Repays a borrowed amount on a specific reserve, burning the equivalent debt tokens owned

  • E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the onBehalfOf address

Parameters

NameTypeDescription
assetaddressThe address of the borrowed underlying asset previously borrowed
amountuint256The amount to repay
- Send the value type(uint256).max in order to repay the whole debt for asset on the specific debtMode
rateModeuint256The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
onBehalfOfaddressAddress of the user who will get his debt reduced/removed. Should be the address of the

user calling the function if he wants to reduce/remove his own debt, or the address of any other other borrower whose debt should be removed |

Return Values

NameTypeDescription
[0]uint256The final amount repaid

swapBorrowRateMode

function swapBorrowRateMode(
address asset,
uint256 rateMode
) external

Allows a borrower to swap his debt between stable and variable mode, or viceversa

Parameters

NameTypeDescription
assetaddressThe address of the underlying asset borrowed
rateModeuint256The rate mode that the user wants to swap to

rebalanceStableBorrowRate

function rebalanceStableBorrowRate(
address asset,
address user
) external

Rebalances the stable interest rate of a user to the current stable rate defined on the reserve.

  • Users can be rebalanced if the following conditions are satisfied:
    1. Usage ratio is above 95%
    2. the current deposit APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too much has been borrowed at a stable rate and depositors are not earning enough

Parameters

NameTypeDescription
assetaddressThe address of the underlying asset borrowed
useraddressThe address of the user to be rebalanced

setUserUseReserveAsCollateral

function setUserUseReserveAsCollateral(
address asset,
bool useAsCollateral
) external

Allows depositors to enable/disable a specific deposited asset as collateral

Parameters

NameTypeDescription
assetaddressThe address of the underlying asset deposited
useAsCollateralbooltrue if the user wants to use the deposit as collateral, false otherwise

liquidationCall

function liquidationCall(
address collateralAsset,
address debtAsset,
address user,
uint256 debtToCover,
bool receiveAToken
) external

Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1

  • The caller (liquidator) covers debtToCover amount of debt of the user getting liquidated, and receives a proportionally amount of the collateralAsset plus a bonus to cover market risk

Parameters

NameTypeDescription
collateralAssetaddressThe address of the underlying asset used as collateral, to receive as result of the liquidation
debtAssetaddressThe address of the underlying borrowed asset to be repaid with the liquidation
useraddressThe address of the borrower getting liquidated
debtToCoveruint256The debt amount of borrowed asset the liquidator wants to cover
receiveATokenbooltrue if the liquidators wants to receive the collateral aTokens, false if he wants
to receive the underlying collateral asset directly

flashLoan

function flashLoan(
address receiverAddress,
address[] assets,
uint256[] amounts,
uint256[] modes,
address onBehalfOf,
bytes params,
uint16 referralCode
) external

Allows smartcontracts to access the liquidity of the pool within one transaction, as long as the amount taken plus a fee is returned. IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration. For further details please visit https://developers.aave.com

Parameters

NameTypeDescription
receiverAddressaddressThe address of the contract receiving the funds, implementing the IFlashLoanReceiver interface
assetsaddress[]The addresses of the assets being flash-borrowed
amountsuint256[]The amounts amounts being flash-borrowed
modesuint256[]Types of the debt to open if the flash loan is not returned:

0 -> Don't open any debt, just revert if funds can't be transferred from the receiver 1 -> Open debt at stable rate for the value of the amount flash-borrowed to the onBehalfOf address 2 -> Open debt at variable rate for the value of the amount flash-borrowed to the onBehalfOf address | | onBehalfOf | address | The address that will receive the debt in the case of using on modes 1 or 2 | | params | bytes | Variadic packed params to pass to the receiver as extra information | | referralCode | uint16 | Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man |

getUserAccountData

function getUserAccountData(
address user
) external returns (uint256 totalCollateralETH, uint256 totalDebtETH, uint256 availableBorrowsETH, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor)

Returns the user account data across all the reserves

Parameters

NameTypeDescription
useraddressThe address of the user

Return Values

NameTypeDescription
totalCollateralETHuint256the total collateral in ETH of the user
totalDebtETHuint256the total debt in ETH of the user
availableBorrowsETHuint256the borrowing power left of the user
currentLiquidationThresholduint256the liquidation threshold of the user
ltvuint256the loan to value of the user
healthFactoruint256the current health factor of the user

initReserve

function initReserve(
address reserve,
address aTokenAddress,
address stableDebtAddress,
address variableDebtAddress,
address interestRateStrategyAddress
) external

Parameters

NameTypeDescription
reserveaddress
aTokenAddressaddress
stableDebtAddressaddress
variableDebtAddressaddress
interestRateStrategyAddressaddress

setReserveInterestRateStrategyAddress

function setReserveInterestRateStrategyAddress(
address reserve,
address rateStrategyAddress
) external

Parameters

NameTypeDescription
reserveaddress
rateStrategyAddressaddress

setConfiguration

function setConfiguration(
address reserve,
uint256 configuration
) external

Parameters

NameTypeDescription
reserveaddress
configurationuint256

getConfiguration

function getConfiguration(
address asset
) external returns (struct DataTypes.ReserveConfigurationMap)

Returns the configuration of the reserve

Parameters

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values

NameTypeDescription
[0]struct DataTypes.ReserveConfigurationMapThe configuration of the reserve

getReserveData

function getReserveData(
address asset
) external returns (struct DataTypes.ReserveData)

Returns the state and configuration of the reserve

Parameters

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values

NameTypeDescription
[0]struct DataTypes.ReserveDataThe state of the reserve

getReserveNormalizedIncome

function getReserveNormalizedIncome(
address asset
) external returns (uint256)

Returns the normalized income normalized income of the reserve

Parameters

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values

NameTypeDescription
[0]uint256The reserve's normalized income

getReserveNormalizedVariableDebt

function getReserveNormalizedVariableDebt(
address asset
) external returns (uint256)

Returns the normalized variable debt per unit of asset

Parameters

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values

NameTypeDescription
[0]uint256The reserve normalized variable debt

finalizeTransfer

function finalizeTransfer(
address asset,
address from,
address to,
uint256 amount,
uint256 balanceFromAfter,
uint256 balanceToBefore
) external

Parameters

NameTypeDescription
assetaddress
fromaddress
toaddress
amountuint256
balanceFromAfteruint256
balanceToBeforeuint256

getReservesList

function getReservesList() external returns (address[])

getAddressesProvider

function getAddressesProvider() external returns (contract ILendingPoolAddressesProvider)

setPause

function setPause(
bool val
) external

Parameters

NameTypeDescription
valbool

paused

function paused() external returns (bool)

Events

Deposit

event Deposit(
address reserve,
address user,
address onBehalfOf,
uint256 amount,
uint16 referral
)

Emitted on deposit()

Parameters

NameTypeDescription
reserveaddressThe address of the underlying asset of the reserve
useraddressThe address initiating the deposit
onBehalfOfaddressThe beneficiary of the deposit, receiving the aTokens
amountuint256The amount deposited
referraluint16The referral code used

Withdraw

event Withdraw(
address reserve,
address user,
address to,
uint256 amount
)

Emitted on withdraw()

Parameters

NameTypeDescription
reserveaddressThe address of the underlyng asset being withdrawn
useraddressThe address initiating the withdrawal, owner of aTokens
toaddressAddress that will receive the underlying
amountuint256The amount to be withdrawn

Borrow

event Borrow(
address reserve,
address user,
address onBehalfOf,
uint256 amount,
uint256 borrowRateMode,
uint256 borrowRate,
uint16 referral
)

Emitted on borrow() and flashLoan() when debt needs to be opened

Parameters

NameTypeDescription
reserveaddressThe address of the underlying asset being borrowed
useraddressThe address of the user initiating the borrow(), receiving the funds on borrow() or just
initiator of the transaction on flashLoan()
onBehalfOfaddressThe address that will be getting the debt
amountuint256The amount borrowed out
borrowRateModeuint256The rate mode: 1 for Stable, 2 for Variable
borrowRateuint256The numeric rate at which the user has borrowed
referraluint16The referral code used

Repay

event Repay(
address reserve,
address user,
address repayer,
uint256 amount
)

Emitted on repay()

Parameters

NameTypeDescription
reserveaddressThe address of the underlying asset of the reserve
useraddressThe beneficiary of the repayment, getting his debt reduced
repayeraddressThe address of the user initiating the repay(), providing the funds
amountuint256The amount repaid

Swap

event Swap(
address reserve,
address user,
uint256 rateMode
)

Emitted on swapBorrowRateMode()

Parameters

NameTypeDescription
reserveaddressThe address of the underlying asset of the reserve
useraddressThe address of the user swapping his rate mode
rateModeuint256The rate mode that the user wants to swap to

ReserveUsedAsCollateralEnabled

event ReserveUsedAsCollateralEnabled(
address reserve,
address user
)

Emitted on setUserUseReserveAsCollateral()

Parameters

NameTypeDescription
reserveaddressThe address of the underlying asset of the reserve
useraddressThe address of the user enabling the usage as collateral

ReserveUsedAsCollateralDisabled

event ReserveUsedAsCollateralDisabled(
address reserve,
address user
)

Emitted on setUserUseReserveAsCollateral()

Parameters

NameTypeDescription
reserveaddressThe address of the underlying asset of the reserve
useraddressThe address of the user enabling the usage as collateral

RebalanceStableBorrowRate

event RebalanceStableBorrowRate(
address reserve,
address user
)

Emitted on rebalanceStableBorrowRate()

Parameters

NameTypeDescription
reserveaddressThe address of the underlying asset of the reserve
useraddressThe address of the user for which the rebalance has been executed

FlashLoan

event FlashLoan(
address target,
address initiator,
address asset,
uint256 amount,
uint256 premium,
uint16 referralCode
)

Emitted on flashLoan()

Parameters

NameTypeDescription
targetaddressThe address of the flash loan receiver contract
initiatoraddressThe address initiating the flash loan
assetaddressThe address of the asset being flash borrowed
amountuint256The amount flash borrowed
premiumuint256The fee flash borrowed
referralCodeuint16The referral code used

Paused

event Paused(
)

Emitted when the pause is triggered.

Unpaused

event Unpaused(
)

Emitted when the pause is lifted.

LiquidationCall

event LiquidationCall(
address collateralAsset,
address debtAsset,
address user,
uint256 debtToCover,
uint256 liquidatedCollateralAmount,
address liquidator,
bool receiveAToken
)

Emitted when a borrower is liquidated. This event is emitted by the LendingPool via LendingPoolCollateral manager using a DELEGATECALL This allows to have the events in the generated ABI for LendingPool.

Parameters

NameTypeDescription
collateralAssetaddressThe address of the underlying asset used as collateral, to receive as result of the liquidation
debtAssetaddressThe address of the underlying borrowed asset to be repaid with the liquidation
useraddressThe address of the borrower getting liquidated
debtToCoveruint256The debt amount of borrowed asset the liquidator wants to cover
liquidatedCollateralAmountuint256The amount of collateral received by the liiquidator
liquidatoraddressThe address of the liquidator
receiveATokenbooltrue if the liquidators wants to receive the collateral aTokens, false if he wants
to receive the underlying collateral asset directly

ReserveDataUpdated

event ReserveDataUpdated(
address reserve,
uint256 liquidityRate,
uint256 stableBorrowRate,
uint256 variableBorrowRate,
uint256 liquidityIndex,
uint256 variableBorrowIndex
)

Emitted when the state of a reserve is updated. NOTE: This event is actually declared in the ReserveLogic library and emitted in the updateInterestRates() function. Since the function is internal, the event will actually be fired by the LendingPool contract. The event is therefore replicated here so it gets added to the LendingPool ABI

Parameters

NameTypeDescription
reserveaddressThe address of the underlying asset of the reserve
liquidityRateuint256The new liquidity rate
stableBorrowRateuint256The new stable borrow rate
variableBorrowRateuint256The new variable borrow rate
liquidityIndexuint256The new liquidity index
variableBorrowIndexuint256The new variable borrow index