mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge branch 'feat/renameing' into 'feat/data-helpers'
Feat/renameing See merge request aave-tech/protocol-v2!118
This commit is contained in:
commit
0f93c549eb
|
@ -19,7 +19,7 @@ interface IUiPoolDataProvider {
|
|||
bool borrowingEnabled;
|
||||
bool stableBorrowRateEnabled;
|
||||
bool isActive;
|
||||
bool isFreezed;
|
||||
bool isFrozen;
|
||||
// base data
|
||||
uint128 liquidityIndex;
|
||||
uint128 variableBorrowIndex;
|
||||
|
@ -33,9 +33,10 @@ interface IUiPoolDataProvider {
|
|||
address interestRateStrategyAddress;
|
||||
//
|
||||
uint256 availableLiquidity;
|
||||
uint256 totalBorrowsStable;
|
||||
uint256 totalBorrowsVariable;
|
||||
uint256 utilizationRate;
|
||||
uint256 totalPrincipalStableDebt;
|
||||
uint256 averageStableRate;
|
||||
uint256 stableDebtLastUpdateTimestamp;
|
||||
uint256 totalScaledVariableDebt;
|
||||
uint256 priceInEth;
|
||||
uint256 variableRateSlope1;
|
||||
uint256 variableRateSlope2;
|
||||
|
@ -50,11 +51,11 @@ interface IUiPoolDataProvider {
|
|||
|
||||
struct UserReserveData {
|
||||
address underlyingAsset;
|
||||
uint256 principalATokenBalance;
|
||||
uint256 scaledATokenBalance;
|
||||
bool usageAsCollateralEnabledOnUser;
|
||||
uint256 stableBorrowRate;
|
||||
uint256 principalVariableBorrows;
|
||||
uint256 principalStableBorrows;
|
||||
uint256 scaledVariableDebt;
|
||||
uint256 principalStableDebt;
|
||||
uint256 stableBorrowLastUpdateTimestamp;
|
||||
}
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
@ -87,14 +87,14 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
|
||||
reserveData.aTokenAddress
|
||||
);
|
||||
reserveData.totalBorrowsStable = IERC20Detailed(reserveData.stableDebtTokenAddress)
|
||||
.totalSupply();
|
||||
reserveData.totalBorrowsVariable = IERC20Detailed(reserveData.variableDebtTokenAddress)
|
||||
.totalSupply();
|
||||
uint256 totalBorrows = reserveData.totalBorrowsStable + reserveData.totalBorrowsVariable;
|
||||
reserveData.utilizationRate = totalBorrows == 0
|
||||
? 0
|
||||
: totalBorrows.rayDiv(totalBorrows + reserveData.availableLiquidity);
|
||||
(
|
||||
reserveData.totalPrincipalStableDebt,
|
||||
,
|
||||
reserveData.averageStableRate,
|
||||
reserveData.stableDebtLastUpdateTimestamp
|
||||
) = IStableDebtToken(reserveData.stableDebtTokenAddress).getSupplyData();
|
||||
reserveData.totalScaledVariableDebt = IVariableDebtToken(reserveData.variableDebtTokenAddress)
|
||||
.scaledTotalSupply();
|
||||
|
||||
// reserve configuration
|
||||
|
||||
|
@ -111,7 +111,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
) = baseData.configuration.getParamsMemory();
|
||||
(
|
||||
reserveData.isActive,
|
||||
reserveData.isFreezed,
|
||||
reserveData.isFrozen,
|
||||
reserveData.borrowingEnabled,
|
||||
reserveData.stableBorrowRateEnabled
|
||||
) = baseData.configuration.getFlagsMemory();
|
||||
|
@ -128,22 +128,22 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
if (user != address(0)) {
|
||||
// user reserve data
|
||||
userReservesData[i].underlyingAsset = reserveData.underlyingAsset;
|
||||
userReservesData[i].principalATokenBalance = IAToken(reserveData.aTokenAddress)
|
||||
userReservesData[i].scaledATokenBalance = IAToken(reserveData.aTokenAddress)
|
||||
.scaledBalanceOf(user);
|
||||
userReservesData[i].usageAsCollateralEnabledOnUser = userConfig.isUsingAsCollateral(i);
|
||||
|
||||
if (userConfig.isBorrowing(i)) {
|
||||
userReservesData[i].principalVariableBorrows = IVariableDebtToken(
|
||||
userReservesData[i].scaledVariableDebt = IVariableDebtToken(
|
||||
reserveData
|
||||
.variableDebtTokenAddress
|
||||
)
|
||||
.scaledBalanceOf(user);
|
||||
userReservesData[i].principalStableBorrows = IStableDebtToken(
|
||||
userReservesData[i].principalStableDebt = IStableDebtToken(
|
||||
reserveData
|
||||
.stableDebtTokenAddress
|
||||
)
|
||||
.principalBalanceOf(user);
|
||||
if (userReservesData[i].principalStableBorrows != 0) {
|
||||
if (userReservesData[i].principalStableDebt != 0) {
|
||||
userReservesData[i].stableBorrowRate = IStableDebtToken(
|
||||
reserveData
|
||||
.stableDebtTokenAddress
|
||||
|
|
7321
package-lock.json
generated
7321
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user