Skip to content

Commit

Permalink
Merge pull request #24 from aave/fix/uiPoolDataProvider-order
Browse files Browse the repository at this point in the history
fix: fix order of fields
  • Loading branch information
kartojal authored Nov 12, 2021
2 parents 4cf6f3a + 58534d3 commit 5cc92e8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
42 changes: 23 additions & 19 deletions contracts/misc/UiPoolDataProvider.sol
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
//address of the interest rate strategy
reserveData.interestRateStrategyAddress = baseData.interestRateStrategyAddress;
reserveData.priceInMarketReferenceCurrency = oracle.getAssetPrice(reserveData.underlyingAsset);
reserveData.unbacked = baseData.unbacked;
reserveData.isolationModeTotalDebt = baseData.isolationModeTotalDebt;
reserveData.accruedToTreasury = baseData.accruedToTreasury;

reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
reserveData.aTokenAddress
Expand All @@ -131,21 +128,8 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
reserveData.symbol = IERC20Detailed(reserveData.underlyingAsset).symbol();
}

(
reserveData.variableRateSlope1,
reserveData.variableRateSlope2,
reserveData.stableRateSlope1,
reserveData.stableRateSlope2
) = getInterestRateStrategySlopes(
DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress)
);

//stores the reserve configuration
DataTypes.ReserveConfigurationMap memory reserveConfigurationMap = baseData.configuration;
reserveData.debtCeiling = reserveConfigurationMap.getDebtCeiling();
reserveData.debtCeilingDecimals = poolDataProvider.getDebtCeilingDecimals();
(reserveData.borrowCap, reserveData.supplyCap) = reserveConfigurationMap.getCaps();

uint256 eModeCategoryId;
(
reserveData.baseLTVasCollateral,
Expand All @@ -155,17 +139,37 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
reserveData.reserveFactor,
eModeCategoryId
) = reserveConfigurationMap.getParams();
reserveData.eModeCategoryId = uint8(eModeCategoryId);
reserveData.usageAsCollateralEnabled = reserveData.baseLTVasCollateral != 0;

bool isPaused;
(
reserveData.isActive,
reserveData.isFrozen,
reserveData.borrowingEnabled,
reserveData.stableBorrowRateEnabled,
reserveData.isPaused
isPaused
) = reserveConfigurationMap.getFlags();


(
reserveData.variableRateSlope1,
reserveData.variableRateSlope2,
reserveData.stableRateSlope1,
reserveData.stableRateSlope2
) = getInterestRateStrategySlopes(
DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress)
);

// v3 only
reserveData.eModeCategoryId = uint8(eModeCategoryId);
reserveData.debtCeiling = reserveConfigurationMap.getDebtCeiling();
reserveData.debtCeilingDecimals = poolDataProvider.getDebtCeilingDecimals();
(reserveData.borrowCap, reserveData.supplyCap) = reserveConfigurationMap.getCaps();

reserveData.isPaused = isPaused;
reserveData.unbacked = baseData.unbacked;
reserveData.isolationModeTotalDebt = baseData.isolationModeTotalDebt;
reserveData.accruedToTreasury = baseData.accruedToTreasury;

DataTypes.EModeCategory memory categoryData = pool.getEModeCategoryData(reserveData.eModeCategoryId);
reserveData.eModeLtv = categoryData.ltv;
reserveData.eModeLiquidationThreshold = categoryData.liquidationThreshold;
Expand Down
5 changes: 2 additions & 3 deletions contracts/misc/interfaces/IUiPoolDataProvider.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ interface IUiPoolDataProvider {
bool stableBorrowRateEnabled;
bool isActive;
bool isFrozen;
bool isPaused;
// base data
uint128 liquidityIndex;
uint128 variableBorrowIndex;
Expand All @@ -38,12 +37,12 @@ interface IUiPoolDataProvider {
uint256 stableDebtLastUpdateTimestamp;
uint256 totalScaledVariableDebt;
uint256 priceInMarketReferenceCurrency;
//
uint256 variableRateSlope1;
uint256 variableRateSlope2;
uint256 stableRateSlope1;
uint256 stableRateSlope2;
//
// v3 only
bool isPaused;
uint128 accruedToTreasury;
uint128 unbacked;
uint128 isolationModeTotalDebt;
Expand Down

0 comments on commit 5cc92e8

Please sign in to comment.