From 79b1cbb2870b70cd0d05bf4f94eada946a1f58ed Mon Sep 17 00:00:00 2001 From: sendra Date: Fri, 8 Oct 2021 18:03:39 +0200 Subject: [PATCH] fix: removed unused method --- contracts/misc/UiPoolDataProvider.sol | 134 +----------------- .../misc/interfaces/IUiPoolDataProvider.sol | 12 +- 2 files changed, 2 insertions(+), 144 deletions(-) diff --git a/contracts/misc/UiPoolDataProvider.sol b/contracts/misc/UiPoolDataProvider.sol index 95ab84a1..d40f98a5 100644 --- a/contracts/misc/UiPoolDataProvider.sol +++ b/contracts/misc/UiPoolDataProvider.sol @@ -58,7 +58,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { return lendingPool.getReservesList(); } - function getSimpleReservesData(ILendingPoolAddressesProvider provider) + function getReservesData(ILendingPoolAddressesProvider provider) public view override @@ -192,136 +192,4 @@ contract UiPoolDataProvider is IUiPoolDataProvider { return (userReservesData); } - - function getReservesData(ILendingPoolAddressesProvider provider, address user) - external - view - override - returns ( - AggregatedReserveData[] memory, - UserReserveData[] memory, - BaseCurrencyInfo memory - ) - { - IAaveOracle oracle = IAaveOracle(provider.getPriceOracle()); - ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); - address[] memory reserves = lendingPool.getReservesList(); - DataTypes.UserConfigurationMap memory userConfig = lendingPool.getUserConfiguration(user); - - AggregatedReserveData[] memory reservesData = new AggregatedReserveData[](reserves.length); - UserReserveData[] memory userReservesData = - new UserReserveData[](user != address(0) ? reserves.length : 0); - - for (uint256 i = 0; i < reserves.length; i++) { - AggregatedReserveData memory reserveData = reservesData[i]; - reserveData.underlyingAsset = reserves[i]; - - // reserve current state - DataTypes.ReserveData memory baseData = - lendingPool.getReserveData(reserveData.underlyingAsset); - reserveData.liquidityIndex = baseData.liquidityIndex; - reserveData.variableBorrowIndex = baseData.variableBorrowIndex; - reserveData.liquidityRate = baseData.currentLiquidityRate; - reserveData.variableBorrowRate = baseData.currentVariableBorrowRate; - reserveData.stableBorrowRate = baseData.currentStableBorrowRate; - reserveData.lastUpdateTimestamp = baseData.lastUpdateTimestamp; - reserveData.aTokenAddress = baseData.aTokenAddress; - reserveData.stableDebtTokenAddress = baseData.stableDebtTokenAddress; - reserveData.variableDebtTokenAddress = baseData.variableDebtTokenAddress; - reserveData.interestRateStrategyAddress = baseData.interestRateStrategyAddress; - reserveData.priceInMarketReferenceCurrency = oracle.getAssetPrice(reserveData.underlyingAsset); - - reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf( - reserveData.aTokenAddress - ); - ( - reserveData.totalPrincipalStableDebt, - , - reserveData.averageStableRate, - reserveData.stableDebtLastUpdateTimestamp - ) = IStableDebtToken(reserveData.stableDebtTokenAddress).getSupplyData(); - reserveData.totalScaledVariableDebt = IVariableDebtToken(reserveData.variableDebtTokenAddress) - .scaledTotalSupply(); - - // we're getting this info from the aToken, because some of assets can be not compliant with ETC20Detailed - reserveData.symbol = IERC20Detailed(reserveData.underlyingAsset).symbol(); - reserveData.name = ''; - - ( - reserveData.baseLTVasCollateral, - reserveData.reserveLiquidationThreshold, - reserveData.reserveLiquidationBonus, - reserveData.decimals, - reserveData.reserveFactor - ) = baseData.configuration.getParamsMemory(); - ( - reserveData.isActive, - reserveData.isFrozen, - reserveData.borrowingEnabled, - reserveData.stableBorrowRateEnabled - ) = baseData.configuration.getFlagsMemory(); - reserveData.usageAsCollateralEnabled = reserveData.baseLTVasCollateral != 0; - ( - reserveData.variableRateSlope1, - reserveData.variableRateSlope2, - reserveData.stableRateSlope1, - reserveData.stableRateSlope2 - ) = getInterestRateStrategySlopes( - DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress) - ); - - if (user != address(0)) { - // user reserve data - userReservesData[i].underlyingAsset = reserveData.underlyingAsset; - userReservesData[i].scaledATokenBalance = IAToken(reserveData.aTokenAddress) - .scaledBalanceOf(user); - userReservesData[i].usageAsCollateralEnabledOnUser = userConfig.isUsingAsCollateral(i); - - if (userConfig.isBorrowing(i)) { - userReservesData[i].scaledVariableDebt = IVariableDebtToken( - reserveData - .variableDebtTokenAddress - ) - .scaledBalanceOf(user); - userReservesData[i].principalStableDebt = IStableDebtToken( - reserveData - .stableDebtTokenAddress - ) - .principalBalanceOf(user); - if (userReservesData[i].principalStableDebt != 0) { - userReservesData[i].stableBorrowRate = IStableDebtToken( - reserveData - .stableDebtTokenAddress - ) - .getUserStableRate(user); - userReservesData[i].stableBorrowLastUpdateTimestamp = IStableDebtToken( - reserveData - .stableDebtTokenAddress - ) - .getUserLastUpdated(user); - } - } - } - } - - BaseCurrencyInfo memory baseCurrencyInfo; - try oracle.BASE_CURRENCY_UNIT() returns (uint256 baseCurrencyUnit) { - baseCurrencyInfo.baseCurrencyDecimals = baseCurrencyUnit; - if (address(0) == oracle.BASE_CURRENCY()) { - baseCurrencyInfo.baseCurrencyPriceInUsd = USD_PRICE; - } else { - baseCurrencyInfo.baseCurrencyPriceInUsd = oracle.getAssetPrice(MOCK_USD_ADDRESS); - } - } catch (bytes memory /*lowLevelData*/) { - baseCurrencyInfo.baseCurrencyDecimals = ETH_CURRENCY_DECIMALS; - baseCurrencyInfo.baseCurrencyPriceInUsd = oracle.getAssetPrice(MOCK_USD_ADDRESS); - } - - return ( - reservesData, - userReservesData, - baseCurrencyInfo - ); - } - } diff --git a/contracts/misc/interfaces/IUiPoolDataProvider.sol b/contracts/misc/interfaces/IUiPoolDataProvider.sol index 6b2884d6..4ede9940 100644 --- a/contracts/misc/interfaces/IUiPoolDataProvider.sol +++ b/contracts/misc/interfaces/IUiPoolDataProvider.sol @@ -63,7 +63,7 @@ interface IUiPoolDataProvider { view returns (address[] memory); - function getSimpleReservesData(ILendingPoolAddressesProvider provider) + function getReservesData(ILendingPoolAddressesProvider provider) external view returns ( @@ -77,14 +77,4 @@ interface IUiPoolDataProvider { returns ( UserReserveData[] memory ); - - // generic method with full data - function getReservesData(ILendingPoolAddressesProvider provider, address user) - external - view - returns ( - AggregatedReserveData[] memory, - UserReserveData[] memory, - BaseCurrencyInfo memory - ); }