From 7cb042517f5c41bf84eb24704878616a6c9d3e77 Mon Sep 17 00:00:00 2001 From: andyk Date: Fri, 6 Nov 2020 17:06:52 +0300 Subject: [PATCH 1/2] change wallet balance provider to support eth --- contracts/misc/UiPoolDataProvider.sol | 2 +- contracts/misc/WalletBalanceProvider.sol | 14 +++++++++----- .../misc/{ => interfaces}/IUiPoolDataProvider.sol | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) rename contracts/misc/{ => interfaces}/IUiPoolDataProvider.sol (93%) diff --git a/contracts/misc/UiPoolDataProvider.sol b/contracts/misc/UiPoolDataProvider.sol index 4a271cdf..ff731fff 100644 --- a/contracts/misc/UiPoolDataProvider.sol +++ b/contracts/misc/UiPoolDataProvider.sol @@ -3,7 +3,7 @@ pragma solidity ^0.6.8; pragma experimental ABIEncoderV2; import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol'; -import {IUiPoolDataProvider} from './IUiPoolDataProvider.sol'; +import {IUiPoolDataProvider} from './interfaces/IUiPoolDataProvider.sol'; import {ILendingPool} from '../interfaces/ILendingPool.sol'; import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol'; import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol'; diff --git a/contracts/misc/WalletBalanceProvider.sol b/contracts/misc/WalletBalanceProvider.sol index 44cf8649..bf3f0aaa 100644 --- a/contracts/misc/WalletBalanceProvider.sol +++ b/contracts/misc/WalletBalanceProvider.sol @@ -25,7 +25,7 @@ contract WalletBalanceProvider { using ReserveConfiguration for ReserveConfiguration.Map; LendingPoolAddressesProvider internal immutable _provider; - address constant MOCK_ETH_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'; + address constant MOCK_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; constructor(LendingPoolAddressesProvider provider) public { _provider = provider; @@ -69,11 +69,15 @@ contract WalletBalanceProvider { for (uint256 i = 0; i < users.length; i++) { for (uint256 j = 0; j < tokens.length; j++) { - uint256 _offset = i * tokens.length; - if (!tokens[j].isContract()) { - revert('INVALID_TOKEN'); + uint256 offset = i * tokens.length; + if (tokens[j] == MOCK_ETH_ADDRESS) { + balances[offset + j] = users[i].balance; // ETH balance } else { - balances[_offset + j] = balanceOf(users[i], tokens[j]); + if (!tokens[j].isContract()) { + revert('INVALID_TOKEN'); + } else { + balances[offset + j] = balanceOf(users[i], tokens[j]); + } } } } diff --git a/contracts/misc/IUiPoolDataProvider.sol b/contracts/misc/interfaces/IUiPoolDataProvider.sol similarity index 93% rename from contracts/misc/IUiPoolDataProvider.sol rename to contracts/misc/interfaces/IUiPoolDataProvider.sol index 64540ec2..d1ca0269 100644 --- a/contracts/misc/IUiPoolDataProvider.sol +++ b/contracts/misc/interfaces/IUiPoolDataProvider.sol @@ -2,8 +2,8 @@ pragma solidity ^0.6.8; pragma experimental ABIEncoderV2; -import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol'; -import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol'; +import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol'; +import {ReserveLogic} from '../../libraries/logic/ReserveLogic.sol'; interface IUiPoolDataProvider { struct AggregatedReserveData { From 442847dc1db332f71a568f8c178428d7623d4387 Mon Sep 17 00:00:00 2001 From: andyk Date: Fri, 6 Nov 2020 17:18:13 +0300 Subject: [PATCH 2/2] fix types issue --- helpers/types.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/helpers/types.ts b/helpers/types.ts index e1124117..df6f4afc 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -1,6 +1,4 @@ import BigNumber from 'bignumber.js'; -import {MockTokenMap} from './contracts-helpers'; -import {UiPoolDataProviderFactory} from '../types'; export interface SymbolMap { [symbol: string]: T;