mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
change wallet balance provider to support eth
This commit is contained in:
parent
d599dee431
commit
7cb042517f
|
@ -3,7 +3,7 @@ pragma solidity ^0.6.8;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {IUiPoolDataProvider} from './IUiPoolDataProvider.sol';
|
import {IUiPoolDataProvider} from './interfaces/IUiPoolDataProvider.sol';
|
||||||
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
||||||
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
||||||
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
||||||
|
|
|
@ -25,7 +25,7 @@ contract WalletBalanceProvider {
|
||||||
using ReserveConfiguration for ReserveConfiguration.Map;
|
using ReserveConfiguration for ReserveConfiguration.Map;
|
||||||
|
|
||||||
LendingPoolAddressesProvider internal immutable _provider;
|
LendingPoolAddressesProvider internal immutable _provider;
|
||||||
address constant MOCK_ETH_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
address constant MOCK_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
|
||||||
|
|
||||||
constructor(LendingPoolAddressesProvider provider) public {
|
constructor(LendingPoolAddressesProvider provider) public {
|
||||||
_provider = provider;
|
_provider = provider;
|
||||||
|
@ -69,11 +69,15 @@ contract WalletBalanceProvider {
|
||||||
|
|
||||||
for (uint256 i = 0; i < users.length; i++) {
|
for (uint256 i = 0; i < users.length; i++) {
|
||||||
for (uint256 j = 0; j < tokens.length; j++) {
|
for (uint256 j = 0; j < tokens.length; j++) {
|
||||||
uint256 _offset = i * tokens.length;
|
uint256 offset = i * tokens.length;
|
||||||
if (!tokens[j].isContract()) {
|
if (tokens[j] == MOCK_ETH_ADDRESS) {
|
||||||
revert('INVALID_TOKEN');
|
balances[offset + j] = users[i].balance; // ETH balance
|
||||||
} else {
|
} 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 solidity ^0.6.8;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
|
import {ReserveLogic} from '../../libraries/logic/ReserveLogic.sol';
|
||||||
|
|
||||||
interface IUiPoolDataProvider {
|
interface IUiPoolDataProvider {
|
||||||
struct AggregatedReserveData {
|
struct AggregatedReserveData {
|
Loading…
Reference in New Issue
Block a user