ethcall

package
v0.78.0-preview.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyArgsToJson

func AnyArgsToJson(args []any) ([]string, error)

AnyArgsToJson does the inverse of the JsonArgsToAny; takes a list of arguments in go types and marshals them to a list of JSON strings.

func CanonicalizeJSON

func CanonicalizeJSON(in []byte) ([]byte, error)

func JsonArgsToAny

func JsonArgsToAny(methodName string, jsonArgs []string, abiJSON []byte) ([]any, error)

JsonArgsToAny takes a list of arguments marshalled as JSON strings. It then uses the ethereum ABI to convert each JSON argument into the go type which corresponds to the ethereum type defined in the ABI for that argument.

Types

type Call

type Call struct {
	// contains filtered or unexported fields
}

func NewCall

func NewCall(spec ethcallcommon.Spec) (Call, error)

func (Call) Call

func (c Call) Call(ctx context.Context, ethClient EthReaderCaller, blockNumber uint64) (Result, error)

func (Call) Spec

func (c Call) Spec() ethcallcommon.Spec

type Config

type Config struct {
	Level                                   encoding.LogLevel `long:"log-level"`
	PollEvery                               encoding.Duration
	HeartbeatIntervalForTestOnlyDoNotChange encoding.Duration
}

func NewDefaultConfig

func NewDefaultConfig() Config

type ContractCallEvent

type ContractCallEvent struct {
	BlockHeight   uint64
	BlockTime     uint64
	SpecId        string
	Result        []byte
	Error         *string
	SourceChainID *uint64
	Heartbeat     bool
}

func EthereumContractCallResultFromProto

func EthereumContractCallResultFromProto(
	qr *vegapb.EthContractCallEvent,
) (ContractCallEvent, error)

func (ContractCallEvent) Hash

func (q ContractCallEvent) Hash() string

func (*ContractCallEvent) IntoProto

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(log *logging.Logger, cfg Config, isValidator bool, client EthReaderCaller, forwarder Forwarder) *Engine

func (*Engine) CallSpec

func (e *Engine) CallSpec(ctx context.Context, id string, atBlock uint64) (Result, error)

func (*Engine) EnsureChainID added in v0.74.0

func (e *Engine) EnsureChainID(ctx context.Context, chainID string, blockInterval uint64, confirmWithClient bool)

EnsureChainID tells the engine which chainID it should be related to, and it confirms this against the its client.

func (*Engine) GetEthTime

func (e *Engine) GetEthTime(ctx context.Context, atBlock uint64) (uint64, error)

func (*Engine) GetInitialTriggerTime

func (e *Engine) GetInitialTriggerTime(id string) (uint64, error)

func (*Engine) GetRequiredConfirmations

func (e *Engine) GetRequiredConfirmations(id string) (uint64, error)

func (*Engine) GetSpec

func (e *Engine) GetSpec(id string) (common.Spec, bool)

func (*Engine) MakeResult

func (e *Engine) MakeResult(specID string, bytes []byte) (Result, error)

func (*Engine) OnSpecActivated

func (e *Engine) OnSpecActivated(ctx context.Context, spec datasource.Spec) error

func (*Engine) OnSpecDeactivated

func (e *Engine) OnSpecDeactivated(ctx context.Context, spec datasource.Spec)

func (*Engine) Poll

func (e *Engine) Poll(ctx context.Context, wallTime time.Time)

Poll is called by the poller in it's own goroutine; it isn't part of the abci code path.

func (*Engine) ReloadConf

func (e *Engine) ReloadConf(cfg Config)

func (*Engine) Start

func (e *Engine) Start()

Start starts the polling of the Ethereum bridges, listens to the events they emit and forward it to the network.

func (*Engine) StartAtHeight

func (e *Engine) StartAtHeight(height uint64, time uint64)

func (*Engine) Stop

func (e *Engine) Stop()

type EthReaderCaller

type EthReaderCaller interface {
	ethereum.ContractCaller
	ethereum.ChainReader
	ChainID(context.Context) (*big.Int, error)
}

type Forwarder

type Forwarder interface {
	ForwardFromSelf(*commandspb.ChainEvent)
}

type Result

type Result struct {
	Bytes         []byte
	Values        []any
	Normalised    map[string]string
	PassesFilters bool
}

func NewResult

func NewResult(spec ethcallcommon.Spec, bytes []byte) (Result, error)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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