mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
add scaled/principal debt
This commit is contained in:
parent
7ebdb06933
commit
5b85aef283
|
@ -22,9 +22,10 @@ interface IUiPoolDataProvider {
|
|||
bool isFrozen;
|
||||
ReserveLogic.ReserveData baseData;
|
||||
uint256 availableLiquidity;
|
||||
uint256 totalStableDebt;
|
||||
uint256 totalVariableDebt;
|
||||
uint256 utilizationRate;
|
||||
uint256 totalPrincipalStableDebt;
|
||||
uint256 averageStableRate;
|
||||
uint256 stableDebtLastUpdateTimestamp;
|
||||
uint256 totalScaledVariableDebt;
|
||||
uint256 priceInEth;
|
||||
uint256 variableRateSlope1;
|
||||
uint256 variableRateSlope2;
|
||||
|
|
|
@ -5,7 +5,7 @@ pragma experimental ABIEncoderV2;
|
|||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||
import {IUiPoolDataProvider} from './IUiPoolDataProvider.sol';
|
||||
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
||||
import {IERC20Detailed} from '../interfaces/IERC20Detailed.sol';
|
||||
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
||||
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
||||
import {IAToken} from '../tokenization/interfaces/IAToken.sol';
|
||||
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
|
||||
|
@ -72,22 +72,18 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
|
||||
reserveData.baseData.aTokenAddress
|
||||
);
|
||||
(, reserveData.totalStableDebt, ) = IStableDebtToken(
|
||||
reserveData
|
||||
.baseData
|
||||
.stableDebtTokenAddress
|
||||
)
|
||||
.getSupplyData();
|
||||
reserveData.totalVariableDebt = IVariableDebtToken(
|
||||
(
|
||||
reserveData.totalPrincipalStableDebt,
|
||||
,
|
||||
reserveData.averageStableRate,
|
||||
reserveData.stableDebtLastUpdateTimestamp
|
||||
) = IStableDebtToken(reserveData.baseData.stableDebtTokenAddress).getSupplyData();
|
||||
reserveData.totalScaledVariableDebt = IVariableDebtToken(
|
||||
reserveData
|
||||
.baseData
|
||||
.variableDebtTokenAddress
|
||||
)
|
||||
.totalSupply();
|
||||
uint256 totalBorrows = reserveData.totalStableDebt + reserveData.totalVariableDebt;
|
||||
reserveData.utilizationRate = totalBorrows == 0
|
||||
? 0
|
||||
: totalBorrows.rayDiv(totalBorrows + reserveData.availableLiquidity);
|
||||
.scaledTotalSupply();
|
||||
|
||||
// reserve configuration
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user