Documentation
¶
Overview ¶
Package params provides common version info and config items.
Index ¶
- Constants
- Variables
- func CheckConfig(isServer bool) (err error)
- func EnableCheckBlockFork() bool
- func GetAPIPort() int
- func GetDataDir() string
- func GetIdentifier() string
- func GetReplaceIdentifier() string
- func GetTokenPriceConfig() *tokens.TokenPriceConfig
- func HasAdmin() bool
- func IsAdmin(account string) bool
- func IsDcrmEnabled() bool
- func IsDcrmInitiator(account string) bool
- func IsDebugMode() bool
- func IsNullSwapoutNativeMemo() bool
- func IsSwapoutToStringAddress() bool
- func MustRegisterAccount() bool
- func SetConfig(config *BridgeConfig)
- func SetDataDir(dir string)
- func VersionWithCommit(gitCommit, gitDate string) string
- type APIServerConfig
- type BridgeConfig
- type DcrmConfig
- type DcrmNodeConfig
- type ExtraConfig
- type MongoDBConfig
- type OracleConfig
- type ServerConfig
Constants ¶
const ( VersionMajor = 0 // Major version component of the current release VersionMinor = 3 // Minor version component of the current release VersionPatch = 9 // Patch version component of the current release VersionMeta = "" // Version metadata to append to the version string )
version parts
Variables ¶
var ( // IsSwapServer if true then it's swap server, otherwise it's swap oracle IsSwapServer bool // ServerAPIAddress server api address ServerAPIAddress string // GetBalanceBlockNumberOpt pending or latest GetBalanceBlockNumberOpt = "latest" )
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 EnableCheckBlockFork ¶
func EnableCheckBlockFork() bool
EnableCheckBlockFork enable check block fork
func GetIdentifier ¶
func GetIdentifier() string
GetIdentifier get identifier (to distiguish in dcrm accept)
func GetReplaceIdentifier ¶
func GetReplaceIdentifier() string
GetReplaceIdentifier get identifier (to distiguish in dcrm accept)
func GetTokenPriceConfig ¶
func GetTokenPriceConfig() *tokens.TokenPriceConfig
GetTokenPriceConfig get token price config
func IsDcrmInitiator ¶
IsDcrmInitiator is initiator of dcrm sign
func IsNullSwapoutNativeMemo ¶
func IsNullSwapoutNativeMemo() bool
IsNullSwapoutNativeMemo set no unlock memo in building swapout tx
func IsSwapoutToStringAddress ¶
func IsSwapoutToStringAddress() bool
IsSwapoutToStringAddress swapout to string address (eg. btc)
func VersionWithCommit ¶
VersionWithCommit add git commit and data to version.
Types ¶
type APIServerConfig ¶
APIServerConfig api service config
type BridgeConfig ¶
type BridgeConfig struct {
Identifier string
SrcChain *tokens.ChainConfig
SrcGateway *tokens.GatewayConfig
DestChain *tokens.ChainConfig
DestGateway *tokens.GatewayConfig
TokenPrice *tokens.TokenPriceConfig
Server *ServerConfig `toml:",omitempty" json:",omitempty"`
Oracle *OracleConfig `toml:",omitempty" json:",omitempty"`
BtcExtra *tokens.BtcExtraConfig `toml:",omitempty" json:",omitempty"`
Extra *ExtraConfig `toml:",omitempty" json:",omitempty"`
Dcrm *DcrmConfig `toml:",omitempty" json:",omitempty"`
}
BridgeConfig config items (decode from toml file)
func LoadConfig ¶
func LoadConfig(configFile string, isServer bool) *BridgeConfig
LoadConfig load config
type DcrmConfig ¶
type DcrmConfig struct {
Disable bool
APIPrefix string
RPCTimeout uint64
SignTimeout uint64
GroupID *string
NeededOracles *uint32
TotalOracles *uint32
Mode uint32 // 0:managed 1:private (default 0)
Initiators []string
DefaultNode *DcrmNodeConfig
OtherNodes []*DcrmNodeConfig `toml:",omitempty" json:",omitempty"`
}
DcrmConfig dcrm related config
func (*DcrmConfig) CheckConfig ¶
func (c *DcrmConfig) CheckConfig(isServer bool) (err error)
CheckConfig check dcrm config
type DcrmNodeConfig ¶
type DcrmNodeConfig struct {
RPCAddress *string
SignGroups []string `toml:",omitempty" json:",omitempty"`
KeystoreFile *string `json:"-"`
PasswordFile *string `json:"-"`
}
DcrmNodeConfig dcrm node config
func (*DcrmNodeConfig) CheckConfig ¶
func (c *DcrmNodeConfig) CheckConfig(isServer bool) (err error)
CheckConfig check dcrm node config
type ExtraConfig ¶
type ExtraConfig struct {
IsDebugMode bool `toml:",omitempty" json:",omitempty"`
MustRegisterAccount bool
IsSwapoutToStringAddress bool `toml:",omitempty" json:",omitempty"`
EnableCheckBlockFork bool
IsNullSwapoutNativeMemo bool `toml:",omitempty" json:",omitempty"`
UsePendingBalance bool `toml:",omitempty" json:",omitempty"`
}
ExtraConfig extra config
func (*ExtraConfig) CheckConfig ¶
func (c *ExtraConfig) CheckConfig() (err error)
CheckConfig extra config
type MongoDBConfig ¶
type MongoDBConfig struct {
DBURL string `toml:",omitempty" json:",omitempty"`
DBURLs []string `toml:",omitempty" json:",omitempty"`
DBName string
UserName string `json:"-"`
Password string `json:"-"`
}
MongoDBConfig mongodb config
func (*MongoDBConfig) CheckConfig ¶
func (c *MongoDBConfig) CheckConfig() error
CheckConfig check mongodb config
type OracleConfig ¶
OracleConfig oracle config
func (*OracleConfig) CheckConfig ¶
func (c *OracleConfig) CheckConfig() (err error)
CheckConfig check oracle config
type ServerConfig ¶
type ServerConfig struct {
MongoDB *MongoDBConfig `toml:",omitempty" json:",omitempty"`
APIServer *APIServerConfig `toml:",omitempty" json:",omitempty"`
Admins []string `toml:",omitempty" json:",omitempty"`
}
ServerConfig swap server config
func (*ServerConfig) CheckConfig ¶
func (c *ServerConfig) CheckConfig() error
CheckConfig check swap server config