Skip to Content
docs

Aave V3 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.

To fetch the same reserve and user data already formatted for frontends, use AaveKit.

The source code is available on GitHub.

getReservesList

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

Returns the list of initialized 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 initialized reserves in the Pool

getReservesData

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

Returns BaseCurrencyInfo of the Pool and AggregatedReserveData[] for all the initialized 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
marketReferenceCurrencyUnituint256Unit of the base currency (e.g. 1e8)
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 reserve
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
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 the asset in the base currency
priceOracleaddressThe address of the price oracle used by the associated market
variableRateSlope1uint256Slope below the optimal usage ratio, in ray
variableRateSlope2uint256Slope above the optimal usage ratio, in ray
baseVariableBorrowRateuint256The base variable borrow rate, expressed in ray
optimalUsageRatiouint256The optimal usage ratio
isPausedbooltrue if the reserve is paused, false otherwise
isSiloedBorrowingboolDeprecated, always false since Aave V3.7
accruedToTreasuryuint128The amount of tokens accrued to treasury that is to be minted
isolationModeTotalDebtuint128Deprecated, always 0 since Aave V3.7
flashLoanEnabledbooltrue if asset is available to borrow in flash loan transaction
debtCeilinguint256Deprecated, always 0 since Aave V3.7
debtCeilingDecimalsuint256Deprecated, always 0 since Aave V3.7
borrowCapuint256The borrow cap of the reserve
supplyCapuint256The supply cap of the reserve
borrowableInIsolationboolDeprecated, always false since Aave V3.7
virtualUnderlyingBalanceuint128Balance of reserve if virtual accounting is used
deficituint128The current deficit of the reserve

getUserReservesData

Solidity
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

Return Values:

TypeDescription
UserReserveData[]The user reserve data
uint8The user’s E-Mode category id

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 * variable borrow index)

getEModes

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

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

Input Parameters:

NameTypeDescription
providerIPoolAddressesProviderThe PoolAddressesProvider for the associated Pool to fetch E-Mode categories for

Return Values:

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
isolatedbooltrue if only the category’s collateral contributes LTV (Aave V3.7)
labelstringThe label describing the E-Mode category
borrowableBitmapuint128Bitmap representing borrowable assets for this E-Mode
ltvzeroBitmapuint128Bitmap of assets treated as LTV 0 in this E-Mode

WalletBalanceProvider

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

An accessory contract outside the Aave Protocol, used by the Aave backend to reduce blockchain calls.

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

The source code is available on GitHub.

balanceOf

Solidity
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

Solidity
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[]Balances of every token for every user, at index userIndex * tokens.length + tokenIndex

getUserWalletBalances

Solidity
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[]The reserve token addresses, followed by MOCK_ETH_ADDRESS
uint256[]The user’s balance of each token, in the same order

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.

To fetch incentives and claimable rewards already formatted for frontends, use AaveKit.

The source code is available on GitHub.

getFullReservesIncentiveData

Solidity
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

Solidity
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

Solidity
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
useraddressThe address of the user

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.

getAllReservesTokens

Solidity
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

Solidity
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

Solidity
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

Solidity
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

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

Returns true if the reserve is paused.

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

NameTypeDescription
isPausedbooltrue if the reserve is paused, false otherwise

getSiloedBorrowing

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

Deprecated in Aave V3.7, which removed Siloed Borrowing. Always returns false.

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

Solidity
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

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

Deprecated in Aave V3.4. Always returns 0.

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

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

Deprecated in Aave V3.7, which removed Isolation Mode. Always returns 0.

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

Solidity
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

Solidity
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

Solidity
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

Solidity
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

Solidity
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

Solidity
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

getReserveDeficit

Returns the current deficit of the reserve.

Solidity
function getReserveDeficit(address asset) external view override returns (uint256)

Input Parameters:

NameTypeDescription
assetaddressThe address of the underlying asset of the reserve

Return Values:

TypeDescription
uint256Current reserve deficit from undercollateralized borrow positions

getDebtCeilingDecimals

Solidity
function getDebtCeilingDecimals() external pure override returns (uint256)

Deprecated in Aave V3.7. Always returns 2.

Returns the debt ceiling decimals.

Return Values:

TypeDescription
uint256The debt ceiling decimals

LiquidationDataProvider

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.

The source code is available on GitHub.

getUserPositionFullInfo

Solidity
function getUserPositionFullInfo(address user) public view override returns (UserPositionFullInfo memory)

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:

NameTypeDescription
useraddressThe address of the user whose position is queried

Return Values:

NameTypeDescription
UserPositionFullInfostructThe aggregated position information of the user

The UserPositionFullInfo struct is composed of the following fields:

NameTypeDescription
totalCollateralInBaseCurrencyuint256Total collateral in base currency
totalDebtInBaseCurrencyuint256Total debt in base currency
availableBorrowsInBaseCurrencyuint256Available borrows in base currency
currentLiquidationThresholduint256Current liquidation threshold
ltvuint256Loan-to-value ratio
healthFactoruint256Health factor of the user’s position

getCollateralFullInfo

Solidity
function getCollateralFullInfo(address user, address collateralAsset) external view override returns (CollateralFullInfo memory)

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:

NameTypeDescription
useraddressThe address of the user
collateralAssetaddressThe address of the collateral asset to fetch information for

Return Values:

NameTypeDescription
CollateralFullInfostructDetailed collateral information for the specified asset

The CollateralFullInfo struct is composed of the following fields:

NameTypeDescription
assetUnituint256The unit value of the asset (10^decimals)
priceuint256Current price of the asset from the Price Oracle
aTokenaddressAddress of the aToken associated with the asset
collateralBalanceuint256The raw collateral balance of the user
collateralBalanceInBaseCurrencyuint256Collateral balance denominated in the base currency

getDebtFullInfo

Solidity
function getDebtFullInfo(address user, address debtAsset) external view override returns (DebtFullInfo memory)

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:

NameTypeDescription
useraddressThe address of the user
debtAssetaddressThe address of the debt asset to fetch information for

Return Values:

NameTypeDescription
DebtFullInfostructDetailed debt information for the specified asset

The DebtFullInfo struct is composed of the following fields:

NameTypeDescription
assetUnituint256The unit value of the asset (10^decimals)
priceuint256Current price of the asset from the Price Oracle
variableDebtTokenaddressAddress of the variable debt token associated with the asset
debtBalanceuint256The raw debt balance of the user
debtBalanceInBaseCurrencyuint256Debt balance denominated in the base currency

getLiquidationInfo (without custom debt amount)

Solidity
function getLiquidationInfo(address user, address collateralAsset, address debtAsset) public view override returns (LiquidationInfo memory)

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:

NameTypeDescription
useraddressThe address of the user
collateralAssetaddressThe address of the collateral asset
debtAssetaddressThe address of the debt asset

Return Values:

NameTypeDescription
LiquidationInfostructDetailed liquidation information for the specified user and assets

The LiquidationInfo struct is composed of the following fields:

NameTypeDescription
userInfostructAggregated position details of the user (UserPositionFullInfo above)
collateralInfostructDetailed collateral information (CollateralFullInfo above)
debtInfostructDetailed debt information (DebtFullInfo above)
maxCollateralToLiquidateuint256Maximum collateral that can be liquidated
maxDebtToLiquidateuint256Maximum debt that can be liquidated
liquidationProtocolFeeuint256Protocol fee applied on the liquidation bonus
amountToPassToLiquidationCalluint256Adjusted debt amount for the liquidation call

getLiquidationInfo (with custom debt liquidation amount)

Solidity
function getLiquidationInfo(address user, address collateralAsset, address debtAsset, uint256 debtLiquidationAmount) public view override returns (LiquidationInfo memory)

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:

NameTypeDescription
useraddressThe address of the user
collateralAssetaddressThe address of the collateral asset to be liquidated
debtAssetaddressThe address of the debt asset to be repaid
debtLiquidationAmountuint256The maximum debt amount that can be liquidated (if lower than the user’s debt balance)

Return Values:

NameTypeDescription
LiquidationInfostructDetailed liquidation information for the specified user and assets

The LiquidationInfo struct is composed of the following fields:

NameTypeDescription
userInfostructAggregated position details of the user (UserPositionFullInfo above)
collateralInfostructDetailed collateral information (CollateralFullInfo above)
debtInfostructDetailed debt information (DebtFullInfo above)
maxCollateralToLiquidateuint256Maximum collateral that can be liquidated
maxDebtToLiquidateuint256Maximum debt that can be liquidated
liquidationProtocolFeeuint256Protocol fee applied on the liquidation bonus
amountToPassToLiquidationCalluint256Adjusted debt amount for the liquidation call