params

package
v0.0.0-...-2e4c1a8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2023 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TxSwapin            = "swapin"
	TxSwapout           = "swapout"
	TxSwapout2          = "swapout2" // swapout to string address (eg. BTC)
	TxRouterERC20Swap   = "routerswap"
	TxRouterNFTSwap     = "nftswap"
	TxRouterAnycallSwap = "anycallswap"
	TxRouterGas         = "gasswap"
)

swap tx types

View Source
const (
	VersionMajor = 0  // Major version component of the current release
	VersionMinor = 3  // Minor version component of the current release
	VersionPatch = 1  // Patch version component of the current release
	VersionMeta  = "" // Version metadata to append to the version string
)

version parts

Variables

View Source
var (
	HaveReloadConfig bool = false
)
View Source
var Version = func() string {
	v := fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

Version holds the textual version string.

Functions

func GetHaveReloadConfig

func GetHaveReloadConfig() bool

func ReloadConfig

func ReloadConfig()

ReloadConfig reload config

func UpdateHaveReloadConfig

func UpdateHaveReloadConfig(ok bool)

func WatchAndReloadScanConfig

func WatchAndReloadScanConfig(cf chan bool)

WatchAndReloadScanConfig reload scan config if modified

Types

type BlockChainConfig

type BlockChainConfig struct {
	Chain          string
	StableHeight   uint64
	ScanBackHeight uint64
	SyncNumber     uint64
}

func GetBlockChainConfig

func GetBlockChainConfig() *BlockChainConfig

GetBlockChainConfig get blockchain config

type Config

type Config struct {
	MongoDB    *MongoDBConfig
	BlockChain *BlockChainConfig
	Tokens     []*TokenConfig
}

type MongoDBConfig

type MongoDBConfig struct {
	DBURL    string
	DBName   string
	UserName string `json:"-"`
	Password string `json:"-"`
	Enable   bool
}

MongoDBConfig mongodb config

func GetMongodbConfig

func GetMongodbConfig() *MongoDBConfig

GetMongodbConfig get mongodb config

type ScanConfig

type ScanConfig struct {
	Tokens []*TokenConfig
}

ScanConfig scan config

func GetScanConfig

func GetScanConfig() *ScanConfig

GetScanConfig get scan config

func LoadConfig

func LoadConfig(filePath string) *ScanConfig

LoadConfig load config

func (*ScanConfig) CheckConfig

func (c *ScanConfig) CheckConfig() (err error)

CheckConfig check scan config

type TokenConfig

type TokenConfig struct {
	// common
	TxType         string
	SwapServer     string
	CallByContract string   `toml:",omitempty" json:",omitempty"`
	Whitelist      []string `toml:",omitempty" json:",omitempty"`

	// bridge
	PairID         string `toml:",omitempty" json:",omitempty"`
	TokenAddress   string `toml:",omitempty" json:",omitempty"`
	DepositAddress string `toml:",omitempty" json:",omitempty"`

	// router
	ChainID        string `toml:",omitempty" json:",omitempty"`
	RouterContract string `toml:",omitempty" json:",omitempty"`
}

TokenConfig token config

func (*TokenConfig) CheckConfig

func (c *TokenConfig) CheckConfig() error

CheckConfig check token config

func (*TokenConfig) IsBridgeSwap

func (c *TokenConfig) IsBridgeSwap() bool

IsBridgeSwap is bridge swap

func (*TokenConfig) IsNativeToken

func (c *TokenConfig) IsNativeToken() bool

IsNativeToken is native token

func (*TokenConfig) IsRouterAnycallSwap

func (c *TokenConfig) IsRouterAnycallSwap() bool

IsRouterAnycallSwap is router nft swap

func (*TokenConfig) IsRouterERC20Swap

func (c *TokenConfig) IsRouterERC20Swap() bool

IsRouterERC20Swap is router erc20 swap

func (*TokenConfig) IsRouterNFTSwap

func (c *TokenConfig) IsRouterNFTSwap() bool

IsRouterNFTSwap is router nft swap

func (*TokenConfig) IsRouterSwap

func (c *TokenConfig) IsRouterSwap() bool

IsRouterSwap is router swap

func (*TokenConfig) IsRouterSwapAll

func (c *TokenConfig) IsRouterSwapAll() bool

IsRouterSwap is router swap

func (*TokenConfig) IsValidSwapType

func (c *TokenConfig) IsValidSwapType() bool

IsValidSwapType is valid swap type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL