relayer

package
v0.11.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const LoggerTag = "RELAYER"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// PriceStore is the price store which will be used to get the latest
	// prices.
	PriceStore *store.PriceStore

	// PokeTicker invokes the Relayer routine that relays prices to the Medianizer
	// contracts.
	PokeTicker *timeutil.Ticker

	// Pairs is the list supported pairs by Relayer with their configuration.
	Pairs []*Pair

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

	// Recoverer provides a method to recover the public key from a signature.
	// The default is crypto.ECRecoverer.
	Recoverer crypto.Recoverer
}

Config is the configuration for Relayer.

type Pair

type Pair struct {
	// AssetPair is the name of asset pair, e.g. ETHUSD.
	AssetPair string

	// Spread is the minimum calcSpread between the Oracle price and new
	// price required to send update.
	Spread float64

	// Expiration is the minimum time difference between the last Oracle
	// update on the Medianizer contract and current time required to send
	// update.
	Expiration time.Duration

	// Median is the instance of the oracle.Median which is the interface for
	// the Medianizer contract.
	Median median.Median

	// FeedAddresses is the list of addresses which are allowed to send
	// updates to the Medianizer contract.
	FeedAddresses []types.Address

	// FeedAddressesUpdateTicker invokes the FeedAddresses update routine
	// when ticked.
	//
	// TODO(mdobak): Instead of updating the list periodically, we should
	//               listen for events from the Medianizer contract.
	FeedAddressesUpdateTicker *timeutil.Ticker
}

type Relayer

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

Relayer is a service that relays prices to the Medianizer contracts. TODO(mdobak): Rename to Relay.

func New

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

func (*Relayer) Start

func (s *Relayer) Start(ctx context.Context) error

Start implements the service.Service interface.

func (*Relayer) Wait

func (s *Relayer) Wait() <-chan error

Wait implements the service.Service interface.

Jump to

Keyboard shortcuts

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