Skip to content

Commit

Permalink
feat: support anvil fork
Browse files Browse the repository at this point in the history
  • Loading branch information
5lliot committed Oct 8, 2023
1 parent 5b88927 commit f40cbfb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion core/schemas/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ func (c *Contract) DiscoverFirstLog() int64 {
}

func (c *Contract) findFirstLogBound(fromBlock, toBlock int64) (int64, error) {

query := ethereum.FilterQuery{
FromBlock: big.NewInt(fromBlock),
ToBlock: big.NewInt(toBlock),
Expand Down
4 changes: 2 additions & 2 deletions core/symbol.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ func GetAddrToSymbol(fileName string) map[common.Address]Symbol {
}

func GetSymToAddrByChainId(chainId int64) *SymTOAddrStore {
if chainId == 1337 {
if chainId == 1337 || chainId == 7878 {
chainId = 1
}
fileName := strings.ToLower(log.GetNetworkName(chainId)) + ".jsonnet"
return GetSymToAddrStore(fileName)
}

func GetAddrToSymbolByChainId(chainId int64) map[common.Address]Symbol {
if chainId == 1337 {
if chainId == 1337 || chainId == 7878 {
chainId = 1
}
fileName := strings.ToLower(log.GetNetworkName(chainId)) + ".jsonnet"
Expand Down
6 changes: 4 additions & 2 deletions core/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ type VersionType struct {
}

func NewVersion(v int16) VersionType {
if v == 1 || v == 2 || v == 3 {
if v == 1 || v == 2 || v == 300 {
return VersionType{v: v}
} else if v == 210 || v == 220 {
return VersionType{v: 2}
} else if v == 10_000 { // for testing
return VersionType{v: 10000}
}
log.Fatal("version not supported", v)
panic("")
Expand All @@ -49,7 +51,7 @@ func (v VersionType) Decimals() int8 {
switch v.v {
case 1:
return 18 // eth decimals
case 2:
case 2, 300:
return 8 // USD decimals
default:
log.Fatal("version not supported")
Expand Down
2 changes: 1 addition & 1 deletion utils/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/ethereum/go-ethereum/common"
)

func Contains(s []string, e string) bool {
func Contains[T comparable](s []T, e T) bool {
for _, a := range s {
if a == e {
return true
Expand Down

0 comments on commit f40cbfb

Please sign in to comment.