Skip to content

Commit 84fa41e

Browse files
committed
fix: return name on uipooldataprovider
1 parent 61c2273 commit 84fa41e

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

contracts/misc/UiPoolDataProviderV2V3.sol

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import {ReserveConfiguration} from '../protocol/libraries/configuration/ReserveC
1515
import {UserConfiguration} from '../protocol/libraries/configuration/UserConfiguration.sol';
1616
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
1717
import {IChainlinkAggregator} from '../interfaces/IChainlinkAggregator.sol';
18-
import {DefaultReserveInterestRateStrategy} from '../protocol/lendingpool/DefaultReserveInterestRateStrategy.sol';
18+
import {
19+
DefaultReserveInterestRateStrategy
20+
} from '../protocol/lendingpool/DefaultReserveInterestRateStrategy.sol';
1921
import {IERC20DetailedBytes} from './interfaces/IERC20DetailedBytes.sol';
2022

2123
contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
@@ -80,9 +82,8 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
8082
reserveData.underlyingAsset = reserves[i];
8183

8284
// reserve current state
83-
DataTypes.ReserveData memory baseData = lendingPool.getReserveData(
84-
reserveData.underlyingAsset
85-
);
85+
DataTypes.ReserveData memory baseData =
86+
lendingPool.getReserveData(reserveData.underlyingAsset);
8687
reserveData.liquidityIndex = baseData.liquidityIndex;
8788
reserveData.variableBorrowIndex = baseData.variableBorrowIndex;
8889
reserveData.liquidityRate = baseData.currentLiquidityRate;
@@ -111,9 +112,12 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
111112

112113
if (address(reserveData.underlyingAsset) == address(MKRAddress)) {
113114
bytes32 symbol = IERC20DetailedBytes(reserveData.underlyingAsset).symbol();
115+
bytes32 name = IERC20DetailedBytes(reserveData.underlyingAsset).name();
114116
reserveData.symbol = bytes32ToString(symbol);
117+
reserveData.name = bytes32ToString(name);
115118
} else {
116119
reserveData.symbol = IERC20Detailed(reserveData.underlyingAsset).symbol();
120+
reserveData.name = IERC20Detailed(reserveData.underlyingAsset).name();
117121
}
118122

119123
(
@@ -150,8 +154,8 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
150154
if (ETH_CURRENCY_UNIT == baseCurrencyUnit) {
151155
baseCurrencyInfo.marketReferenceCurrencyUnit = ETH_CURRENCY_UNIT;
152156
baseCurrencyInfo
153-
.marketReferenceCurrencyPriceInUsd = marketReferenceCurrencyPriceInUsdProxyAggregator
154-
.latestAnswer();
157+
.marketReferenceCurrencyPriceInUsd = marketReferenceCurrencyPriceInUsdProxyAggregator
158+
.latestAnswer();
155159
} else {
156160
baseCurrencyInfo.marketReferenceCurrencyUnit = baseCurrencyUnit;
157161
baseCurrencyInfo.marketReferenceCurrencyPriceInUsd = int256(baseCurrencyUnit);
@@ -178,9 +182,8 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
178182
address[] memory reserves = lendingPool.getReservesList();
179183
DataTypes.UserConfigurationMap memory userConfig = lendingPool.getUserConfiguration(user);
180184

181-
UserReserveData[] memory userReservesData = new UserReserveData[](
182-
user != address(0) ? reserves.length : 0
183-
);
185+
UserReserveData[] memory userReservesData =
186+
new UserReserveData[](user != address(0) ? reserves.length : 0);
184187

185188
for (uint256 i = 0; i < reserves.length; i++) {
186189
DataTypes.ReserveData memory baseData = lendingPool.getReserveData(reserves[i]);
@@ -194,16 +197,20 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
194197

195198
if (userConfig.isBorrowing(i)) {
196199
userReservesData[i].scaledVariableDebt = IVariableDebtToken(
197-
baseData.variableDebtTokenAddress
198-
).scaledBalanceOf(user);
200+
baseData
201+
.variableDebtTokenAddress
202+
)
203+
.scaledBalanceOf(user);
199204
userReservesData[i].principalStableDebt = IStableDebtToken(baseData.stableDebtTokenAddress)
200205
.principalBalanceOf(user);
201206
if (userReservesData[i].principalStableDebt != 0) {
202207
userReservesData[i].stableBorrowRate = IStableDebtToken(baseData.stableDebtTokenAddress)
203208
.getUserStableRate(user);
204209
userReservesData[i].stableBorrowLastUpdateTimestamp = IStableDebtToken(
205-
baseData.stableDebtTokenAddress
206-
).getUserLastUpdated(user);
210+
baseData
211+
.stableDebtTokenAddress
212+
)
213+
.getUserLastUpdated(user);
207214
}
208215
}
209216
}
@@ -223,4 +230,4 @@ contract UiPoolDataProviderV2V3 is IUiPoolDataProviderV3 {
223230
}
224231
return string(bytesArray);
225232
}
226-
}
233+
}

0 commit comments

Comments
 (0)