principal and stable to total

This commit is contained in:
pol 2020-11-02 11:54:21 +01:00
parent 498a5b5e1f
commit 7a8ed00909
2 changed files with 7 additions and 16 deletions

View File

@ -19,11 +19,11 @@ interface IUiPoolDataProvider {
bool borrowingEnabled;
bool stableBorrowRateEnabled;
bool isActive;
bool isFreezed;
bool isFrozen;
ReserveLogic.ReserveData baseData;
uint256 availableLiquidity;
uint256 totalPrincipalStableDebt;
uint256 totalScaledVariableDebt;
uint256 totalStableDebt;
uint256 totalVariableDebt;
uint256 utilizationRate;
uint256 priceInEth;
uint256 variableRateSlope1;

View File

@ -72,20 +72,11 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
reserveData.baseData.aTokenAddress
);
reserveData.totalPrincipalStableDebt = IERC20Detailed(
reserveData
.baseData
.stableDebtTokenAddress
)
reserveData.totalStableDebt = IERC20Detailed(reserveData.baseData.stableDebtTokenAddress)
.totalSupply();
reserveData.totalScaledVariableDebt = IERC20Detailed(
reserveData
.baseData
.variableDebtTokenAddress
)
reserveData.totalVariableDebt = IERC20Detailed(reserveData.baseData.variableDebtTokenAddress)
.totalSupply();
uint256 totalBorrows = reserveData.totalPrincipalStableDebt +
reserveData.totalScaledVariableDebt;
uint256 totalBorrows = reserveData.totalStableDebt + reserveData.totalVariableDebt;
reserveData.utilizationRate = totalBorrows == 0
? 0
: totalBorrows.rayDiv(totalBorrows + reserveData.availableLiquidity);
@ -105,7 +96,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
) = reserveData.baseData.configuration.getParamsMemory();
(
reserveData.isActive,
reserveData.isFreezed,
reserveData.isFrozen,
reserveData.borrowingEnabled,
reserveData.stableBorrowRateEnabled
) = reserveData.baseData.configuration.getFlagsMemory();