Documentation ¶
Index ¶
- Constants
- Variables
- func AllowCallByContract() bool
- func CallContractWithGateway(gateway, contract string, data hexutil.Bytes, blockNumber string) (result string, err error)
- func GetIdentifier() string
- func GetOnchainContract() string
- func HasRouterAdmin() bool
- func IsChainIDInBlackList(chainID string) bool
- func IsMPCInitiator(account string) bool
- func IsRouterAdmin(account string) bool
- func IsSwapInBlacklist(fromChainID, toChainID, tokenID string) bool
- func IsTokenIDInBlackList(tokenID string) bool
- func VersionWithCommit(gitCommit, gitDate string) string
- type APIServerConfig
- type MPCConfig
- type MPCNodeConfig
- type MongoDBConfig
- type OnchainConfig
- type RouterConfig
- type RouterServerConfig
Constants ¶
const ( VersionMajor = 3 // Major version component of the current release VersionMinor = 2 // Minor version component of the current release VersionPatch = 0 // Patch version component of the current release VersionMeta = "" // Version metadata to append to the version string )
version parts
const (
RouterSwapPrefixID = "routerswap"
)
router swap constants
Variables ¶
var Version = func() string { return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) }()
Version holds the textual version string.
var VersionWithMeta = func() string { v := Version if VersionMeta != "" { v += "-" + VersionMeta } return v }()
VersionWithMeta holds the textual version string including the metadata.
Functions ¶
func AllowCallByContract ¶ added in v3.2.1
func AllowCallByContract() bool
AllowCallByContract allow call into router from contract
func CallContractWithGateway ¶
func CallContractWithGateway(gateway, contract string, data hexutil.Bytes, blockNumber string) (result string, err error)
CallContractWithGateway call eth_call
func GetIdentifier ¶
func GetIdentifier() string
GetIdentifier get identifier (to distiguish in mpc accept)
func GetOnchainContract ¶
func GetOnchainContract() string
GetOnchainContract get onchain config contract address
func IsChainIDInBlackList ¶
IsChainIDInBlackList is chain id in black list
func IsMPCInitiator ¶
IsMPCInitiator is initiator of mpc sign
func IsSwapInBlacklist ¶
IsSwapInBlacklist is chain or token blacklisted
func IsTokenIDInBlackList ¶
IsTokenIDInBlackList is token id in black list
func VersionWithCommit ¶
VersionWithCommit add git commit and data to version.
Types ¶
type APIServerConfig ¶
APIServerConfig api service config
type MPCConfig ¶
type MPCConfig struct { APIPrefix string GroupID *string NeededOracles *uint32 TotalOracles *uint32 Mode uint32 // 0:managed 1:private (default 0) Initiators []string DefaultNode *MPCNodeConfig OtherNodes []*MPCNodeConfig `toml:",omitempty" json:",omitempty"` }
MPCConfig mpc related config
func (*MPCConfig) CheckConfig ¶
CheckConfig check mpc config
type MPCNodeConfig ¶
type MPCNodeConfig struct { RPCAddress *string SignGroups []string `toml:",omitempty" json:",omitempty"` KeystoreFile *string `json:"-"` PasswordFile *string `json:"-"` }
MPCNodeConfig mpc node config
func (*MPCNodeConfig) CheckConfig ¶
func (c *MPCNodeConfig) CheckConfig(isServer bool) (err error)
CheckConfig check mpc node config
type MongoDBConfig ¶
type MongoDBConfig struct { DBURL string DBName string UserName string `json:"-"` Password string `json:"-"` }
MongoDBConfig mongodb config
type OnchainConfig ¶
type OnchainConfig struct { Contract string APIAddress []string WSServers []string ReloadCycle uint64 // seconds }
OnchainConfig struct
func (*OnchainConfig) CheckConfig ¶
func (c *OnchainConfig) CheckConfig() error
CheckConfig check onchain config storing chain and token configs
type RouterConfig ¶
type RouterConfig struct { Server *RouterServerConfig `toml:",omitempty" json:",omitempty"` Identifier string MinReserveFee map[string]uint64 `toml:",omitempty" json:",omitempty"` Onchain *OnchainConfig Gateways map[string][]string // key is chain ID GatewaysExt map[string][]string `toml:",omitempty" json:",omitempty"` // key is chain ID MPC *MPCConfig AllowCallByContract bool }
RouterConfig config
func LoadRouterConfig ¶
func LoadRouterConfig(configFile string, isServer bool) *RouterConfig
LoadRouterConfig load router swap config
func (*RouterConfig) CheckConfig ¶
func (config *RouterConfig) CheckConfig(isServer bool) (err error)
CheckConfig check router config
type RouterServerConfig ¶
type RouterServerConfig struct { Admins []string MongoDB *MongoDBConfig APIServer *APIServerConfig ChainIDBlackList []string `toml:",omitempty" json:",omitempty"` TokenIDBlackList []string `toml:",omitempty" json:",omitempty"` // extras EnableReplaceSwap bool EnablePassBigValueSwap bool ReplacePlusGasPricePercent uint64 `toml:",omitempty" json:",omitempty"` WaitTimeToReplace int64 `toml:",omitempty" json:",omitempty"` // seconds MaxReplaceCount int `toml:",omitempty" json:",omitempty"` PlusGasPricePercentage uint64 `toml:",omitempty" json:",omitempty"` MaxPlusGasPricePercentage uint64 `toml:",omitempty" json:",omitempty"` MaxGasPriceFluctPercent uint64 `toml:",omitempty" json:",omitempty"` SwapDeadlineOffset int64 `toml:",omitempty" json:",omitempty"` // seconds DefaultGasLimit map[string]uint64 `toml:",omitempty" json:",omitempty"` }
RouterServerConfig only for server
func GetRouterServerConfig ¶
func GetRouterServerConfig() *RouterServerConfig
GetRouterServerConfig get router server config
func (*RouterServerConfig) CheckConfig ¶
func (s *RouterServerConfig) CheckConfig() error
CheckConfig of router server
func (*RouterServerConfig) CheckExtra ¶
func (s *RouterServerConfig) CheckExtra() error
CheckExtra check extra server config