This commit is contained in:
Thrilok Kumar 2021-01-21 19:20:20 +05:30
commit 40adca2f52
2 changed files with 15 additions and 6 deletions

View File

@ -57,6 +57,7 @@ interface AavePriceInterface {
interface AaveCoreInterface {
function getReserveCurrentLiquidityRate(address _reserve) external view returns (uint256);
function getReserveCurrentVariableBorrowRate(address _reserve) external view returns (uint256);
function getReserveAvailableLiquidity(address _reserve) external view returns (uint256);
}
interface ChainLinkInterface {
@ -148,6 +149,7 @@ contract AaveHelpers is DSMath {
bool borrowEnabled;
bool stableBorrowEnabled;
bool isActive;
uint availableLiquidity;
}
struct TokenPrice {
@ -181,6 +183,7 @@ contract AaveHelpers is DSMath {
aaveTokenData.stableBorrowEnabled,
aaveTokenData.isActive
) = aave.getReserveConfigurationData(token);
return aaveTokenData;
}
@ -207,6 +210,7 @@ contract AaveHelpers is DSMath {
uint supplyRate = aaveCore.getReserveCurrentLiquidityRate(token);
uint borrowRate = aaveCore.getReserveCurrentVariableBorrowRate(token);
AaveTokenData memory aaveTokenData = collateralData(aave, token);
aaveTokenData.availableLiquidity = aaveCore.getReserveAvailableLiquidity(token);
tokenData = AaveUserTokenData(
priceInEth,
@ -265,5 +269,5 @@ contract Resolver is AaveHelpers {
}
contract InstaAaveResolver is Resolver {
string public constant name = "Aave-Resolver-v1.2";
string public constant name = "Aave-Resolver-v1.3";
}

View File

@ -176,6 +176,9 @@ contract AaveHelpers is DSMath {
bool stableBorrowEnabled;
bool isActive;
bool isFrozen;
uint availableLiquidity;
uint totalStableDebt;
uint totalVariableDebt;
}
struct TokenPrice {
@ -221,6 +224,8 @@ contract AaveHelpers is DSMath {
uint tokenPriceInEth,
uint tokenPriceInUsd
) internal view returns(AaveUserTokenData memory tokenData) {
AaveTokenData memory aaveTokenData = collateralData(aaveData, token);
(
tokenData.supplyBalance,
tokenData.stableBorrowBalance,
@ -230,15 +235,15 @@ contract AaveHelpers is DSMath {
) = aaveData.getUserReserveData(token, user);
(
,,,
aaveTokenData.availableLiquidity,
aaveTokenData.totalStableDebt,
aaveTokenData.totalVariableDebt,
tokenData.supplyRate,
tokenData.variableBorrowRate,
tokenData.stableBorrowRate,
,,,
) = aaveData.getReserveData(token);
AaveTokenData memory aaveTokenData = collateralData(aaveData, token);
tokenData.tokenPriceInEth = tokenPriceInEth;
tokenData.tokenPriceInUsd = tokenPriceInUsd;
tokenData.aaveTokenData = aaveTokenData;
@ -295,5 +300,5 @@ contract Resolver is AaveHelpers {
}
contract InstaAaveV2Resolver is Resolver {
string public constant name = "AaveV2-Resolver-v1.2";
}
string public constant name = "AaveV2-Resolver-v1.3";
}