fix: token override when scanning (#2910)
This commit is contained in:
parent
bef211b5d6
commit
37c9eb1a9d
|
@ -1,6 +1,9 @@
|
|||
package contracts
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
"github.com/status-im/status-go/contracts/directory"
|
||||
|
@ -159,6 +162,15 @@ func (c *ContractMaker) NewEthScan(chainID uint64) (*ethscan.BalanceScanner, err
|
|||
return nil, err
|
||||
}
|
||||
|
||||
bytecode, err := backend.CodeAt(context.Background(), contractAddr, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(bytecode) == 0 {
|
||||
return nil, errors.New("is not a contract")
|
||||
}
|
||||
|
||||
return ethscan.NewBalanceScanner(
|
||||
contractAddr,
|
||||
backend,
|
||||
|
|
|
@ -47,13 +47,13 @@ func NewTokenManager(
|
|||
networkManager *network.Manager,
|
||||
) *TokenManager {
|
||||
tokenManager := &TokenManager{db, RPCClient, networkManager}
|
||||
|
||||
// Check the networks' custom tokens to see if we must update the tokenStore
|
||||
networks := networkManager.GetConfiguredNetworks()
|
||||
for _, network := range networks {
|
||||
if len(network.TokenOverrides) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, overrideToken := range network.TokenOverrides {
|
||||
tokensMap, ok := tokenStore[network.ChainID]
|
||||
if !ok {
|
||||
|
|
Loading…
Reference in New Issue