feat: updated with mkr symbol case

This commit is contained in:
sendra 2021-10-29 20:21:55 +02:00
parent 52443dcd58
commit 92155c1017
2 changed files with 17 additions and 6 deletions

View File

@ -18,6 +18,7 @@ import {IChainlinkAggregator} from '../interfaces/IChainlinkAggregator.sol';
import { import {
DefaultReserveInterestRateStrategy DefaultReserveInterestRateStrategy
} from '../protocol/lendingpool/DefaultReserveInterestRateStrategy.sol'; } from '../protocol/lendingpool/DefaultReserveInterestRateStrategy.sol';
import {IERC20DetailedBytes} from './interfaces/IERC20DetailedBytes.sol';
contract UiPoolDataProvider is IUiPoolDataProvider { contract UiPoolDataProvider is IUiPoolDataProvider {
using WadRayMath for uint256; using WadRayMath for uint256;
@ -111,7 +112,13 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
.scaledTotalSupply(); .scaledTotalSupply();
// we're getting this info from the aToken, because some of assets can be not compliant with ETC20Detailed // we're getting this info from the aToken, because some of assets can be not compliant with ETC20Detailed
reserveData.symbol = IERC20Detailed(reserveData.underlyingAsset).symbol(); try IERC20Detailed(reserveData.underlyingAsset).symbol() returns (string memory symbol) {
reserveData.symbol = symbol;
} catch (bytes memory /*lowLevelData*/) {
bytes32 symbol = IERC20DetailedBytes(reserveData.underlyingAsset).symbol();
reserveData.symbol = string(abi.encodePacked(symbol));
}
// reserveData.symbol = IERC20Detailed(reserveData.underlyingAsset).symbol();
reserveData.name = ''; reserveData.name = '';
( (

View File

@ -1,8 +1,12 @@
// SPDX-License-Identifier: agpl-3.0 // SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12; pragma solidity 0.6.12;
contract IERC20DetailedBytes { import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
bytes32 public name;
bytes32 public symbol; interface IERC20DetailedBytes is IERC20 {
uint256 public decimals; function name() external view returns (bytes32);
}
function symbol() external view returns (bytes32);
function decimals() external view returns (uint8);
}