utils

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DataDirFlag --datadir
	DataDirFlag = &cli.StringFlag{
		Name:  "datadir",
		Usage: "data directory",
		Value: "",
	}
	// ConfigFileFlag -c|--config
	ConfigFileFlag = &cli.StringFlag{
		Name:    "config",
		Aliases: []string{"c"},
		Usage:   "config file, use toml format",
	}
	// LogFileFlag --log
	LogFileFlag = &cli.StringFlag{
		Name:  "log",
		Usage: "log file, support rotate",
	}
	// LogRotationFlag --rotate
	LogRotationFlag = &cli.Uint64Flag{
		Name:  "rotate",
		Usage: "log rotation time (unit hour)",
		Value: 24,
	}
	// LogMaxAgeFlag --maxage
	LogMaxAgeFlag = &cli.Uint64Flag{
		Name:  "maxage",
		Usage: "log max age (unit hour)",
		Value: 720,
	}
	// VerbosityFlag -v|--verbosity
	VerbosityFlag = &cli.Uint64Flag{
		Name:    "verbosity",
		Aliases: []string{"v"},
		Usage:   "log verbosity (0:panic, 1:fatal, 2:error, 3:warn, 4:info, 5:debug, 6:trace)",
		Value:   4,
	}
	// JSONFormatFlag --json
	JSONFormatFlag = &cli.BoolFlag{
		Name:  "json",
		Usage: "output log in json format",
	}
	// ColorFormatFlag --color
	ColorFormatFlag = &cli.BoolFlag{
		Name:  "color",
		Usage: "output log in color text format",
		Value: true,
	}

	// SyncFromFlag --syncfrom
	SyncFromFlag = &cli.Uint64Flag{
		Name:  "syncfrom",
		Usage: "sync start height, 0 means read from database",
		Value: 0,
	}
	// SyncToFlag --syncto
	SyncToFlag = &cli.Uint64Flag{
		Name:  "syncto",
		Usage: "sync end height (excluding end), 0 means endless",
		Value: 0,
	}
	// OverwriteFlag --overwrite
	OverwriteFlag = &cli.BoolFlag{
		Name:  "overwrite",
		Usage: "overwrite exist items in database",
	}

	// KeyStoreFileFlag --keystore
	KeyStoreFileFlag = &cli.StringFlag{
		Name:  "keystore",
		Usage: "keystore file path",
	}
	// PasswordFileFlag --password
	PasswordFileFlag = &cli.StringFlag{
		Name:  "password",
		Usage: "password file path",
	}
	// GasLimitFlag --gas
	GasLimitFlag = &cli.StringFlag{
		Name:  "gasLimit",
		Usage: "gas limit in transaction, use default if not specified",
	}
	// GasPriceFlag --gasPrice
	GasPriceFlag = &cli.StringFlag{
		Name:  "gasPrice",
		Usage: "gas price in transaction, use default if not specified",
	}
	// AccountNonceFlag --nonce
	AccountNonceFlag = &cli.StringFlag{
		Name:  "nonce",
		Usage: "nonce in transaction, use default if not specified",
	}

	// RewardTokenFlag --rewardToken
	RewardTokenFlag = &cli.StringFlag{
		Name:  "rewardToken",
		Usage: "reward token",
	}
	// TotalRewardsFlag --rewards
	TotalRewardsFlag = &cli.StringFlag{
		Name:  "rewards",
		Usage: "total rewards (uint wei)",
	}
	// StartHeightFlag --start
	StartHeightFlag = &cli.Uint64Flag{
		Name:  "start",
		Usage: "start height (start inclusive)",
	}
	// EndHeightFlag --end
	EndHeightFlag = &cli.Uint64Flag{
		Name:  "end",
		Usage: "end height (end exclusive)",
	}
	// StableHeightFlag --stable
	StableHeightFlag = &cli.Uint64Flag{
		Name:  "stable",
		Usage: "stable height",
		Value: 30,
	}
	// StepCountFlag --step
	StepCountFlag = &cli.Uint64Flag{
		Name:  "step",
		Usage: "step count",
		Value: 100,
	}
	// StepRewardFlag --stepReward
	StepRewardFlag = &cli.StringFlag{
		Name:  "stepReward",
		Usage: "step reward",
		Value: "250000000000000000000",
	}
	// PairsFlag --pairs
	PairsFlag = &cli.StringFlag{
		Name:  "pairs",
		Usage: "pairs name",
	}
	// TokenFlag --token
	TokenFlag = &cli.StringFlag{
		Name:  "token",
		Usage: "token address",
	}
	// ExchangeFlag --exchange
	ExchangeFlag = &cli.StringFlag{
		Name:  "exchange",
		Usage: "exchange address",
	}
	// ExchangeSliceFlag --exchange
	ExchangeSliceFlag = &cli.StringSliceFlag{
		Name:  "exchange",
		Usage: "exchange address slice",
	}
	// WeightSliceFlag --weight
	WeightSliceFlag = &cli.Int64SliceFlag{
		Name:  "weight",
		Usage: "weight slice",
	}
	// InputFileFlag --input
	InputFileFlag = &cli.StringFlag{
		Name:  "input",
		Usage: "input file",
	}
	// InputFileSliceFlag --input
	InputFileSliceFlag = &cli.StringSliceFlag{
		Name:  "input",
		Usage: "input file slice",
	}
	// OutputFileFlag --output
	OutputFileFlag = &cli.StringFlag{
		Name:  "output",
		Usage: "output file",
	}
	// OutputFileSliceFlag --output
	OutputFileSliceFlag = &cli.StringSliceFlag{
		Name:  "output",
		Usage: "output file slice",
	}
	// DryRunFlag --dryrun
	DryRunFlag = &cli.BoolFlag{
		Name:  "dryrun",
		Usage: "dry run",
	}
	// GatewayFlag --gateway
	GatewayFlag = &cli.StringFlag{
		Name:  "gateway",
		Usage: "gateway URL address",
	}
	// SenderFlag --sender
	SenderFlag = &cli.StringFlag{
		Name:  "sender",
		Usage: "transaction sender",
	}
	// SaveDBFlag --savedb
	SaveDBFlag = &cli.BoolFlag{
		Name:  "savedb",
		Usage: "save to database",
	}
	// SampleFlag --sample
	SampleFlag = &cli.Uint64Flag{
		Name:  "sample",
		Usage: "sample height or timestamp",
	}
	// RewardTyepFlag --rewardType
	RewardTyepFlag = &cli.StringFlag{
		Name:  "rewardType",
		Usage: "reward type (ie. liquidity/liquid,volume/trade)",
	}
	// DustRewardFlag --dustReward
	DustRewardFlag = &cli.StringFlag{
		Name:  "dustReward",
		Usage: "dust reward threshold",
	}
	// BatchCountFlag --batchCount
	BatchCountFlag = &cli.Uint64Flag{
		Name:  "batchCount",
		Usage: "batch count",
		Value: 100,
	}
	// BatchIntervalFlag --batchInterval
	BatchIntervalFlag = &cli.Uint64Flag{
		Name:  "batchInterval",
		Usage: "batch interval of milli seconds",
		Value: 13000,
	}
	// OnlySyncAccountFlag --onlySyncAccount
	OnlySyncAccountFlag = &cli.BoolFlag{
		Name:  "onlySyncAccount",
		Usage: "only sync account",
	}
	// UseTimeMeasurementFlag --usetime
	UseTimeMeasurementFlag = &cli.BoolFlag{
		Name:  "usetime",
		Usage: "use timestamp instead of block height",
	}
	// ArchiveModeFlag --archivemode
	ArchiveModeFlag = &cli.BoolFlag{
		Name:  "archivemode",
		Usage: "is archive mode",
	}
	// PercentageWeightFlag --percentWeight
	PercentageWeightFlag = &cli.BoolFlag{
		Name:  "percentWeight",
		Usage: "weight is percentage",
	}
)
View Source
var (
	// LicenseCommand license cubcommonad
	LicenseCommand = &cli.Command{
		Action:    license,
		Name:      "license",
		Usage:     "Display license information",
		ArgsUsage: " ",
	}
)
View Source
var (
	// VersionCommand version subcommand
	VersionCommand = &cli.Command{
		Action:    version,
		Name:      "version",
		Usage:     "Print version numbers",
		ArgsUsage: " ",
		Description: `
The output of this command is supposed to be machine-readable.
`,
	}
)

Functions

func DialServer

func DialServer(serverURL string) *callapi.APICaller

DialServer connect to serverURL

func GetConfigFilePath

func GetConfigFilePath(ctx *cli.Context) string

GetConfigFilePath specified by `-c|--config`

func InitApp

func InitApp(ctx *cli.Context, withConfigFile bool) *callapi.APICaller

InitApp init app (remember close client in the caller)

func InitAppWithURL

func InitAppWithURL(ctx *cli.Context, serverURL string, withConfigFile bool) *callapi.APICaller

InitAppWithURL init app for library use (remember close client in the caller)

func InitMongodb

func InitMongodb()

InitMongodb init mongodb by config

func InitSyncArguments

func InitSyncArguments(ctx *cli.Context)

InitSyncArguments init sync arguments

func NewApp

func NewApp(identifier, gitcommit, usage string) *cli.App

NewApp creates an app with sane defaults.

func SetLogger

func SetLogger(ctx *cli.Context)

SetLogger set log level, json format, color, rotate ...

Types

type SyncArguments

type SyncArguments struct {
	SyncStartHeight *uint64
	SyncEndHeight   *uint64
	SyncOverwrite   *bool
}

SyncArguments command line arguments

var SyncArgs SyncArguments

SyncArgs sync arguments

Jump to

Keyboard shortcuts

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