From e32b62fb6f3a88d3e2f6b7883d44510a3752a227 Mon Sep 17 00:00:00 2001 From: andyk Date: Fri, 6 Nov 2020 15:51:08 +0300 Subject: [PATCH] add eth to the wallet balance provider --- contracts/misc/WalletBalanceProvider.sol | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/contracts/misc/WalletBalanceProvider.sol b/contracts/misc/WalletBalanceProvider.sol index 6bbb2970..44cf8649 100644 --- a/contracts/misc/WalletBalanceProvider.sol +++ b/contracts/misc/WalletBalanceProvider.sol @@ -25,6 +25,7 @@ contract WalletBalanceProvider { using ReserveConfiguration for ReserveConfiguration.Map; LendingPoolAddressesProvider internal immutable _provider; + address constant MOCK_ETH_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'; constructor(LendingPoolAddressesProvider provider) public { _provider = provider; @@ -91,11 +92,16 @@ contract WalletBalanceProvider { ILendingPool pool = ILendingPool(_provider.getLendingPool()); address[] memory reserves = pool.getReservesList(); + address[] memory reservesWithEth = new address[](reserves.length + 1); + for (uint256 i = 0; i < reserves.length; i++) { + reservesWithEth[i] = reserves[i]; + } + reservesWithEth[reserves.length] = MOCK_ETH_ADDRESS; - uint256[] memory balances = new uint256[](reserves.length); + uint256[] memory balances = new uint256[](reservesWithEth.length); - for (uint256 j = 0; j < reserves.length; j++) { - ReserveConfiguration.Map memory configuration = pool.getConfiguration(reserves[j]); + for (uint256 j = 0; j < reservesWithEth.length; j++) { + ReserveConfiguration.Map memory configuration = pool.getConfiguration(reservesWithEth[j]); (bool isActive, , , ) = configuration.getFlagsMemory();