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 configured for the relay.
Medians []ConfigMedian
// Scribes is the list of scribe contracts configured for the relay.
Scribes []ConfigScribe
// OptimisticScribes is the list of optimistic scribe contracts configured
// for the relay.
OptimisticScribes []ConfigOptimisticScribe
// Logger is a current logger interface used by the Feed.
// 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
// Ticker notifies the relay to check if an update is required.
Ticker *timeutil.Ticker
}
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 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 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
// Delay specifies the time to wait before sending an update.
Delay time.Duration
// Ticker notifies the relay to check if an update is required.
Ticker *timeutil.Ticker
}
type MedianContract ¶
type MedianContract interface {
Address() types.Address
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,
vals []contract.MedianVal,
) (
*types.Hash,
*types.Transaction,
error,
)
}
type OpScribeContract ¶
type OpScribeContract interface {
ScribeContract
OpPoke(
ctx context.Context,
pokeData contract.PokeData,
schnorrData contract.SchnorrData,
ecdsaData types.Signature,
) (
*types.Hash,
*types.Transaction,
error,
)
}
type Relay ¶
type Relay struct {
// contains filtered or unexported fields
}
Relay is a service that relays data points to the blockchain.
type ScribeContract ¶
type ScribeContract interface {
Address() types.Address
Wat(ctx context.Context) (string, error)
Bar(ctx context.Context) (int, error)
Feeds(ctx context.Context) ([]types.Address, []uint8, error)
Read(ctx context.Context) (contract.PokeData, error)
Poke(
ctx context.Context,
pokeData contract.PokeData,
schnorrData contract.SchnorrData,
) (
*types.Hash,
*types.Transaction,
error,
)
}
Click to show internal directories.
Click to hide internal directories.