mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
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:
commit
4de4d6cf96
|
@ -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';
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user