relay

package
v0.13.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const LoggerTag = "RELAY"
View Source
const MuSigLoggerTag = "MUSIG_STORE"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Medians           []ConfigMedian
	Scribes           []ConfigScribe
	OptimisticScribes []ConfigOptimisticScribe
	Logger            log.Logger
}

type ConfigMedian

type ConfigMedian struct {
	DataModel       string
	ContractAddress types.Address
	FeedAddresses   []types.Address
	Client          rpc.RPC
	DataPointStore  *store.Store

	// 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 Median contract and current time required to send
	// update.
	Expiration time.Duration

	// Ticker notifies the relay to check if an update is required.
	Ticker *timeutil.Ticker
}

type ConfigOptimisticScribe

type ConfigOptimisticScribe struct {
	DataModel       string
	ContractAddress types.Address
	FeedAddresses   []types.Address
	Client          rpc.RPC
	MuSigStore      *MuSigStore

	// 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 OpScribe contract and current time required to send
	// update.
	Expiration time.Duration

	// Ticker notifies the relay to check if an update is required.
	Ticker *timeutil.Ticker
}

type ConfigScribe

type ConfigScribe struct {
	DataModel       string
	ContractAddress types.Address
	FeedAddresses   []types.Address
	Client          rpc.RPC
	MuSigStore      *MuSigStore

	// 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 Scribe contract and current time required to send
	// update.
	Expiration time.Duration

	// Ticker notifies the relay to check if an update is required.
	Ticker *timeutil.Ticker
}

type MedianContract

type MedianContract interface {
	Val(ctx context.Context) (*bn.DecFixedPointNumber, error)
	Age(ctx context.Context) (time.Time, error)
	Wat(ctx context.Context) (string, error)
	Bar(ctx context.Context) (int, error)
	Poke(ctx context.Context, val []*bn.DecFixedPointNumber, age []time.Time, v []uint8, r []*big.Int, s []*big.Int) error
}

type MuSigStore

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

func NewMuSigStore

func NewMuSigStore(cfg MuSigStoreConfig) *MuSigStore

func (*MuSigStore) OptimisticSignaturesByDataModel

func (m *MuSigStore) OptimisticSignaturesByDataModel(model string) []*messages.MuSigOptimisticSignature

func (*MuSigStore) SignaturesByDataModel

func (m *MuSigStore) SignaturesByDataModel(model string) []*messages.MuSigSignature

func (*MuSigStore) Start

func (m *MuSigStore) Start(ctx context.Context) error

Start implements the supervisor.Service interface.

func (*MuSigStore) Wait

func (m *MuSigStore) Wait() <-chan error

Wait implements the supervisor.Service interface.

type MuSigStoreConfig

type MuSigStoreConfig struct {
	// Transport is an implementation of transport used to fetch data from
	// feeds.
	Transport transport.Service

	// ScribeDataModels is the list of models for which we should collect
	// signatures.
	ScribeDataModels []string

	// OpScribeDataModels is the list of models for which we should collect
	// optimistic signatures.
	OpScribeDataModels []string

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

MuSigStoreConfig is the configuration for MuSigStore.

type OpScribeContract

type OpScribeContract interface {
	ScribeContract
	OpPoke(ctx context.Context, pokeData contract.PokeData, schnorrData contract.SchnorrData, ecdsaData types.Signature) error
}

type Relay

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

func New

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

func (*Relay) Start

func (m *Relay) Start(ctx context.Context) error

Start implements the supervisor.Service interface.

func (*Relay) Wait

func (m *Relay) Wait() <-chan error

Wait implements the supervisor.Service interface.

type ScribeContract

type ScribeContract interface {
	Wat(ctx context.Context) (string, error)
	Bar(ctx context.Context) (int, error)
	Feeds(ctx context.Context) ([]types.Address, []uint8, error)
	Read(ctx context.Context) (*bn.DecFixedPointNumber, time.Time, error)
	Poke(ctx context.Context, pokeData contract.PokeData, schnorrData contract.SchnorrData) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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