Documentation ¶
Index ¶
Constants ¶
const LoggerTag = "FEED"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // DataModels is a list of data models handled by the Feed. DataModels []string // DataProvider is a data provider which is used to fetch data points. DataProvider datapoint.Provider // Signers is a list of signers used to sign data points. // // If none of the provided signers can sign the data point, it will be // skipped. Signers []datapoint.Signer // Hooks is a list of hooks that will be called before broadcasting // data points. Hooks []Hook // Transport is an implementation of transport used to send data points to // the network. Transport transport.Service // Interval describes how often data points should be sent to the network. Interval *timeutil.Ticker // 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 Feed.
type Feed ¶
type Feed struct {
// contains filtered or unexported fields
}
Feed is a service which periodically fetches data points and then sends them to the network using transport layer.
type TickPrecisionHook ¶ added in v0.16.1
type TickPrecisionHook struct {
// contains filtered or unexported fields
}
TickPrecisionHook is a hook that limits the precision of the price and volume of a tick.
This is done for two reasons:
- To decrease the size of the tick, which is broadcast to all oracles.
- To mitigate the risk of rounding errors that might occur during generating a hash for signature verification if the precision is too high. This isn't a concern as long as signatures are verified using the same library that calculated the hash. However, discrepancies may arise if a different library is used.
func NewTickPrecisionHook ¶ added in v0.16.1
func NewTickPrecisionHook(maxPricePrec, maxVolumePrec uint8) *TickPrecisionHook
NewTickPrecisionHook creates a new TickPrecisionHook with the specified price and volume precisions.
func (*TickPrecisionHook) BeforeBroadcast ¶ added in v0.16.1
BeforeBroadcast implements the Hook interface.
func (*TickPrecisionHook) BeforeSign ¶ added in v0.16.1
BeforeSign implements the Hook interface.
type TickTraceHook ¶ added in v0.16.1
type TickTraceHook struct{}
TickTraceHook is a hook that adds a trace meta field, which stores the price of the tick at each origin.
The trace field is a map that associates each pair and origin with a price. This allows to easily verify by others that the broadcasted tick is accurately calculated by the feed.
func NewTickTraceHook ¶ added in v0.16.1
func NewTickTraceHook() *TickTraceHook
NewTickTraceHook creates a new TickTraceHook instance.
func (*TickTraceHook) BeforeBroadcast ¶ added in v0.16.1
BeforeBroadcast implements the Hook interface.
func (*TickTraceHook) BeforeSign ¶ added in v0.16.1
BeforeSign implements the Hook interface.