Skip to content

Commit

Permalink
from master trezor (#19)
Browse files Browse the repository at this point in the history
* eth(+testnet): 1.9.19->1.9.20

* bch(+testnet): 0.21.10->0.22.0

* Bump Groestlcoin backend version to 2.20.1

* Add fiat rates for Groestlcoin

* Go ethereum v1.9.20 (trezor#482) issue trezor#481

Handle different behavior of geth from v1.9.15
Bump go-ethereum dependecy to v1.9.20

Co-authored-by: 1000101 <[email protected]>
Co-authored-by: jackielove4u <[email protected]>
Co-authored-by: Martin <[email protected]>
  • Loading branch information
4 people authored Sep 3, 2020
1 parent 42eee6f commit 277f6d6
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 8 deletions.
14 changes: 11 additions & 3 deletions bchain/coins/eth/erc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,26 @@ func (b *EthereumRPC) EthereumTypeGetErc20ContractInfo(contractDesc bchain.Addre
address := EIP55Address(contractDesc)
data, err := b.ethCall(erc20NameSignature, address)
if err != nil {
return nil, err
// ignore the error from the eth_call - since geth v1.9.15 they changed the behavior
// and returning error "execution reverted" for some non contract addresses
// https://github.com/ethereum/go-ethereum/issues/21249#issuecomment-648647672
glog.Warning(errors.Annotatef(err, "erc20NameSignature %v", address))
return nil, nil
// return nil, errors.Annotatef(err, "erc20NameSignature %v", address)
}
name := parseErc20StringProperty(contractDesc, data)
if name != "" {
data, err = b.ethCall(erc20SymbolSignature, address)
if err != nil {
return nil, err
glog.Warning(errors.Annotatef(err, "erc20SymbolSignature %v", address))
return nil, nil
// return nil, errors.Annotatef(err, "erc20SymbolSignature %v", address)
}
symbol := parseErc20StringProperty(contractDesc, data)
data, err = b.ethCall(erc20DecimalsSignature, address)
if err != nil {
return nil, err
glog.Warning(errors.Annotatef(err, "erc20DecimalsSignature %v", address))
// return nil, errors.Annotatef(err, "erc20DecimalsSignature %v", address)
}
contract = &bchain.Erc20Contract{
Contract: address,
Expand Down
5 changes: 4 additions & 1 deletion configs/coins/groestlcoin.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
"xpub_magic_segwit_p2sh": 77429938,
"xpub_magic_segwit_native": 78792518,
"slip44": 17,
"additional_params": {}
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"groestlcoin\", \"periodSeconds\": 60}"
}
}
},
"meta": {
Expand Down
5 changes: 4 additions & 1 deletion configs/coins/groestlcoin_testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
"xpub_magic_segwit_p2sh": 71979618,
"xpub_magic_segwit_native": 73342198,
"slip44": 1,
"additional_params": {}
"additional_params": {
"fiat_rates": "coingecko",
"fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"groestlcoin\", \"periodSeconds\": 60}"
}
}
},
"meta": {
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/decred/dcrd/dcrjson v1.2.0
github.com/decred/dcrd/hdkeychain v1.1.1
github.com/decred/dcrd/txscript v1.1.0
github.com/ethereum/go-ethereum v1.8.20
github.com/ethereum/go-ethereum v1.9.20
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
Expand All @@ -38,9 +38,8 @@ require (
github.com/prometheus/procfs v0.0.10 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/schancel/cashaddr-converter v0.0.0-20180113210041-0a38f5822f79
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/tecbot/gorocksdb v0.0.0-20180907100951-214b6b7bc0f0
golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand Down
Loading

0 comments on commit 277f6d6

Please sign in to comment.