@@ -17,6 +17,7 @@ import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
1717import {IChainlinkAggregator} from '../interfaces/IChainlinkAggregator.sol ' ;
1818import {DefaultReserveInterestRateStrategy} from '../protocol/lendingpool/DefaultReserveInterestRateStrategy.sol ' ;
1919import {IERC20DetailedBytes } from './interfaces/IERC20DetailedBytes.sol ' ;
20+ import {ILendingRateOracle} from '../interfaces/ILendingRateOracle.sol ' ;
2021
2122contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
2223 using WadRayMath for uint256 ;
@@ -36,24 +37,23 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
3637 marketReferenceCurrencyPriceInUsdProxyAggregator = _marketReferenceCurrencyPriceInUsdProxyAggregator;
3738 }
3839
39- function getInterestRateStrategySlopes (DefaultReserveInterestRateStrategy interestRateStrategy )
40+ function getInterestRateStrategySlopes (DefaultReserveInterestRateStrategy interestRateStrategy , ILendingPoolAddressesProvider provider , address reserve )
4041 internal
4142 view
42- returns (
43- uint256 ,
44- uint256 ,
45- uint256 ,
46- uint256 ,
47- uint256
48- )
43+ returns (InterestRates memory )
4944 {
50- return (
51- interestRateStrategy.variableRateSlope1 (),
52- interestRateStrategy.variableRateSlope2 (),
53- interestRateStrategy.stableRateSlope1 (),
54- interestRateStrategy.stableRateSlope2 (),
55- interestRateStrategy.OPTIMAL_UTILIZATION_RATE ()
56- );
45+ InterestRates memory interestRates;
46+ interestRates.variableRateSlope1 = interestRateStrategy.variableRateSlope1 ();
47+ interestRates.variableRateSlope2 = interestRateStrategy.variableRateSlope2 ();
48+ interestRates.stableRateSlope1 = interestRateStrategy.stableRateSlope1 ();
49+ interestRates.stableRateSlope2 = interestRateStrategy.stableRateSlope2 ();
50+ interestRates.baseVariableBorrowRate = interestRateStrategy.baseVariableBorrowRate ();
51+ interestRates.optimalUsageRatio = interestRateStrategy.OPTIMAL_UTILIZATION_RATE ();
52+
53+ interestRates.baseStableBorrowRate = ILendingRateOracle (provider.getLendingRateOracle ())
54+ .getMarketBorrowRate (reserve);
55+
56+ return interestRates;
5757 }
5858
5959 function getReservesList (ILendingPoolAddressesProvider provider )
@@ -133,15 +133,18 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
133133 reserveData.stableBorrowRateEnabled
134134 ) = baseData.configuration.getFlagsMemory ();
135135 reserveData.usageAsCollateralEnabled = reserveData.baseLTVasCollateral != 0 ;
136- (
137- reserveData.variableRateSlope1,
138- reserveData.variableRateSlope2,
139- reserveData.stableRateSlope1,
140- reserveData.stableRateSlope2,
141- reserveData.optimalUsageRatio
142- ) = getInterestRateStrategySlopes (
143- DefaultReserveInterestRateStrategy (reserveData.interestRateStrategyAddress)
136+
137+ InterestRates memory interestRates = getInterestRateStrategySlopes (
138+ DefaultReserveInterestRateStrategy (reserveData.interestRateStrategyAddress), provider, reserveData.underlyingAsset
144139 );
140+
141+ reserveData.variableRateSlope1 = interestRates.variableRateSlope1;
142+ reserveData.variableRateSlope2 = interestRates.variableRateSlope2;
143+ reserveData.stableRateSlope1 = interestRates.stableRateSlope1;
144+ reserveData.stableRateSlope2 = interestRates.stableRateSlope2;
145+ reserveData.baseStableBorrowRate = interestRates.baseStableBorrowRate;
146+ reserveData.baseVariableBorrowRate = interestRates.baseVariableBorrowRate;
147+ reserveData.optimalUsageRatio = interestRates.optimalUsageRatio;
145148 }
146149
147150 BaseCurrencyInfo memory baseCurrencyInfo;
0 commit comments