params

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

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

version parts

Variables

View Source
var (
	AllExchanges = make(map[common.Address]struct{})
	AllTokens    = make(map[common.Address]struct{})
)

all exchanges and tokens of configed factories

View Source
var Version = func() string {
	return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
}()

Version holds the textual version string.

View Source
var VersionWithMeta = func() string {
	v := Version
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

VersionWithMeta holds the textual version string including the metadata.

Functions

func AddTokenAndExchange added in v0.1.5

func AddTokenAndExchange(token, exchange common.Address)

AddTokenAndExchange add token and exchange

func ArchiveVersion

func ArchiveVersion(gitCommit string) string

ArchiveVersion holds the textual version string used for Geth archives. e.g. "1.8.11-dea1ce05" for stable releases, or

"1.8.13-unstable-21c059b6" for unstable releases

func CheckConfig

func CheckConfig() (err error)

CheckConfig check config

func GetAverageBlockTime

func GetAverageBlockTime() uint64

GetAverageBlockTime average block time

func GetConfigedExchange

func GetConfigedExchange(token string) string

GetConfigedExchange get configed exchange

func GetDustRewardThreshold added in v0.1.4

func GetDustRewardThreshold() *big.Int

GetDustRewardThreshold get dust reward threshold

func GetExchangePairs

func GetExchangePairs(exchange string) string

GetExchangePairs get pairs from config

func GetExchangeToken

func GetExchangeToken(exchange string) string

GetExchangeToken get exchane token from config

func GetFactories added in v0.1.4

func GetFactories() []common.Address

GetFactories get facotries

func GetMinExchangeCreationHeight

func GetMinExchangeCreationHeight() uint64

GetMinExchangeCreationHeight get minimum exchange creation height

func GetTokenAddress

func GetTokenAddress(exchange string) string

GetTokenAddress get token address from config

func IsConfigedExchange

func IsConfigedExchange(exchange string) bool

IsConfigedExchange return true if exchange is configed

func IsConfigedFactory added in v0.1.5

func IsConfigedFactory(factory common.Address) bool

IsConfigedFactory is configed factory

func IsConfigedToken

func IsConfigedToken(token string) bool

IsConfigedToken return true if token is configed

func IsExcludedRewardAccount

func IsExcludedRewardAccount(account common.Address) bool

IsExcludedRewardAccount is excluded

func IsInAllExchanges added in v0.1.5

func IsInAllExchanges(exchange common.Address) bool

IsInAllExchanges is in all exchanges

func IsInAllTokenAndExchanges added in v0.1.5

func IsInAllTokenAndExchanges(address common.Address) bool

IsInAllTokenAndExchanges is in all exchanges or tokens

func IsInAllTokens added in v0.1.5

func IsInAllTokens(token common.Address) bool

IsInAllTokens is exchange token

func IsInStakerList added in v0.1.5

func IsInStakerList(account common.Address) bool

IsInStakerList in in staker list

func IsRecordTokenAccount

func IsRecordTokenAccount() bool

IsRecordTokenAccount is record token account

func IsScanAllExchange

func IsScanAllExchange() bool

IsScanAllExchange is scan all exchange

func SetConfig

func SetConfig(cfg *Config)

SetConfig set config items

func SetDustRewardThreshold added in v0.1.4

func SetDustRewardThreshold(dustThreshold string)

SetDustRewardThreshold set dust reward threshold

func VersionWithCommit

func VersionWithCommit(gitCommit, gitDate string) string

VersionWithCommit add git commit and data to version.

Types

type Config

type Config struct {
	MongoDB    *MongoDBConfig
	Gateway    *GatewayConfig
	Sync       *SyncConfig
	Distribute *DistributeConfig
	Exchanges  []*ExchangeConfig
	Factories  []string
	Stake      *StakeConfig
}

Config config

func GetConfig

func GetConfig() *Config

GetConfig get config items structure

func LoadConfig

func LoadConfig(configFile string) *Config

LoadConfig load config

type DistributeConfig

type DistributeConfig struct {
	Enable      bool
	ArchiveMode bool

	RewardToken  string
	StartHeight  uint64
	StableHeight uint64
	GasLimit     uint64
	GasPrice     string

	ByLiquidCycle   uint64
	ByLiquidRewards string // unit Wei

	ByVolumeCycle   uint64
	ByVolumeRewards string // unit Wei

	QuickSettleVolumeRewards bool
	DustRewardThreshold      string

	// use time measurement instead of block height
	UseTimeMeasurement    bool
	StartTimestamp        uint64 // unix timestamp
	StableDuration        uint64 // unit of seconds
	ByLiquidCycleDuration uint64 // unit of seconds
	ByVolumeCycleDuration uint64 // unit of seconds

	TradeWeightIsPercentage bool
}

DistributeConfig distribute config

func (*DistributeConfig) GetByLiquidCycleRewards

func (dist *DistributeConfig) GetByLiquidCycleRewards() *big.Int

GetByLiquidCycleRewards get non nil big int from string

func (*DistributeConfig) GetByVolumeCycleRewards

func (dist *DistributeConfig) GetByVolumeCycleRewards() *big.Int

GetByVolumeCycleRewards get non nil big int from string

func (*DistributeConfig) GetDustRewardThreshold added in v0.1.4

func (dist *DistributeConfig) GetDustRewardThreshold() *big.Int

GetDustRewardThreshold get dust reward threshold

type ExchangeConfig

type ExchangeConfig struct {
	Pairs          string
	Exchange       string
	Token          string
	CreationHeight uint64
	LiquidWeight   uint64
	TradeWeight    uint64
}

ExchangeConfig exchange config

type GatewayConfig

type GatewayConfig struct {
	APIAddress       string
	AverageBlockTime uint64
}

GatewayConfig struct

type MongoDBConfig

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

MongoDBConfig mongodb config

type StakeConfig added in v0.1.5

type StakeConfig struct {
	Contract string
	Points   []uint64 // whole unit
	Percents []uint64
	Stakers  []string
	// contains filtered or unexported fields
}

StakeConfig struct

type SyncConfig

type SyncConfig struct {
	JobCount           uint64
	WaitInterval       uint64
	Stable             uint64
	UpdateLiquidity    bool
	UpdateVolume       bool
	ScanAllExchange    bool
	RecordTokenAccount bool
}

SyncConfig sync config

Jump to

Keyboard shortcuts

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