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;
|
bool isFrozen;
|
||||||
ReserveLogic.ReserveData baseData;
|
ReserveLogic.ReserveData baseData;
|
||||||
uint256 availableLiquidity;
|
uint256 availableLiquidity;
|
||||||
uint256 totalStableDebt;
|
uint256 totalPrincipalStableDebt;
|
||||||
uint256 totalVariableDebt;
|
uint256 averageStableRate;
|
||||||
uint256 utilizationRate;
|
uint256 stableDebtLastUpdateTimestamp;
|
||||||
|
uint256 totalScaledVariableDebt;
|
||||||
uint256 priceInEth;
|
uint256 priceInEth;
|
||||||
uint256 variableRateSlope1;
|
uint256 variableRateSlope1;
|
||||||
uint256 variableRateSlope2;
|
uint256 variableRateSlope2;
|
||||||
|
|
|
@ -5,7 +5,7 @@ pragma experimental ABIEncoderV2;
|
||||||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {IUiPoolDataProvider} from './IUiPoolDataProvider.sol';
|
import {IUiPoolDataProvider} from './IUiPoolDataProvider.sol';
|
||||||
import {ILendingPool} from '../interfaces/ILendingPool.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 {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
||||||
import {IAToken} from '../tokenization/interfaces/IAToken.sol';
|
import {IAToken} from '../tokenization/interfaces/IAToken.sol';
|
||||||
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
|
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
|
||||||
|
@ -72,22 +72,18 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
|
reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
|
||||||
reserveData.baseData.aTokenAddress
|
reserveData.baseData.aTokenAddress
|
||||||
);
|
);
|
||||||
(, reserveData.totalStableDebt, ) = IStableDebtToken(
|
(
|
||||||
reserveData
|
reserveData.totalPrincipalStableDebt,
|
||||||
.baseData
|
,
|
||||||
.stableDebtTokenAddress
|
reserveData.averageStableRate,
|
||||||
)
|
reserveData.stableDebtLastUpdateTimestamp
|
||||||
.getSupplyData();
|
) = IStableDebtToken(reserveData.baseData.stableDebtTokenAddress).getSupplyData();
|
||||||
reserveData.totalVariableDebt = IVariableDebtToken(
|
reserveData.totalScaledVariableDebt = IVariableDebtToken(
|
||||||
reserveData
|
reserveData
|
||||||
.baseData
|
.baseData
|
||||||
.variableDebtTokenAddress
|
.variableDebtTokenAddress
|
||||||
)
|
)
|
||||||
.totalSupply();
|
.scaledTotalSupply();
|
||||||
uint256 totalBorrows = reserveData.totalStableDebt + reserveData.totalVariableDebt;
|
|
||||||
reserveData.utilizationRate = totalBorrows == 0
|
|
||||||
? 0
|
|
||||||
: totalBorrows.rayDiv(totalBorrows + reserveData.availableLiquidity);
|
|
||||||
|
|
||||||
// reserve configuration
|
// reserve configuration
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user