types

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package types includes global types for syncer.

Index

Constants

View Source
const (
	FlagLogLevel   = "log_level"
	FlagConfigFile = "config"
)

default Flags

View Source
const DefaultClient = "eth"

DefaultClient sets the default client chain name for tasks.

View Source
const DefaultConfigFileName = "oracle-operator.toml"

DefaultConfigFileName defines the default config file name.

View Source
const PrimitiveContractFnName = "getInsight"

PrimitiveContractFnName is Security Primitive Contract Interface function name.

Variables

This section is empty.

Functions

This section is empty.

Types

type ABIEntry

type ABIEntry struct {
	Name string `json:"name"`
	Type string `json:"stateMutability"`
}

ABIEntry defines the data type for abi entry.

type Client

type Client string

Client corresponds to the name of the client chain as used in task, e.g. `eth` for task `eth:0x...`.

type Config

type Config struct {
	Strategy   map[Client]Strategy `mapstructure:"strategy"`
	Method     string              `mapstructure:"method"` // HTTP method, `GET` or `POST`
	Timeout    int                 `mapstructure:"timeout"`
	RetryTimes int                 `mapstructure:"retry_times"`
}

Config for Relayer

type Context

type Context struct {
	*clientcontext.CLIContext
	// contains filtered or unexported fields
}

Context define the type of data for the operator node.

func NewContext

func NewContext(config *Config, logger log.Logger) Context

NewContext creates a new context.

func NewContextWithDefaultConfigAndLogger

func NewContextWithDefaultConfigAndLogger() (Context, error)

NewContextWithDefaultConfigAndLogger returns a new context with global configuration set from a config file.

func (Context) ClientContext

func (c Context) ClientContext() clientcontext.CLIContext

ClientContext returns a copy of the certik chain client context object value.

func (Context) Codec

func (c Context) Codec() *amino.Codec

Codec returns a reference to the client codec.

func (Context) Config

func (c Context) Config() Config

Config returns a copy of the oracle operator node global configuration.

func (Context) Context

func (c Context) Context() context.Context

Context returns the internal context object.

func (Context) Logger

func (c Context) Logger() log.Logger

Logger returns the logger for oracle node internal use.

func (Context) TxBuilder

func (c Context) TxBuilder() authtypes.TxBuilder

TxBuilder returns a copy of the certik chain transaction builder object.

func (Context) WithClientContext

func (c Context) WithClientContext(ctx *clientcontext.CLIContext) Context

WithClientContext returns a copy of the context with an updated CosmoSDK client context.

func (Context) WithConfig

func (c Context) WithConfig(config *Config) Context

WithConfig returns a copy of the context with an updated configuration setting.

func (Context) WithContext

func (c Context) WithContext(ctx context.Context) Context

WithContext returns a copy of the context with an updated internal context.

func (Context) WithLogger

func (c Context) WithLogger(logger log.Logger) Context

WithLogger returns a copy of the context with an updated logger.

func (Context) WithLoggerLabels

func (c Context) WithLoggerLabels(keyvals ...interface{}) Context

WithLoggerLabels returns a copy of the context with updated logger labels.

func (Context) WithTxBuilder

func (c Context) WithTxBuilder(txBuilder *authtypes.TxBuilder) Context

WithTxBuilder returns a copy of the context with an updated tx builder.

func (Context) WithValue

func (c Context) WithValue(key, value interface{}) Context

WithValue returns a copy of the context with an extra key-value information.

type Primitive

type Primitive struct {
	PrimitiveContractAddr string  `mapstructure:"primitive_contract_address"`
	Weight                float32 `mapstructure:"weight"`
}

Primitive specifies primitive configuration.

type PrimitivePayload

type PrimitivePayload struct {
	Contract string `json:"contract"` // original requested contract in the event
	Client   Client `json:"client"`   // contract client chain
	Address  string `json:"address"`  // contract address
	Function string `json:"function"` // contract function
}

PrimitivePayload specifies primitive query payload.

type PrimitiveScore

type PrimitiveScore struct {
	Primitive
	Score uint8
}

PrimitiveScore groups returned score and related info from primitive.

type Strategy

type Strategy struct {
	Type       string      `mapstructure:"type"`
	Primitives []Primitive `mapstructure:"primitive"`
}

Strategy specifies primitive aggregation strategy configuration.

Jump to

Keyboard shortcuts

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