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 borrowingEnabled;
bool stableBorrowRateEnabled; bool stableBorrowRateEnabled;
bool isActive; bool isActive;
bool isFreezed; bool isFrozen;
ReserveLogic.ReserveData baseData; ReserveLogic.ReserveData baseData;
uint256 availableLiquidity; uint256 availableLiquidity;
uint256 totalPrincipalStableDebt; uint256 totalStableDebt;
uint256 totalScaledVariableDebt; uint256 totalVariableDebt;
uint256 utilizationRate; uint256 utilizationRate;
uint256 priceInEth; uint256 priceInEth;
uint256 variableRateSlope1; uint256 variableRateSlope1;

View File

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