Queries

Get All Reserve Tokens (reserveTokens)

Endpoint: AaveProtocolDataProvider.sol,
Query: getAllReservesTokens(),
Output: Array[symbol, ERC20 addresses], #forever resTokens

Get All agTokens

Endpoint: AaveProtocolDataProvider.sol,
Query: getAllATokens(),
Output: Array[symbol, ERC20 addresses], #forever agTokens

Get WrappedNative Address

Endpoint: WETHGateway.sol,
Query: getWETHAddress() 
Output: string address, #forever

Asset Symbol and Logo

backref "Get All Reserve Tokens"
+
Fetch: TokenList,
Parse: logoURL #forever

Get Reserve Data

Endpoint: AaveProtocolDataProvider.sol,
Query: getReserveData(address resToken), #updated regularly
Output: Array[
		uint256: availableLiquidity,
		uint256: totalStableDebt,
		uint256: totalVariableDebt,
		uint256: liquidityRate,
		uint256: variableBorrowRate,
		uint256: stableBorrowRate,
		uint256: averageStableBorrowRate,
		uint256: liquidityIndex,
		uint256: variableBorrowIndex,
		uint40: lastUpdateTimestamp,
]

Get Reserve Asset Configuration Data

Endpoint: AaveProtocolDataProvider.sol,
Query: getReserveConfigurationData(address resToken), #forever
Output: Array[
		uint256: decimals,
		uint256: ltv, # output:5000 = 50%
		uint256: liquidationThreshold,
		uint256: liquidationBonus,
		uint256: reserveFactor,
		bool: usageAsCollateralEnabled,
		bool: borrowingEnabled,
		bool: stableBorrowRateEnabled,
		bool: isActive,
		bool: isFrozen,
]

Get Assets Prices in DAI

backref "Get All Reserve Tokens"
+
Endpoint: AgaveOracle.sol,
Query: getAssetsPrices(Array[resTokens]), # updated regularly
Output: Array[uint256],  #Prices in DAI (18 decimal)
+
AssetsPrices.update( OutputPrices / 18 )

Get Assets Prices in Native

backref "Get WrappedNative Address"
+
backref "Get Assets Prices in DAI"
+
Asset.priceNative = Asset.price / WrappedNative.price

Total Borrowed for Asset

backref "Get All Reserve Tokens"
+
backref "Get Assets Prices" using Asset
+
backref "Get Reserve Data" using Asset
+
TotalBorrowed = ((totalStableDebt + totalVariableDebt) / resToken.decimals) * resToken.Price;