@@ -19,6 +19,7 @@ import {
1919 DefaultReserveInterestRateStrategy
2020} from '../protocol/lendingpool/DefaultReserveInterestRateStrategy.sol ' ;
2121import {IERC20DetailedBytes } from './interfaces/IERC20DetailedBytes.sol ' ;
22+ import {ILendingRateOracle} from '../interfaces/ILendingRateOracle.sol ' ;
2223
2324contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
2425 using WadRayMath for uint256 ;
@@ -38,22 +39,23 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
3839 marketReferenceCurrencyPriceInUsdProxyAggregator = _marketReferenceCurrencyPriceInUsdProxyAggregator;
3940 }
4041
41- function getInterestRateStrategySlopes (DefaultReserveInterestRateStrategy interestRateStrategy )
42+ function getInterestRateStrategySlopes (DefaultReserveInterestRateStrategy interestRateStrategy , ILendingPoolAddressesProvider provider , address reserve )
4243 internal
4344 view
44- returns (
45- uint256 ,
46- uint256 ,
47- uint256 ,
48- uint256
49- )
45+ returns (InterestRates memory )
5046 {
51- return (
52- interestRateStrategy.variableRateSlope1 (),
53- interestRateStrategy.variableRateSlope2 (),
54- interestRateStrategy.stableRateSlope1 (),
55- interestRateStrategy.stableRateSlope2 ()
56- );
47+ InterestRates memory interestRates;
48+ interestRates.variableRateSlope1 = interestRateStrategy.variableRateSlope1 ();
49+ interestRates.variableRateSlope2 = interestRateStrategy.variableRateSlope2 ();
50+ interestRates.stableRateSlope1 = interestRateStrategy.stableRateSlope1 ();
51+ interestRates.stableRateSlope2 = interestRateStrategy.stableRateSlope2 ();
52+ interestRates.baseVariableBorrowRate = interestRateStrategy.baseVariableBorrowRate ();
53+ interestRates.optimalUsageRatio = interestRateStrategy.OPTIMAL_UTILIZATION_RATE ();
54+
55+ interestRates.baseStableBorrowRate = ILendingRateOracle (provider.getLendingRateOracle ())
56+ .getMarketBorrowRate (reserve);
57+
58+ return interestRates;
5759 }
5860
5961 function getReservesList (ILendingPoolAddressesProvider provider )
@@ -97,6 +99,7 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
9799 reserveData.priceInMarketReferenceCurrency = oracle.getAssetPrice (
98100 reserveData.underlyingAsset
99101 );
102+ reserveData.priceOracle = oracle.getSourceOfAsset (reserveData.underlyingAsset);
100103
101104 reserveData.availableLiquidity = IERC20Detailed (reserveData.underlyingAsset).balanceOf (
102105 reserveData.aTokenAddress
@@ -134,14 +137,18 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
134137 reserveData.stableBorrowRateEnabled
135138 ) = baseData.configuration.getFlagsMemory ();
136139 reserveData.usageAsCollateralEnabled = reserveData.baseLTVasCollateral != 0 ;
137- (
138- reserveData.variableRateSlope1,
139- reserveData.variableRateSlope2,
140- reserveData.stableRateSlope1,
141- reserveData.stableRateSlope2
142- ) = getInterestRateStrategySlopes (
143- DefaultReserveInterestRateStrategy (reserveData.interestRateStrategyAddress)
140+
141+ InterestRates memory interestRates = getInterestRateStrategySlopes (
142+ DefaultReserveInterestRateStrategy (reserveData.interestRateStrategyAddress), provider, reserveData.underlyingAsset
144143 );
144+
145+ reserveData.variableRateSlope1 = interestRates.variableRateSlope1;
146+ reserveData.variableRateSlope2 = interestRates.variableRateSlope2;
147+ reserveData.stableRateSlope1 = interestRates.stableRateSlope1;
148+ reserveData.stableRateSlope2 = interestRates.stableRateSlope2;
149+ reserveData.baseStableBorrowRate = interestRates.baseStableBorrowRate;
150+ reserveData.baseVariableBorrowRate = interestRates.baseVariableBorrowRate;
151+ reserveData.optimalUsageRatio = interestRates.optimalUsageRatio;
145152 }
146153
147154 BaseCurrencyInfo memory baseCurrencyInfo;
0 commit comments