-
Notifications
You must be signed in to change notification settings - Fork 88
/
new.go
44 lines (41 loc) · 1.45 KB
/
new.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package bridge
import (
"math/big"
"github.com/anyswap/CrossChain-Router/v3/log"
"github.com/anyswap/CrossChain-Router/v3/tokens"
"github.com/anyswap/CrossChain-Router/v3/tokens/aptos"
"github.com/anyswap/CrossChain-Router/v3/tokens/btc"
"github.com/anyswap/CrossChain-Router/v3/tokens/cardano"
"github.com/anyswap/CrossChain-Router/v3/tokens/cosmos"
"github.com/anyswap/CrossChain-Router/v3/tokens/eth"
"github.com/anyswap/CrossChain-Router/v3/tokens/near"
"github.com/anyswap/CrossChain-Router/v3/tokens/ripple"
"github.com/anyswap/CrossChain-Router/v3/tokens/solana"
"github.com/anyswap/CrossChain-Router/v3/tokens/tron"
)
// NewCrossChainBridge new bridge
func NewCrossChainBridge(chainID *big.Int) tokens.IBridge {
switch {
case solana.SupportChainID(chainID):
return solana.NewCrossChainBridge()
case cosmos.SupportsChainID(chainID):
return cosmos.NewCrossChainBridge()
case btc.SupportsChainID(chainID):
return btc.NewCrossChainBridge()
case cardano.SupportsChainID(chainID):
return cardano.NewCrossChainBridge()
case aptos.SupportsChainID(chainID):
return aptos.NewCrossChainBridge()
case tron.SupportsChainID(chainID):
return tron.NewCrossChainBridge()
case near.SupportsChainID(chainID):
return near.NewCrossChainBridge()
case ripple.SupportsChainID(chainID):
return ripple.NewCrossChainBridge()
case chainID.Sign() <= 0:
log.Fatal("wrong chainID", "chainID", chainID)
default:
return eth.NewCrossChainBridge()
}
return nil
}