Documentation ¶
Overview ¶
Package router inits bridges and loads onchain configs.
Index ¶
- Variables
- func AddPausedChainIDs(chainIDs []string)
- func CallOnchainContract(data hexutil.Bytes, blockNumber string) (result []byte, err error)
- func DontPanicInLoading() bool
- func GetAllChainIDs() (chainIDs []*big.Int, err error)
- func GetAllTokenIDs() (tokenIDs []string, err error)
- func GetBridgeByChainID(chainID string) tokens.IBridge
- func GetCachedLatestBlockNumber(chainID string) uint64
- func GetCachedMultichainToken(tokenID, chainID string) (tokenAddr string)
- func GetCachedMultichainTokens(tokenID string) *sync.Map
- func GetChainConfig(chainID *big.Int) (*tokens.ChainConfig, error)
- func GetCustomConfig(chainID *big.Int, key string) (string, error)
- func GetExtraConfig(key string) (string, error)
- func GetFeeConfig(tokenID string, fromChainID, toChainID *big.Int) (*tokens.FeeConfig, error)
- func GetMPCPubkey(mpcAddress string) (pubkey string, err error)
- func GetMPCPublicKey(mpc string) string
- func GetMultichainToken(tokenID string, chainID *big.Int) (tokenAddr string, err error)
- func GetPausedChainIDs() []*big.Int
- func GetRouterMPC(tokenID, chainID string) (string, error)
- func GetSwapConfig(tokenID string, fromChainID, toChainID *big.Int) (*tokens.SwapConfig, error)
- func GetTokenConfig(chainID *big.Int, token string) (tokenCfg *tokens.TokenConfig, err error)
- func GetTokenRouterContract(tokenID, chainID string) (string, error)
- func InitOnchainCustomConfig(chainID *big.Int, tokenID string)
- func InitRouterConfigClients()
- func InitRouterConfigClientsWithArgs(configContract string, gateways []string)
- func InitWebSocketClients(wsServers []string) []*ethclient.Client
- func IsBigValueSwap(swapInfo *tokens.SwapTxInfo) bool
- func IsBlacklistSwap(swapInfo *tokens.SwapTxInfo) bool
- func IsChainIDExist(chainID *big.Int) (exist bool, err error)
- func IsChainIDPaused(chainID string) bool
- func IsNonceSupported(chainID string) bool
- func IsTokenIDExist(tokenID string) (exist bool, err error)
- func PrintMultichainTokens()
- func RemovePausedChainIDs(chainIDs []string)
- func SetBridge(chainID string, bridge tokens.IBridge)
- func SetMPCPublicKey(mpc, pubkey string)
- func SetMultichainToken(tokenID, chainID, tokenAddr string)
- func SetMultichainTokens(tokenID string, tokensMap *sync.Map)
- func SetRouterInfo(router, chainID string, routerInfo *SwapRouterInfo)
- func SubscribeRouterConfig(topics []ethcommon.Hash)
- func SubscribeUpdateConfig(callback func() bool)
- type ChainConfigInContract
- type FeeConfigInContract
- type MultichainToken
- type SwapConfigInContract
- type SwapRouterInfo
- type TokenConfigInContract
Constants ¶
This section is empty.
Variables ¶
var ( RouterBridges = new(sync.Map) // key is chainID MultichainTokens = new(sync.Map) // key is tokenID,chainID AllChainIDs []*big.Int // all chainIDs is retrieved only once AllTokenIDs []string // all tokenIDs can be reload MPCPublicKeys = new(sync.Map) // key is mpc address RouterInfos = new(sync.Map) // key is router contract address CachedLatestBlockNumber = new(sync.Map) // key is chainID IsIniting bool IsReloading bool RetryRPCCountInInit = 3 RetryRPCIntervalInInit = 3 * time.Second )
router bridges
Functions ¶
func AddPausedChainIDs ¶ added in v3.5.1
func AddPausedChainIDs(chainIDs []string)
AddPausedChainIDs add paused chainIDs
func CallOnchainContract ¶
CallOnchainContract call onchain contract
func DontPanicInLoading ¶ added in v3.6.0
func DontPanicInLoading() bool
DontPanicInLoading don't panic in loading
func GetBridgeByChainID ¶
GetBridgeByChainID get bridge by chain id
func GetCachedLatestBlockNumber ¶ added in v3.6.1
GetCachedLatestBlockNumber get cached latest block number
func GetCachedMultichainToken ¶
GetCachedMultichainToken get multichain token address by tokenid and chainid
func GetCachedMultichainTokens ¶
GetCachedMultichainTokens get multichain tokens of `tokenid`
func GetChainConfig ¶
func GetChainConfig(chainID *big.Int) (*tokens.ChainConfig, error)
GetChainConfig abi
func GetCustomConfig ¶
GetCustomConfig abi
func GetExtraConfig ¶ added in v3.6.0
GetExtraConfig abi
func GetFeeConfig ¶ added in v3.6.0
GetFeeConfig abi
func GetMPCPubkey ¶
GetMPCPubkey abi
func GetMPCPublicKey ¶ added in v3.5.0
GetMPCPublicKey get mpc puvlic key
func GetMultichainToken ¶
GetMultichainToken abi
func GetPausedChainIDs ¶ added in v3.5.1
GetPausedChainIDs get paused chainIDs
func GetRouterMPC ¶ added in v3.5.0
GetRouterMPC get router mpc on dest chain (to build swapin tx)
func GetSwapConfig ¶ added in v3.2.0
GetSwapConfig abi
func GetTokenConfig ¶
GetTokenConfig abi
func GetTokenRouterContract ¶ added in v3.5.0
GetTokenRouterContract get token router contract
func InitOnchainCustomConfig ¶ added in v3.6.1
InitOnchainCustomConfig init onchain custom config
func InitRouterConfigClients ¶
func InitRouterConfigClients()
InitRouterConfigClients init router config clients
func InitRouterConfigClientsWithArgs ¶
InitRouterConfigClientsWithArgs init standalone
func InitWebSocketClients ¶
InitWebSocketClients init
func IsBigValueSwap ¶ added in v3.4.0
func IsBigValueSwap(swapInfo *tokens.SwapTxInfo) bool
IsBigValueSwap is big value swap
func IsBlacklistSwap ¶ added in v3.4.0
func IsBlacklistSwap(swapInfo *tokens.SwapTxInfo) bool
IsBlacklistSwap is swap blacked
func IsChainIDExist ¶
IsChainIDExist abi
func IsChainIDPaused ¶ added in v3.5.1
IsChainIDPaused is chainID paused
func IsNonceSupported ¶ added in v3.6.1
IsNonceSupported is nonce supported
func IsTokenIDExist ¶
IsTokenIDExist abi
func RemovePausedChainIDs ¶ added in v3.5.1
func RemovePausedChainIDs(chainIDs []string)
RemovePausedChainIDs remove paused chainIDs
func SetMPCPublicKey ¶ added in v3.5.0
func SetMPCPublicKey(mpc, pubkey string)
SetMPCPublicKey set router mpc public key
func SetMultichainToken ¶ added in v3.5.2
func SetMultichainToken(tokenID, chainID, tokenAddr string)
SetMultichainToken set multichain token
func SetMultichainTokens ¶ added in v3.5.2
SetMultichainTokens set multichain tokens
func SetRouterInfo ¶ added in v3.5.0
func SetRouterInfo(router, chainID string, routerInfo *SwapRouterInfo)
SetRouterInfo set router info
func SubscribeRouterConfig ¶
SubscribeRouterConfig subscribe router config
func SubscribeUpdateConfig ¶
func SubscribeUpdateConfig(callback func() bool)
SubscribeUpdateConfig subscribe update ID and reload configs
Types ¶
type ChainConfigInContract ¶ added in v3.6.0
type ChainConfigInContract struct { ChainID string BlockChain string RouterContract string Confirmations uint64 InitialHeight uint64 Extra string }
ChainConfigInContract struct
func GetAllChainConfig ¶ added in v3.6.0
func GetAllChainConfig() ([]*ChainConfigInContract, error)
GetAllChainConfig abi
type FeeConfigInContract ¶ added in v3.6.0
type FeeConfigInContract struct { FromChainID *big.Int ToChainID *big.Int MaximumSwapFee *big.Int MinimumSwapFee *big.Int SwapFeeRatePerMillion uint64 }
FeeConfigInContract struct
func GetFeeConfigs ¶ added in v3.6.0
func GetFeeConfigs(tokenID string) ([]FeeConfigInContract, error)
GetFeeConfigs get fee configs by tokenID
type MultichainToken ¶
MultichainToken struct
func GetAllMultichainTokens ¶
func GetAllMultichainTokens(tokenID string) ([]MultichainToken, error)
GetAllMultichainTokens abi
type SwapConfigInContract ¶ added in v3.6.0
type SwapConfigInContract struct { FromChainID *big.Int ToChainID *big.Int MaximumSwap *big.Int MinimumSwap *big.Int BigValueThreshold *big.Int }
SwapConfigInContract struct
func GetSwapConfigs ¶ added in v3.6.0
func GetSwapConfigs(tokenID string) ([]SwapConfigInContract, error)
GetSwapConfigs get swap configs by tokenID
type SwapRouterInfo ¶ added in v3.5.0
SwapRouterInfo swap router info
func GetRouterInfo ¶ added in v3.5.0
func GetRouterInfo(router, chainID string) *SwapRouterInfo
GetRouterInfo get router info
func GetTokenRouterInfo ¶ added in v3.5.0
func GetTokenRouterInfo(tokenID, chainID string) (*SwapRouterInfo, error)
GetTokenRouterInfo get token router info
type TokenConfigInContract ¶ added in v3.6.0
type TokenConfigInContract struct { ChainID string Decimals uint8 ContractAddress string ContractVersion uint64 RouterContract string Extra string }
TokenConfigInContract struct
func GetAllMultichainTokenConfig ¶ added in v3.6.0
func GetAllMultichainTokenConfig(tokenID string) ([]*TokenConfigInContract, error)
GetAllMultichainTokenConfig abi