cli

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 41 Imported by: 1

Documentation

Index

Constants

View Source
const VersionMessage = `` /* 167-byte string literal not displayed */

Variables

View Source
var CLIDefault = CLI{

	Dataserver: DataserverCmd{},
	Report:     ReportCmd{},

	Transfer: TransferCmd{},
	Approve:  ApproveCmd{},
	Accounts: AccountsCmd{},
	Data:     DataCmd{},
	Balance:  BalanceCmd{},
	Stake: stakeCmd{
		Deposit:  DepositCmd{},
		Request:  RequestCmd{},
		Withdraw: WithdrawCmd{},
		Status:   StatusCmd{},
	},
	Dispute: disputeCmd{
		New:       NewDisputeCmd{},
		Vote:      VoteCmd{},
		List:      ListCmd{},
		Tally:     TallyCmd{},
		UnlockFee: UnlockFeeCmd{},
	},
	Encrypt: EncryptCmd{},
	Decrypt: DecryptCmd{},
	Version: VersionCmd{},
}

Functions

func CheckNewVersion

func CheckNewVersion(repo string, current string) (string, error)

func ConfigClientContract added in v0.2.0

func ConfigClientContract(
	ctx context.Context,
	logger log.Logger,
	configPath string,
	configStrictParsing bool,
	contractAddr string,
	params contracts.Params,
) (*config.Config, *ethclient.Client, contracts.TellorCaller, error)

func DataIdFullName added in v0.2.0

func DataIdFullName(id int64) string

func FinalPrompt added in v0.2.0

func FinalPrompt(
	ctx context.Context,
	logger log.Logger,
	contract contracts.TellorCaller,
	skipConfirm bool,
	gasMaxFee float64,
	dataIDs,
	vals [5]*big.Int,
) bool

func GetValuesFromInput added in v0.2.0

func GetValuesFromInput(logger log.Logger, dataIDs [5]*big.Int) [5]*big.Int

func PrintReporterStatus added in v0.2.0

func PrintReporterStatus(logger log.Logger, statusID *big.Int, started *big.Int)

func ValidateHex

func ValidateHex(account string) error

Types

type AccountArg

type AccountArg struct {
	Account string `arg:"" required:""`
}

func (*AccountArg) Validate

func (self *AccountArg) Validate() error

type AccountArgOptional

type AccountArgOptional struct {
	Account string `arg:"" optional:""`
}

func (*AccountArgOptional) Validate

func (self *AccountArgOptional) Validate() error

type AccountsCmd

type AccountsCmd struct {
}

func (*AccountsCmd) Run

func (self *AccountsCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type ApproveCmd

type ApproveCmd tokenCmd

func (*ApproveCmd) Run

func (self *ApproveCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type BalanceCmd

type BalanceCmd struct {
	AccountArg
}

func (*BalanceCmd) Run

func (self *BalanceCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type CLI

type CLI struct {
	Cfg
	ConfigStrictParsing bool `help:"whether to return an error when the config contains unknown fields"`
	ContractFlag

	Dataserver DataserverCmd `cmd:"" help:"launch only a dataserver instance"`
	Report     ReportCmd     `cmd:"" help:"Submit data to the oracle contracts"`
	Submit     SubmitCmd     `cmd:"" help:"Make a single manual submit to the oracle contracts"`

	Transfer TransferCmd `cmd:"" help:"Transfer tokens"`
	Approve  ApproveCmd  `cmd:"" help:"Approve tokens"`
	Accounts AccountsCmd `cmd:"" help:"Show accounts"`
	Data     DataCmd     `cmd:"" help:"Retrieve data from the contract"`
	Balance  BalanceCmd  `cmd:"" help:"Check the balance of an address"`
	Stake    stakeCmd    `cmd:"" help:"Perform one of the stake operations"`
	Dispute  disputeCmd  `cmd:"" help:"Perform commands related to disputes"`
	Encrypt  EncryptCmd  `cmd:"" help:"Encrypts a file to be securely stored on disk and later used only with a password prompt"`
	Decrypt  DecryptCmd  `cmd:"" help:"Decrypts an ecrypted file and write the decrytped version to disk"`
	Events   eventsCmd   `cmd:"" help:"Subscribe to watch logs from the network."`
	Version  VersionCmd  `cmd:"" help:"Show the CLI version information"`
}

type Cfg

type Cfg struct {
	Config string `type:"existingfile" help:"path to config file"`
}

type ContractFlag

type ContractFlag struct {
	Contract string `optional:"" help:"hex address of the contract to interract with"`
}

func (*ContractFlag) Validate

func (self *ContractFlag) Validate() error

type DataCmd

type DataCmd struct {
	From     uint64        `help:"the unix timestamp to use as a starting point for the data retrieval"`
	LookBack time.Duration `default:"2h" help:"how far to lookback"`
}

func (*DataCmd) Run

func (self *DataCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type DataserverCmd

type DataserverCmd struct {
}

func (*DataserverCmd) Run

func (self *DataserverCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type DecryptCmd

type DecryptCmd struct {
	File string `arg:"" required:"" type:"existingfile" help:"the file to encrypt"`
}

func (*DecryptCmd) Run

func (self *DecryptCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type DepositCmd

type DepositCmd struct {
	GasAccount
	NoChks
}

func (*DepositCmd) Run

func (self *DepositCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type DispID

type DispID struct {
	DisputeID int64 `required:"" help:"the dispute id"`
}

type DispIDOptional added in v0.2.0

type DispIDOptional struct {
	DisputeID int64 `help:"the dispute id"`
}

type EncryptCmd

type EncryptCmd struct {
	File string `arg:"" required:"" type:"existingfile" help:"the file to encrypt"`
}

func (*EncryptCmd) Run

func (self *EncryptCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type Gas

type Gas struct {
	GasMaxFee float64 `optional:"" help:"gas max fee to use when running the command"`
}

func (*Gas) Validate

func (self *Gas) Validate() error

type GasAccount

type GasAccount struct {
	Gas
	AccountArg
}

type ListCmd

type ListCmd struct {
	ShowClosed bool `help:"also show executed disputes"`
	LookBck
}

func (*ListCmd) Run

func (self *ListCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type LookBck

type LookBck struct {
	LookBack time.Duration `default:"120h" help:"how far to lookback, the default only few days since disputes can be voted only for 2 days."`
}

type NewDisputeCmd

type NewDisputeCmd struct {
	GasAccount
	NoChks
	DataID    int64 `required:""  help:"the request id to dispute"`
	Timestamp int64 `required:""  help:"the submitted timestamp to dispute"`
	Slot      int64 `required:""  help:"the reporter index to dispute"`
}

func (*NewDisputeCmd) Run

func (self *NewDisputeCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type NoChks

type NoChks struct {
	NoChecks bool `` /* 127-byte string literal not displayed */
}

type ReportCmd

type ReportCmd struct {
}

func (*ReportCmd) Run

func (self *ReportCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type RequestCmd

type RequestCmd struct {
	GasAccount
}

func (*RequestCmd) Run

func (self *RequestCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type StatusCmd

type StatusCmd struct {
	AccountArg
}

func (*StatusCmd) Run

func (self *StatusCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type SubmitCmd

type SubmitCmd struct {
	Gas
	AccountArgOptional
	CustomSubmit bool
	SkipConfirm  bool `help:"submit without confirming, useful for testing"`
}

func (*SubmitCmd) CreateAggr added in v0.3.0

func (*SubmitCmd) GetValuesFromDB added in v0.2.0

func (self *SubmitCmd) GetValuesFromDB(ctx context.Context, logger log.Logger, cfg *config.Config, aggregator *aggregator.Aggregator, dataIDs [5]*big.Int) ([5]*big.Int, error)

func (*SubmitCmd) Run

func (self *SubmitCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

func (*SubmitCmd) SelectAccount added in v0.2.0

func (self *SubmitCmd) SelectAccount(logger log.Logger) (*ethereum.Account, error)

func (*SubmitCmd) Submit added in v0.3.0

func (self *SubmitCmd) Submit(
	cli *CLI,
	ctx context.Context,
	logger log.Logger,
	account *ethereum.Account,
	client *ethclient.Client,
	contract contracts.TellorCaller,
	ids [5]*big.Int,
	vals [5]*big.Int,
) error

type TallyCmd

type TallyCmd struct {
	Gas
	DispIDOptional
	All bool
}

func (*TallyCmd) Run

func (self *TallyCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type TallyListCmd

type TallyListCmd struct {
	LookBck
}

func (*TallyListCmd) Run

func (self *TallyListCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type TransferCmd

type TransferCmd tokenCmd

func (*TransferCmd) Run

func (self *TransferCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type UnlockFeeCmd

type UnlockFeeCmd struct {
	NoChks
	Gas
	DispIDOptional
	All bool
}

func (*UnlockFeeCmd) Run

func (self *UnlockFeeCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type VersionCmd

type VersionCmd struct {
}

func (VersionCmd) Run

func (cmd VersionCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type VoteCmd

type VoteCmd struct {
	GasAccount
	DispID
	NoChks
	Support bool `required:"" help:"true or false"`
}

func (*VoteCmd) Run

func (self *VoteCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

type WithdrawCmd

type WithdrawCmd struct {
	GasAccount
}

func (*WithdrawCmd) Run

func (self *WithdrawCmd) Run(cli *CLI, ctx context.Context, logger log.Logger) error

Jump to

Keyboard shortcuts

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