relayer

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 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 {
	// Signer is the signer which will be used to sign poke transactions to the
	// Medianizer contracts.
	Signer ethereum.Signer

	// 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
}

Config is the configuration for Relayer.

type Pair

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

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

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

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

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

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

type Relayer

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

Relayer is a service that relays prices to the Medianizer contracts.

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