[#4646] Return l2 block number when calling BalanceChecker on Arbitrum (#4668)

This commit is contained in:
Roman Volosovskyi 2024-02-02 12:52:52 +01:00 committed by GitHub
parent 9b10b29da2
commit d5a10a97f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 17 deletions

View File

@ -11,12 +11,12 @@ var errorNotAvailableOnChainID = errors.New("BalanceChecker not available for ch
var contractDataByChainID = map[uint64]common.Address{
1: common.HexToAddress("0x040EA8bFE441597849A9456182fa46D38B75BC05"), // mainnet
10: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // optimism
42161: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // arbitrum
42161: common.HexToAddress("0x54764eF12d29b249fDC7FC3caDc039955A396A8e"), // arbitrum
5: common.HexToAddress("0xA5522A3194B78Dd231b64d0ccd6deA6156DCa7C8"), // goerli
421613: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // goerli arbitrum
421613: common.HexToAddress("0x54764eF12d29b249fDC7FC3caDc039955A396A8e"), // goerli arbitrum
420: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // goerli optimism
11155111: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // sepolia
421614: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // sepolia arbitrum
421614: common.HexToAddress("0x54764eF12d29b249fDC7FC3caDc039955A396A8e"), // sepolia arbitrum
11155420: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // sepolia optimism
777333: common.HexToAddress("0x0000000000000000000000000000000010777333"), // unit tests
}

View File

@ -20,7 +20,6 @@ import (
"github.com/status-im/status-go/services/wallet/async"
"github.com/status-im/status-go/services/wallet/balance"
"github.com/status-im/status-go/services/wallet/blockchainstate"
walletcommon "github.com/status-im/status-go/services/wallet/common"
"github.com/status-im/status-go/services/wallet/token"
"github.com/status-im/status-go/services/wallet/walletevent"
"github.com/status-im/status-go/transactions"
@ -72,19 +71,6 @@ func (c *findNewBlocksCommand) detectTransfers(parent context.Context, accounts
return nil, nil, err
}
networkID := c.chainClient.NetworkID()
// TODO(rasom): remove this as soon as BalanceChecker contract for
// Arbitrum networks will return l2 block number instead of l1
if networkID == walletcommon.ArbitrumMainnet || networkID == walletcommon.ArbitrumGoerli || networkID == walletcommon.ArbitrumSepolia {
header, err := c.chainClient.HeaderByNumber(context.Background(), nil)
if err != nil {
log.Error("findNewBlocksCommand error getting header", "error", err, "chain", c.chainClient.NetworkID())
return nil, nil, err
}
blockNum = header.Number
}
addressesToCheck := []common.Address{}
for idx, account := range accounts {
blockRange, err := c.blockRangeDAO.getBlockRange(c.chainClient.NetworkID(), account)