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 borrowingEnabled;
|
||||||
bool stableBorrowRateEnabled;
|
bool stableBorrowRateEnabled;
|
||||||
bool isActive;
|
bool isActive;
|
||||||
bool isFreezed;
|
bool isFrozen;
|
||||||
// base data
|
// base data
|
||||||
uint128 liquidityIndex;
|
uint128 liquidityIndex;
|
||||||
uint128 variableBorrowIndex;
|
uint128 variableBorrowIndex;
|
||||||
|
@ -33,9 +33,10 @@ interface IUiPoolDataProvider {
|
||||||
address interestRateStrategyAddress;
|
address interestRateStrategyAddress;
|
||||||
//
|
//
|
||||||
uint256 availableLiquidity;
|
uint256 availableLiquidity;
|
||||||
uint256 totalBorrowsStable;
|
uint256 totalPrincipalStableDebt;
|
||||||
uint256 totalBorrowsVariable;
|
uint256 averageStableRate;
|
||||||
uint256 utilizationRate;
|
uint256 stableDebtLastUpdateTimestamp;
|
||||||
|
uint256 totalScaledVariableDebt;
|
||||||
uint256 priceInEth;
|
uint256 priceInEth;
|
||||||
uint256 variableRateSlope1;
|
uint256 variableRateSlope1;
|
||||||
uint256 variableRateSlope2;
|
uint256 variableRateSlope2;
|
||||||
|
@ -50,11 +51,11 @@ interface IUiPoolDataProvider {
|
||||||
|
|
||||||
struct UserReserveData {
|
struct UserReserveData {
|
||||||
address underlyingAsset;
|
address underlyingAsset;
|
||||||
uint256 principalATokenBalance;
|
uint256 scaledATokenBalance;
|
||||||
bool usageAsCollateralEnabledOnUser;
|
bool usageAsCollateralEnabledOnUser;
|
||||||
uint256 stableBorrowRate;
|
uint256 stableBorrowRate;
|
||||||
uint256 principalVariableBorrows;
|
uint256 scaledVariableDebt;
|
||||||
uint256 principalStableBorrows;
|
uint256 principalStableDebt;
|
||||||
uint256 stableBorrowLastUpdateTimestamp;
|
uint256 stableBorrowLastUpdateTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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';
|
||||||
|
@ -87,14 +87,14 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
|
reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
|
||||||
reserveData.aTokenAddress
|
reserveData.aTokenAddress
|
||||||
);
|
);
|
||||||
reserveData.totalBorrowsStable = IERC20Detailed(reserveData.stableDebtTokenAddress)
|
(
|
||||||
.totalSupply();
|
reserveData.totalPrincipalStableDebt,
|
||||||
reserveData.totalBorrowsVariable = IERC20Detailed(reserveData.variableDebtTokenAddress)
|
,
|
||||||
.totalSupply();
|
reserveData.averageStableRate,
|
||||||
uint256 totalBorrows = reserveData.totalBorrowsStable + reserveData.totalBorrowsVariable;
|
reserveData.stableDebtLastUpdateTimestamp
|
||||||
reserveData.utilizationRate = totalBorrows == 0
|
) = IStableDebtToken(reserveData.stableDebtTokenAddress).getSupplyData();
|
||||||
? 0
|
reserveData.totalScaledVariableDebt = IVariableDebtToken(reserveData.variableDebtTokenAddress)
|
||||||
: totalBorrows.rayDiv(totalBorrows + reserveData.availableLiquidity);
|
.scaledTotalSupply();
|
||||||
|
|
||||||
// reserve configuration
|
// reserve configuration
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
) = baseData.configuration.getParamsMemory();
|
) = baseData.configuration.getParamsMemory();
|
||||||
(
|
(
|
||||||
reserveData.isActive,
|
reserveData.isActive,
|
||||||
reserveData.isFreezed,
|
reserveData.isFrozen,
|
||||||
reserveData.borrowingEnabled,
|
reserveData.borrowingEnabled,
|
||||||
reserveData.stableBorrowRateEnabled
|
reserveData.stableBorrowRateEnabled
|
||||||
) = baseData.configuration.getFlagsMemory();
|
) = baseData.configuration.getFlagsMemory();
|
||||||
|
@ -128,22 +128,22 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
if (user != address(0)) {
|
if (user != address(0)) {
|
||||||
// user reserve data
|
// user reserve data
|
||||||
userReservesData[i].underlyingAsset = reserveData.underlyingAsset;
|
userReservesData[i].underlyingAsset = reserveData.underlyingAsset;
|
||||||
userReservesData[i].principalATokenBalance = IAToken(reserveData.aTokenAddress)
|
userReservesData[i].scaledATokenBalance = IAToken(reserveData.aTokenAddress)
|
||||||
.scaledBalanceOf(user);
|
.scaledBalanceOf(user);
|
||||||
userReservesData[i].usageAsCollateralEnabledOnUser = userConfig.isUsingAsCollateral(i);
|
userReservesData[i].usageAsCollateralEnabledOnUser = userConfig.isUsingAsCollateral(i);
|
||||||
|
|
||||||
if (userConfig.isBorrowing(i)) {
|
if (userConfig.isBorrowing(i)) {
|
||||||
userReservesData[i].principalVariableBorrows = IVariableDebtToken(
|
userReservesData[i].scaledVariableDebt = IVariableDebtToken(
|
||||||
reserveData
|
reserveData
|
||||||
.variableDebtTokenAddress
|
.variableDebtTokenAddress
|
||||||
)
|
)
|
||||||
.scaledBalanceOf(user);
|
.scaledBalanceOf(user);
|
||||||
userReservesData[i].principalStableBorrows = IStableDebtToken(
|
userReservesData[i].principalStableDebt = IStableDebtToken(
|
||||||
reserveData
|
reserveData
|
||||||
.stableDebtTokenAddress
|
.stableDebtTokenAddress
|
||||||
)
|
)
|
||||||
.principalBalanceOf(user);
|
.principalBalanceOf(user);
|
||||||
if (userReservesData[i].principalStableBorrows != 0) {
|
if (userReservesData[i].principalStableDebt != 0) {
|
||||||
userReservesData[i].stableBorrowRate = IStableDebtToken(
|
userReservesData[i].stableBorrowRate = IStableDebtToken(
|
||||||
reserveData
|
reserveData
|
||||||
.stableDebtTokenAddress
|
.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