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 PoolAddressesProvider for the associated Pool to fetch EMode categories for
Return Parameters:
Name
Type
Description
categories
Emode[]
The list of E-Modes available in the pool
Emode
The Emode struct is composed of the following fields:
Name
Type
Description
id
uint8
The unique identifier of the E-Mode
eMode
DataTypes.EModeCategory
The E-Mode configuration details
DataTypes.EModeCategory
The EModeCategory struct is composed of the following fields:
Name
Type
Description
ltv
uint16
Loan-to-Value ratio for the E-Mode category
liquidationThreshold
uint16
The threshold at which liquidation is triggered
liquidationBonus
uint16
The bonus applied during liquidation
collateralBitmap
uint128
Bitmap representing eligible collateral for this E-Mode
label
string
The label describing the E-Mode category
borrowableBitmap
uint128
Bitmap 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.
Provides balances of user wallet for all reserves available on the pool.
Input Parameters:
Name
Type
Description
provider
address
The address of the provider
user
address
The address of the user
Return Values:
Type
Description
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.
Returns the UserReserveIncentiveData[] for the given user for the pool associated with the given provider.
Input Parameters:
Name
Type
Description
provider
IPoolAddressesProvider
The given provider for the associated pool
Return Values:
Type
Description
UserReserveIncentiveData[]
The user reserve incentive data
The UserReserveIncentiveData struct is composed of the following fields:
Name
Type
Description
underlyingAsset
address
Address of the asset supplied/borrowed in Pool
aTokenIncentivesUserData
UserIncentiveData
Details of user rewards received for supplying to Aave Pool i.e. rewards for aToken
vTokenIncentivesUserData
UserIncentiveData
Details 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.
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:
Type
Description
TokenData[]
The list of reserves, pairs of symbols and addresses
The TokenData struct is composed of the following fields:
This contract is a utility for fetching and pre-processing liquidation-related parameters for a given user. It aggregates data from the underlying Pool and Price Oracle to determine a user’s position, collateral, borrow details, and liquidation limits according to the protocol parameters.
Returns aggregated position information for a user including total collateral, total debt, available borrows, current liquidation threshold, loan-to-value (LTV), and health factor. All values are denominated in the base currency.
Input Parameters:
Name
Type
Description
user
address
The address of the user whose position is queried
Return Values:
Name
Type
Description
UserPositionFullInfo
struct
The aggregated position information of the user
The UserPositionFullInfo struct is composed of the following fields:
Returns detailed information regarding a user’s collateral for a given asset. The returned struct includes the asset’s unit (based on decimals), its current price (via the Price Oracle), the associated aToken address, the raw collateral balance, and its equivalent value in the base currency.
Input Parameters:
Name
Type
Description
user
address
The address of the user
collateralAsset
address
The address of the collateral asset to fetch information for
Return Values:
Name
Type
Description
CollateralFullInfo
struct
Detailed collateral information for the specified asset
The CollateralFullInfo struct is composed of the following fields:
Name
Type
Description
assetUnit
uint256
The unit value of the asset (10^decimals)
price
uint256
Current price of the asset from the Price Oracle
aToken
address
Address of the aToken associated with the asset
collateralBalance
uint256
The raw collateral balance of the user
collateralBalanceInBaseCurrency
uint256
Collateral balance denominated in the base currency
Returns detailed information regarding a user’s debt for a given asset. The returned struct includes the asset’s unit, current price, the associated variable debt token address, the debt balance, and its equivalent value in the base currency.
Input Parameters:
Name
Type
Description
user
address
The address of the user
debtAsset
address
The address of the debt asset to fetch information for
Return Values:
Name
Type
Description
DebtFullInfo
struct
Detailed debt information for the specified asset
The DebtFullInfo struct is composed of the following fields:
Name
Type
Description
assetUnit
uint256
The unit value of the asset (10^decimals)
price
uint256
Current price of the asset from the Price Oracle
variableDebtToken
address
Address of the variable debt token associated with the asset
A convenience function that returns liquidation parameters for a user using the maximum possible debt liquidation amount. Internally, it calls the overloaded version with debtLiquidationAmount set to the maximum (type(uint256).max).
Input Parameters:
Name
Type
Description
user
address
The address of the user
collateralAsset
address
The address of the collateral asset
debtAsset
address
The address of the debt asset
Return Values:
Name
Type
Description
LiquidationInfo
struct
Detailed liquidation information for the specified user and assets
The LiquidationInfo struct is composed of the following fields:
Name
Type
Description
userInfo
struct
Aggregated position details of the user (UserPositionFullInfo above)
collateralInfo
struct
Detailed collateral information (CollateralFullInfo above)
Returns comprehensive liquidation parameters for a user given a specific collateral asset and debt asset, considering a custom maximum debt liquidation amount. The function aggregates the user’s position, collateral and debt details, checks if liquidation conditions are met, and computes the optimal amounts for liquidation—including any applicable protocol fees.
Input Parameters:
Name
Type
Description
user
address
The address of the user
collateralAsset
address
The address of the collateral asset to be liquidated
debtAsset
address
The address of the debt asset to be repaid
debtLiquidationAmount
uint256
The maximum debt amount that can be liquidated (if lower than the user’s debt balance)
Return Values:
Name
Type
Description
LiquidationInfo
struct
Detailed liquidation information for the specified user and assets
The LiquidationInfo struct is composed of the following fields:
Name
Type
Description
userInfo
struct
Aggregated position details of the user (UserPositionFullInfo above)
collateralInfo
struct
Detailed collateral information (CollateralFullInfo above)