View Contracts

The Aave Protocol has several view contracts to assist with querying onchain data.

UiPoolDataProvider

Contract that returns an array of all reserve or user data for a particular market (for example, liquidity, token addresses, rate strategy), used by the Aave Interface to display Markets and Dashboard data. Compatible with both V2 and V3 of the Aave Protocol.

The Aave Utilities SDK includes an interface to make calls to this contract, and functions to format the response for frontend use-cases.

The source code is available on GitHub.

View Methods

getReservesList

function getReservesList(IPoolAddressesProvider provider) public view override returns (address[] memory)

Returns the list of initialised reserves in the Pool associated with the given provider.

Input Parameters:

NameTypeDescription
providerIPoolAddressesProviderThe given provider for the associated pool

Return Values:

TypeDescription
address[]The list of initialised reserves in the Pool

getReservesData

function getReservesData(IPoolAddressesProvider provider) public view override returns (AggregatedReserveData[] memory, BaseCurrencyInfo memory)

Returns BaseCurrencyInfo of the Pool and AggregatedReserveData[] for all the initialised reserves in the Pool associated with the given provider.

Input Parameters:

NameTypeDescription
providerIPoolAddressesProviderThe given provider for the associated pool

Return Values:

TypeDescription
BaseCurrencyInfoThe base currency information
AggregatedReserveData[]The aggregated reserve data

The BaseCurrencyInfo struct is composed of the following fields:

NameTypeDescription
marketReferenceCurrencyUnituint256Reference aka base currency of the Aave market
marketReferenceCurrencyPriceInUsdint256Price of reference aka base currency in USD
networkBaseTokenPriceInUsdint256Price of native token of the network/chain in USD
networkBaseTokenPriceDecimalsuint8Decimals of native token of the network/chain

The AggregatedReserveData struct is composed of the following fields:

NameTypeDescription
underlyingAssetaddressThe address of the underlying asset of the reserve
namestringThe name of the underlying reserve asset
symbolstringThe symbol of the underlying reserve asset
decimalsuint256The number of decimals of the reserve
baseLTVasCollateraluint256The ltv of the reserve
reserveLiquidationThresholduint256The liquidation threshold of the reserve
reserveLiquidationBonusuint256The liquidation bonus of the resurve
reserveFactoruint256The reserve factor of the reserve
usageAsCollateralEnabledbooltrue if the asset is enabled to be used as collateral, false otherwise
borrowingEnabledbooltrue if borrowing is enabled, false otherwise
isActivebooltrue if reserve is active, false otherwise
isFrozenbooltrue if reserve is frozen, false otherwise
BASE DATA
liquidityIndexuint128The liquidity index of the reserve
variableBorrowIndexuint128The variable borrow index of the reserve
liquidityRateuint128The liquidity rate of the reserve
variableBorrowRateuint128The variable borrow rate of the reserve
lastUpdateTimestampuint40The timestamp of the last update of the reserve
aTokenAddressaddressThe AToken address of the reserve
variableDebtTokenAddressaddressThe VariableDebtToken address of the reserve
interestRateStrategyAddressaddressThe address of the Interest Rate strategy
availableLiquidityuint256The liquidity available
totalScaledVariableDebtuint256The total scaled variable debt
priceInMarketReferenceCurrencyuint256Price of reference aka base currency of Aave market
priceOracleaddressThe address of the price oracle used by the associated market
variableRateSlope1uint256The variable rate slope
variableRateSlope2uint256The variable rate slope
baseVariableBorrowRateuint256The base variable borrow rate, expressed in ray
optimalUsageRatiouint256The optimal usage ratio
V3 ONLY
isPausedbooltrue if the pool is paused, false otherwise
isSiloedBorrowingbooltrue if the asset is siloed for borrowing
accruedToTreasuryuint128The amount of tokens accrued to treasury that is to be minted
unbackeduint128The amount of unbacked aTokens of the reserve
isolationModeTotalDebtuint128The outstanding debt borrowed against this asset in isolation mode
flashLoanEnabledbooltrue is asset is available to borrow in flash loan transaction
debtCeilinguint256The debt ceiling of the reserve
debtCeilingDecimalsuint256The debt ceiling decimals
eModeCategoryIduint8The eMode id of the reserve
borrowCapuint256The borrow cap of the reserve
supplyCapuint256The supply cap of the reserve
borrowableInIsolationbooltrue is asset available to borrow against isolated collateral assets
v3.1
virtualAccActivebooltrue if virtual accounting is enabled for a reserve
virtualUnderlyingBalanceuint128Balance of reserve if virtual accounting is used

getUserReservesData

function getUserReservesData(IPoolAddressesProvider provider, address user) external view override returns (UserReserveData[] memory, uint8)

Returns UserReserveData[] for all user reserves in the Pool associated with the given provider.

Input Parameters:

NameTypeDescription
providerIPoolAddressesProviderThe given provider for the associated pool
useraddressThe address of the user

UserReserveData

TypeDescription
UserReserveData[]The user reserve data

The UserReserveData struct is composed of the following fields:

NameTypeDescription
underlyingAssetaddressThe address of the underlying asset supplied/borrowed
scaledATokenBalanceuint256The scaled balance of the aToken. scaledBalance = balance/liquidityIndex
usageAsCollateralEnabledOnUserbooltrue if the supplied asset is enabled to be used as collateral, false otherwise
scaledVariableDebtuint256The scaled balance of borrow position: (current balance = scaled balance * liquidity index)

getEModes

Returns an array of all available E-mode categories in the Pool associated with the provider.

function getEModes(IPoolAddressesProvider provider) external view returns (Emode[] memory)

Input Parameters:

NameTypeDescription
providerIPoolAddressesProviderThe PoolAddressesProvider for the associated Pool to fetch EMode categories for

Return Parameters:

NameTypeDescription
categoriesEmode[]The list of E-Modes available in the pool

Emode

The Emode struct is composed of the following fields:

NameTypeDescription
iduint8The unique identifier of the E-Mode
eModeDataTypes.EModeCategoryThe E-Mode configuration details

DataTypes.EModeCategory

The EModeCategory struct is composed of the following fields:

NameTypeDescription
ltvuint16Loan-to-Value ratio for the E-Mode category
liquidationThresholduint16The threshold at which liquidation is triggered
liquidationBonusuint16The bonus applied during liquidation
collateralBitmapuint128Bitmap representing eligible collateral for this E-Mode
labelstringThe label describing the E-Mode category
borrowableBitmapuint128Bitmap representing borrowable assets for this E-Mode

WalletBalanceProvider

Fetches tokens balances for all underlying tokens of Aave reserves for one user address.

This contract is not used within the Aave Protocol. It is an accessory contract used to reduce the number of calls towards the blockchain from the Aave backend.

For getting ETH (native chain token) balance use MOCK_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE.

The source code is available on GitHub.

View Methods

balanceOf

function balanceOf(address user, address token) public view returns (uint256)

Checks the token balance of a wallet in a token contract. Returns the balance of the token for user (ETH included with MOCK_ETH_ADDRESS).

Input Parameters:

NameTypeDescription
useraddressThe address of the user
tokenaddressThe address of the token

Return Values:

TypeDescription
uint256The balance of the token for user. Returns 0 for a non-contract address

batchBalanceOf

function batchBalanceOf(address[] calldata users, address[] calldata tokens) external view returns (uint256[] memory)

Returns balances for a list of users and tokens (ETH included with MOCK_ETH_ADDRESS).

Input Parameters:

NameTypeDescription
usersaddress[]The list of users
tokensaddress[]The list of tokens

Return Values:

TypeDescription
uint256[]A list of balances for each user

getUserWalletBalances

function getUserWalletBalances(address provider, address user) external view returns (address[] memory, uint256[] memory)

Provides balances of user wallet for all reserves available on the pool.

Input Parameters:

NameTypeDescription
provideraddressThe address of the provider
useraddressThe address of the user

Return Values:

TypeDescription
address[]A list of user wallets
uint256[]A list of balances for each user

UiIncentiveDataProviderV3

Contract that returns an array of all reserve incentives or user claimable rewards within a particular market, used by the Aave Labs Interface to display incentives data. Compatible with both V2 and V3 of the Aave Protocol.

The Aave Utilities SDK includes an interface to make calls to this contract, and functions to format the response for frontend use-cases.

The source code is available on GitHub.

View Methods

getFullReservesIncentiveData

function getFullReservesIncentiveData(IPoolAddressesProvider provider, address user)    external    view    override    returns (AggregatedReserveIncentiveData[] memory, UserReserveIncentiveData[] memory)

Returns both AggregatedReserveIncentiveData[] and UserReserveIncentiveData[] for the given user for the pool associated with the given provider.

Input Parameters:

NameTypeDescription
providerIPoolAddressesProviderThe given provider for the associated pool
useraddressThe address of the user

Return Values:

TypeDescription
AggregatedReserveIncentiveData[]The aggregated reserve incentive data
UserReserveIncentiveData[]The user reserve incentive data

The AggregatedReserveIncentiveData struct is composed of the following fields:

NameTypeDescription
underlyingAssetaddressAddress of the asset supplied/borrowed in Pool
aIncentiveDataIncentiveDataDetails of rewards distributed for supplying to Aave Pool i.e. rewards for aToken holders
vIncentiveDataIncentiveDataDetails of rewards distributed for variable debt borrowed from Aave Pool i.e. rewards for vToken holders

The UserReserveIncentiveData struct is composed of the following fields:

NameTypeDescription
underlyingAssetaddressAddress of the asset supplied/borrowed in Pool
aTokenIncentivesUserDataUserIncentiveDataDetails of user rewards received for supplying to Aave Pool i.e. rewards for aToken
vTokenIncentivesUserDataUserIncentiveDataDetails of user rewards received for borrowing at variable rate from Aave Pool i.e. rewards for vToken

getReservesIncentivesData

function getReservesIncentivesData(IPoolAddressesProvider provider) external view override returns (AggregatedReserveIncentiveData[] memory)

Returns AggregatedReserveIncentiveData[] for the pool associated with the given provider.

Input Parameters:

NameTypeDescription
providerIPoolAddressesProviderThe given provider for the associated pool

Return Values:

TypeDescription
AggregatedReserveIncentiveData[]The aggregated reserve incentive data

The AggregatedReserveIncentiveData struct is composed of the following fields:

NameTypeDescription
underlyingAssetaddressAddress of the asset supplied/borrowed in Pool
aIncentiveDataIncentiveDataDetails of rewards distributed for supplying to Aave Pool i.e. rewards for aToken holders
vIncentiveDataIncentiveDataDetails of rewards distributed for variable debt borrowed from Aave Pool i.e. rewards for vToken holders

getUserReservesIncentivesData

function getUserReservesIncentivesData(IPoolAddressesProvider provider, address user) external view override returns (UserReserveIncentiveData[] memory)

Returns the UserReserveIncentiveData[] for the given user for the pool associated with the given provider.

Input Parameters:

NameTypeDescription
providerIPoolAddressesProviderThe given provider for the associated pool

Return Values:

TypeDescription
UserReserveIncentiveData[]The user reserve incentive data

The UserReserveIncentiveData struct is composed of the following fields:

NameTypeDescription
underlyingAssetaddressAddress of the asset supplied/borrowed in Pool
aTokenIncentivesUserDataUserIncentiveDataDetails of user rewards received for supplying to Aave Pool i.e. rewards for aToken
vTokenIncentivesUserDataUserIncentiveDataDetails of user rewards received for borrowing at variable rate from Aave Pool i.e. rewards for vToken

AaveProtocolDataProvider

The AaveProtocolDataProvider is a peripheral contract to collect and pre-process information from the Pool. This contract contains methods for querying token addresses, reserve parameters, and user account information. The methods of the PoolDataProvider are more granular than the UiPoolDataProvider, which queries data for reserve tokens or user balances simultaneously.

The source code is available on GitHub.

View Methods

getAllReservesTokens

function getAllReservesTokens() external view returns (TokenData[] memory)

Returns a list of the existing reserves in the pool, pairs include the symbol and tokenAddress. Handles MKR and ETH in a different way since they do not have standard symbol functions.

Return Values:

TypeDescription
TokenData[]The list of reserves, pairs of symbols and addresses

The TokenData struct is composed of the following fields:

NameTypeDescription
symbolstringThe symbol of the underlying reserve asset
tokenAddressaddressThe address of the underlying reserve asset

getAllATokens

function getAllATokens() external view returns (TokenData[] memory)

Returns a list of the existing ATokens in the pool, pairs include the symbol and tokenAddress.

Return Values:

TypeDescription
TokenData[]The list of ATokens, pairs of symbols and addresses

The TokenData struct is composed of the following fields:

NameTypeDescription
symbolstringThe symbol of aToken of the reserve
tokenAddressaddressThe address of aToken of the reserve

getReserveConfigurationData

function getReserveConfigurationData(address asset) external view returns (    uint256 decimals,    uint256 ltv,    uint256 liquidationThreshold,    uint256 liquidationBonus,    uint256 reserveFactor,    bool usageAsCollateralEnabled,    bool borrowingEnabled,    bool stableBorrowRateEnabled,    bool isActive,    bool isFrozen)

Returns the configuration data of the reserve as described below. Does not return borrow and supply caps, nor pause flag for compatibility.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

NameTypeDescription
decimalsuint256The number of decimals of the reserve
ltvuint256The ltv of the reserve
liquidationThresholduint256The liquidation threshold of the reserve
liquidationBonusuint256The liquidation bonus of the reserve
reserveFactoruint256The reserve factor of the reserve
usageAsCollateralEnabledbooltrue if the usage as collateral is enabled, false otherwise
borrowingEnabledbooltrue if borrowing is enabled, false otherwise
stableBorrowRateEnabledboolAlways false (deprecated)
isActivebooltrue if reserve is active, false otherwise
isFrozenbooltrue if reserve is frozen, false otherwise

getReserveCaps

function getReserveCaps(address asset) external view returns (uint256 borrowCap, uint256 supplyCap)

Returns the caps parameters of the reserve.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

NameTypeDescription
borrowCapuint256The borrow cap of the reserve
supplyCapuint256The supply cap of the reserve

getPaused

function getPaused(address asset) external view returns (bool isPaused)

Returns true if the pool isPaused.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

NameTypeDescription
isPausedbooltrue if the pool is paused, false otherwise

getSiloedBorrowing

function getSiloedBorrowing(address asset) external view override returns (bool)

Returns the siloed borrowing flag. It returns true if the asset is siloed for borrowing.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

TypeDescription
booltrue if the asset is siloed for borrowing

getLiquidationProtocolFee

function getLiquidationProtocolFee(address asset) external view override returns (uint256)

Returns the protocol fee on the liquidation bonus.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

TypeDescription
uint256The protocol fee on liquidation

getUnbackedMintCap

function getUnbackedMintCap(address asset) external view override returns (uint256)

Returns the unbacked mint cap of the reserve.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

TypeDescription
uint256The unbacked mint cap of the reserve

getDebtCeiling

function getDebtCeiling(address asset) external view override returns (uint256)

Returns the debt ceiling of the reserve.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

TypeDescription
uint256The debt ceiling of the reserve

getReserveData

function getReserveData(address asset) external view override returns (    uint256 unbacked,    uint256 accruedToTreasuryScaled,    uint256 totalAToken,    uint256 totalStableDebt,    uint256 totalVariableDebt,    uint256 liquidityRate,    uint256 variableBorrowRate,    uint256 stableBorrowRate,    uint256 averageStableBorrowRate,    uint256 liquidityIndex,    uint256 variableBorrowIndex,    uint40 lastUpdateTimestamp)

Returns the reserve data.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

NameTypeDescription
unbackeduint256The amount of unbacked aTokens of the reserve
accruedToTreasuryScaleduint256The scaled amount of tokens accrued to treasury that is to be minted
totalATokenuint256The total supply of the aToken
totalStableDebtuint256The total stable debt of the reserve (deprecated)
totalVariableDebtuint256The total variable debt of the reserve
liquidityRateuint256The liquidity rate of the reserve
variableBorrowRateuint256The variable borrow rate of the reserve
stableBorrowRateuint256The stable borrow rate of the reserve (deprecated)
averageStableBorrowRateuint256The average stable borrow rate of the reserve (deprecated)
liquidityIndexuint256The liquidity index of the reserve
variableBorrowIndexuint256The variable borrow index of the reserve
lastUpdateTimestampuint40The timestamp of the last update of the reserve

getATokenTotalSupply

function getATokenTotalSupply(address asset) external view override returns (uint256)

Returns the total supply of aTokens for a given asset.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

TypeDescription
uint256The total supply of the aToken

getTotalDebt

function getTotalDebt(address asset) external view override returns (uint256)

Returns the total debt for a given asset.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

TypeDescription
uint256The total borrows for an asset

getUserReserveData

function getUserReserveData(address asset, address user) external view returns (    uint256 currentATokenBalance,    uint256 currentStableDebt,    uint256 currentVariableDebt,    uint256 principalStableDebt,    uint256 scaledVariableDebt,    uint256 stableBorrowRate,    uint256 liquidityRate,    uint40 stableRateLastUpdated,    bool usageAsCollateralEnabled)

Returns the following user reserve data.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve
useraddressThe address of the user

Return Values:

NameTypeDescription
currentATokenBalanceuint256The current AToken balance of the user
currentStableDebtuint256The current stable debt of the user (deprecated)
currentVariableDebtuint256The current variable debt of the user
principalStableDebtuint256The principal stable debt of the user (deprecated)
scaledVariableDebtuint256The scaled variable debt of the user
stableBorrowRateuint256The stable borrow rate of the user (deprecated)
liquidityRateuint256The liquidity rate of the reserve
stableRateLastUpdateduint40The timestamp of the last update of the user stable rate (deprecated)
usageAsCollateralEnabledbooltrue if the user is using the asset as collateral, else false

getReserveTokensAddresses

function getReserveTokensAddresses(address asset) external view override returns (    address aTokenAddress,    address stableDebtTokenAddress,    address variableDebtTokenAddress)

Returns the addresses of the aToken, stableDebtToken and variableDebtToken of the reserve.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

NameTypeDescription
aTokenAddressaddressThe AToken address of the reserve
stableDebtTokenAddressaddressThe StableDebtToken address of the reserve (deprecated)
variableDebtTokenAddressaddressThe VariableDebtToken address of the reserve

getInterestRateStrategyAddress

function getInterestRateStrategyAddress(address asset) external view override returns (address irStrategyAddress)

Returns the address of the Interest Rate strategy.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

NameTypeDescription
irStrategyAddressaddressThe address of the Interest Rate strategy

Pure Methods

getDebtCeilingDecimals

function getDebtCeilingDecimals() external pure override returns (uint256)

Returns the debt ceiling decimals.

Return Values:

TypeDescription
uint256The debt ceiling decimals

Aave.com provides information and resources about the fundamentals of the decentralised non-custodial liquidity protocol called the Aave Protocol, comprised of open-source self-executing smart contracts that are deployed on various permissionless public blockchains, such as Ethereum (the "Aave Protocol" or the "Protocol"). Aave Labs does not control or operate any version of the Aave Protocol on any blockchain network.