relay

package
v0.0.0-...-a3e4520 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const LoggerTag = "RELAY"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Medians is the list of median contracts configuration.
	Medians []ConfigMedian

	// Scribes is the list of scribe contracts configuration.
	Scribes []ConfigScribe

	// OptimisticScribes is the list of scribe optimistic contracts configuration.
	OptimisticScribes []ConfigOptimisticScribe

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

	// Logger is a current logger interface used by the Relay.
	// If nil, null logger will be used.
	Logger log.Logger
}

Config is the configuration for the Relay.

type ConfigMedian

type ConfigMedian struct {
	// Client is the RPC client used to interact with the blockchain.
	Client rpc.RPC

	// DataPointStore is the store used to retrieve data points.
	DataPointStore datapointStore.DataPointProvider

	// DataModel is the name of the data model from which data points
	// are retrieved.
	DataModel string

	// ContractAddress is the address of the Median contract.
	ContractAddress types.Address

	// FeedAddresses is the list of feed addresses that are allowed to
	// update the Median contract.
	FeedAddresses []types.Address

	// Spread is the minimum spread 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
}

type ConfigOptimisticScribe

type ConfigOptimisticScribe struct {
	// Client is the RPC client used to interact with the blockchain.
	Client rpc.RPC

	// MuSigStore is the store used to retrieve MuSig signatures.
	MuSigStore musigStore.SignatureProvider

	// DataModel is the name of the data model that is used to update
	// the OptimisticScribe contract.
	DataModel string

	// ContractAddress is the address of the OptimisticScribe contract.
	ContractAddress types.Address

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

	// Expiration is the minimum time difference between the last oracle
	// update on the Scribe contract and current time required to send
	// regular update.
	Expiration time.Duration

	// OptimisticSpread is the minimum time difference between the last oracle
	// update on the Scribe contract and current time required to send
	// optimistic update.
	OptimisticSpread float64

	// OptimisticExpiration is the minimum time difference between the last
	// oracle update on the Scribe contract and current time required to send
	// optimistic update.
	OptimisticExpiration time.Duration
}

type ConfigScribe

type ConfigScribe struct {
	// Client is the RPC client used to interact with the blockchain.
	Client rpc.RPC

	// MuSigStore is the store used to retrieve MuSig signatures.
	MuSigStore musigStore.SignatureProvider

	// DataModel is the name of the data model that is used to update
	// the Scribe contract.
	DataModel string

	// ContractAddress is the address of the Scribe contract.
	ContractAddress types.Address

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

type OpScribeContract

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

type Relay

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

Relay is a service that relays data to the blockchain.

func New

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

New creates a new Relay instance.

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 {
	Client() rpc.RPC
	Address() types.Address
	Read(ctx context.Context) (chronicle.PokeData, error)
	Wat() contract.TypedSelfCaller[string]
	Bar() contract.TypedSelfCaller[int]
	Feeds() contract.TypedSelfCaller[[]types.Address]
	Poke(pokeData chronicle.PokeData, schnorrData chronicle.SchnorrData) contract.SelfTransactableCaller
}

Jump to

Keyboard shortcuts

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