Skip to content

Commit

Permalink
Merge from main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
devfans committed May 7, 2022
2 parents 2400b87 + aa3a4c7 commit 7c0bcd8
Show file tree
Hide file tree
Showing 25 changed files with 3,227 additions and 77 deletions.
42 changes: 38 additions & 4 deletions base/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func GetChainName(id uint64) string {
return "Poly"
case ETH:
return "Ethereum"
case RINKEBY:
return "Ethereum-Rinkeby"
case ONT:
return "Ontology"
case NEO:
Expand Down Expand Up @@ -108,6 +110,28 @@ func GetChainName(id uint64) string {
return "Metis"
case AVA:
return "Avalanche"
case BOBA:
return "Boba"
case PIXIE:
return "Pixie"
case OASIS:
return "Oasis"
case HSC:
return "Hsc"
case HARMONY:
return "Harmony"
case BYTOM:
return "Bytom"
case BCSPALETTE:
return "BCS Palette"
case KCC:
return "KCC"
case STARCOIN:
return "Starcoin"
case ONTEVM:
return "ONTEVM"
case MILKO:
return "Milkomeda"
default:
return fmt.Sprintf("Unknown(%d)", id)
}
Expand All @@ -119,14 +143,18 @@ func BlocksToSkip(chainId uint64) uint64 {
return 120
case ETH:
return 8
case BSC, HECO:
case BSC, HECO, HSC, BYTOM, KCC:
return 17
case O3:
return 8
case PLT:
case PLT, BCSPALETTE:
return 5
case ONT:
return 0
case PIXIE:
return 2
case STARCOIN:
return 70
default:
return 1
}
Expand All @@ -136,16 +164,22 @@ func BlocksToWait(chainId uint64) uint64 {
switch chainId {
case ETH:
return 12
case BSC, HECO:
case BSC, HECO, HSC, BYTOM, KCC:
return 21
case ONT, NEO, NEO3, OK, SWITCHEO:
return 1
case PLT:
case HARMONY:
return 2
case PLT, BCSPALETTE:
return 4
case O3:
return 12
case MATIC:
return 128
case PIXIE:
return 3
case STARCOIN:
return 72
default:
return 100000000
}
Expand Down
42 changes: 27 additions & 15 deletions base/devnet.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build devnet
// +build devnet

/*
Expand All @@ -20,26 +21,37 @@
package base

const (
POLY uint64 = 0
BTC uint64 = 1
ETH uint64 = 2
ONT uint64 = 3
NEO uint64 = 4
BSC uint64 = 6
HECO uint64 = 7
O3 uint64 = 80
NEO3 uint64 = 88
OK uint64 = 90
MATIC uint64 = 13
METIS uint64 = 300
POLY uint64 = 0
BTC uint64 = 1
ETH uint64 = 2
ONT uint64 = 3
NEO uint64 = 4
BSC uint64 = 6
HECO uint64 = 7
O3 uint64 = 80
NEO3 uint64 = 88
OK uint64 = 90
MATIC uint64 = 13
METIS uint64 = 300
PIXIE uint64 = 316
RINKEBY uint64 = 402
HSC uint64 = 603
BYTOM uint64 = 701
KCC uint64 = 900
ONTEVM uint64 = 5555

SWITCHEO uint64 = 1000
SWITCHEO uint64 = 1000
HARMONY uint64 = 801
BCSPALETTE uint64 = 1001
STARCOIN uint64 = 318

ENV = "devnet"
)

var CHAINS = []uint64{POLY, ETH, ONT, NEO, BSC, HECO, O3, OK, MATIC, METIS}
var CHAINS = []uint64{
POLY, ETH, ONT, NEO, BSC, HECO, O3, OK, MATIC, METIS, RINKEBY, PIXIE, HSC, HARMONY, BYTOM, STARCOIN, ONTEVM,
}

var ETH_CHAINS = []uint64{
ETH, BSC, HECO, OK, MATIC, O3, METIS,
ETH, BSC, HECO, OK, MATIC, O3, METIS, RINKEBY, PIXIE, HSC, HARMONY, BYTOM, KCC, ONTEVM,
}
20 changes: 18 additions & 2 deletions base/mainnet.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build mainnet
// +build mainnet

/*
Expand Down Expand Up @@ -41,14 +42,29 @@ const (
FANTOM uint64 = 22
OPTIMISM uint64 = 23
METIS uint64 = 24
BOBA uint64 = 25
OASIS uint64 = 26
HARMONY uint64 = 27
HSC uint64 = 28
BYTOM uint64 = 29
KCC uint64 = 30

// Invalid chain IDs
RINKEBY uint64 = 1000000
PIXIE uint64 = 2000000
BCSPALETTE uint64 = 1001001
STARCOIN uint64 = 1001002
ONTEVM uint64 = 1001333
MILKO uint64 = 1001335

ENV = "mainnet"
)

var CHAINS = []uint64{
POLY, ETH, BSC, HECO, OK, ONT, NEO, NEO3, HEIMDALL, MATIC, SWITCHEO, O3, PLT, ARBITRUM, XDAI, OPTIMISM, FANTOM, AVA, METIS,
POLY, ETH, BSC, HECO, OK, ONT, NEO, NEO3, HEIMDALL, MATIC, SWITCHEO, O3, PLT, ARBITRUM, XDAI, OPTIMISM, FANTOM, AVA,
METIS, BOBA, PIXIE, OASIS, HSC, HARMONY, BYTOM, BCSPALETTE, STARCOIN, ONTEVM, KCC, MILKO,
}

var ETH_CHAINS = []uint64{
ETH, BSC, HECO, OK, MATIC, O3, PLT, ARBITRUM, XDAI, OPTIMISM, FANTOM, AVA, METIS,
ETH, BSC, HECO, OK, MATIC, O3, PLT, ARBITRUM, XDAI, OPTIMISM, FANTOM, AVA, METIS, BOBA, PIXIE, OASIS, HSC, HARMONY, HARMONY, BYTOM, BCSPALETTE, KCC, ONTEVM, MILKO,
}
20 changes: 17 additions & 3 deletions base/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,30 @@ const (
FANTOM uint64 = 208
AVA uint64 = 209
METIS uint64 = 300
PIXIE uint64 = 316
BOBA uint64 = 400
RINKEBY uint64 = 402
OASIS uint64 = 500
HSC uint64 = 603
BYTOM uint64 = 701
HARMONY uint64 = 800
KCC uint64 = 900
ONTEVM uint64 = 333
MILKO uint64 = 810

SWITCHEO uint64 = 1000
SWITCHEO uint64 = 1000
BCSPALETTE uint64 = 1001
STARCOIN uint64 = 318

ENV = "testnet"
)

var CHAINS = []uint64{
POLY, ETH, BSC, HECO, OK, ONT, NEO, NEO3, HEIMDALL, MATIC, SWITCHEO, O3, PLT, ARBITRUM, XDAI, OPTIMISM, FANTOM, AVA, METIS,
POLY, ETH, BSC, HECO, OK, ONT, NEO, NEO3, HEIMDALL, MATIC, SWITCHEO, O3, PLT, ARBITRUM, XDAI, OPTIMISM, FANTOM, AVA,
METIS, RINKEBY, BOBA, PIXIE, OASIS, HSC, HARMONY, BYTOM, BCSPALETTE, STARCOIN, ONTEVM, KCC, MILKO,
}

var ETH_CHAINS = []uint64{
ETH, BSC, HECO, OK, MATIC, O3, PLT, ARBITRUM, XDAI, OPTIMISM, FANTOM, AVA, METIS,
ETH, BSC, HECO, OK, MATIC, O3, PLT, ARBITRUM, XDAI, OPTIMISM, FANTOM, AVA, METIS, RINKEBY, BOBA, PIXIE, OASIS, HSC,
HARMONY, HARMONY, BYTOM, BCSPALETTE, KCC, ONTEVM, MILKO,
}
2 changes: 1 addition & 1 deletion chains/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

func New(chainID uint64, urls []string, interval time.Duration) (sdk *chains.ChainSDK, err error) {
switch chainID {
case base.ETH, base.HECO, base.OK, base.BSC, base.MATIC:
case base.ETH, base.HECO, base.OK, base.BSC, base.MATIC, base.HSC:
sdk, err = chains.New(chainID, urls, interval, eth.New)
}
return
Expand Down
Loading

0 comments on commit 7c0bcd8

Please sign in to comment.