Merge branch 'fix/wallet-balance-provider' into 'master'

Change wallet balance provider to support eth

See merge request aave-tech/protocol-v2!132
This commit is contained in:
The-3D 2020-11-06 14:22:11 +00:00
commit 4de4d6cf96
4 changed files with 12 additions and 10 deletions

View File

@ -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';

View File

@ -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]);
}
}
}
}

View File

@ -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 {

View File

@ -1,6 +1,4 @@
import BigNumber from 'bignumber.js';
import {MockTokenMap} from './contracts-helpers';
import {UiPoolDataProviderFactory} from '../types';
export interface SymbolMap<T> {
[symbol: string]: T;