teleportevm

package
v0.11.0-dev.4 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const LoggerTag = "ETHEREUM_TELEPORT"
View Source
const SignatureKey = "ethereum"
View Source
const TeleportEventType = "teleport_evm"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.7.1

type Config struct {
	// Client is an instance of Ethereum RPC client.
	Client ethereum.Client //nolint:staticcheck // deprecated

	// Addresses is a list of contracts from which logs will be fetched.
	Addresses []types.Address

	// Interval specifies how often provider should check for new logs.
	Interval time.Duration

	// PrefetchPeriod specifies how far back in time provider should prefetch
	// logs. It is used only during the initial start of the provider.
	PrefetchPeriod time.Duration

	// BlockLimit specifies how from many blocks logs can be fetched at once.
	BlockLimit uint64

	// BlockConfirmations specifies how many blocks should be confirmed before
	// fetching logs.
	BlockConfirmations uint64

	// Logger is a current logger interface used by the EventProvider.
	Logger log.Logger
}

Config contains a configuration options for EventProvider.

type EventProvider added in v0.7.1

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

EventProvider listens to TeleportGUID events on Ethereum compatible blockchains.

https://github.com/makerdao/dss-teleport

It periodically fetches new TeleportGUID events from the blockchain, converts them into messages.Event and sends them to the channel provided by Events method.

During the initial start of the provider it also fetches older blocks until it reaches the block that is older than the prefetch period. This is done to fetch events that were emitted before the provider was started.

In the event of an error in communication with a node, whether related to network errors or the node itself, the provider will try to repeat requests to the node indefinitely.

func New

func New(cfg Config) (*EventProvider, error)

New returns a new instance of the EventProvider struct.

func (*EventProvider) Events added in v0.7.1

func (ep *EventProvider) Events() chan *messages.Event

Events implements the publisher.EventPublisher interface.

func (*EventProvider) Start added in v0.7.1

func (ep *EventProvider) Start(ctx context.Context) error

Start implements the publisher.EventPublisher interface.

type Signer

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

Signer signs events using Ethereum signature.

Signer could only sign events that have a "hash" field in the data. The value of that field is used to calculate the signature. The rest of the fields in the data are ignored. The calculated signature is stored in the "ethereum" field of the event's signatures map.

func NewSigner

func NewSigner(signer wallet.Key, types []string) *Signer

NewSigner returns a new instance of the Signer struct.

func (*Signer) Sign

func (l *Signer) Sign(event *messages.Event) (bool, error)

Sign implements the publisher.EventSigner interface.

Jump to

Keyboard shortcuts

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