Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractFeedURLs(feeds models.Feeds, orm *orm.ORM) ([]*url.URL, error)
- func GetBridgeURLFromName(name string, orm *orm.ORM) (*url.URL, error)
- func MakeIdleTimer(log flux_aggregator_wrapper.FluxAggregatorNewRound, ...) <-chan time.Time
- func OutsideDeviation(curAnswer, nextAnswer decimal.Decimal, thresholds DeviationThresholds) bool
- type DeviationChecker
- type DeviationCheckerFactory
- type DeviationThresholds
- type Fetcher
- type PollingDeviationChecker
- func (p *PollingDeviationChecker) HandleLog(broadcast log.Broadcast)
- func (p *PollingDeviationChecker) IsV2Job() bool
- func (p *PollingDeviationChecker) JobID() models.JobID
- func (p *PollingDeviationChecker) JobIDV2() int32
- func (p *PollingDeviationChecker) SetOracleAddress() error
- func (p *PollingDeviationChecker) Start()
- func (p *PollingDeviationChecker) Stop()
- type RunManager
- type Service
Constants ¶
const ( PriorityFlagChangedLog uint = 0 PriorityNewRoundLog uint = 1 PriorityAnswerUpdatedLog uint = 2 )
const MinFundedRounds int64 = 3
Variables ¶
Functions ¶
func ExtractFeedURLs ¶
ExtractFeedURLs extracts a list of url.URLs from the feeds parameter of the initiator params
func GetBridgeURLFromName ¶
GetBridgeURLFromName looks up a bridge in the DB by name, then extracts the url
func MakeIdleTimer ¶ added in v0.8.3
func MakeIdleTimer(log flux_aggregator_wrapper.FluxAggregatorNewRound, idleThreshold models.Duration, clock utils.AfterNower) <-chan time.Time
MakeIdleTimer checks the log timestamp and calculates the idle time from that.
This function makes the assumption that the local system time is relatively accurate (to within a second or so) and all participating nodes agree on that.
If system time is not accurate (compared to the cluster) then you should expect poor behaviour here.
func OutsideDeviation ¶
func OutsideDeviation(curAnswer, nextAnswer decimal.Decimal, thresholds DeviationThresholds) bool
OutsideDeviation checks whether the next price is outside the threshold. If both thresholds are zero (default value), always returns true.
Types ¶
type DeviationChecker ¶
type DeviationChecker interface { Start() Stop() }
DeviationChecker encapsulate methods needed to initialize and check prices for price deviations.
type DeviationCheckerFactory ¶
type DeviationCheckerFactory interface {
New(models.Initiator, *assets.Link, RunManager, *orm.ORM, models.Duration) (DeviationChecker, error)
}
DeviationCheckerFactory holds the New method needed to create a new instance of a DeviationChecker.
type DeviationThresholds ¶ added in v0.8.4
type DeviationThresholds struct { Rel float64 // Relative change required, i.e. |new-old|/|old| >= Rel Abs float64 // Absolute change required, i.e. |new-old| >= Abs }
DeviationThresholds carries parameters used by the threshold-trigger logic
type Fetcher ¶
type Fetcher interface {
Fetch(context.Context, map[string]interface{}, logger.Logger) (decimal.Decimal, error)
}
Fetcher is the interface encapsulating all functionality needed to retrieve a price.
type PollingDeviationChecker ¶
type PollingDeviationChecker struct {
// contains filtered or unexported fields
}
PollingDeviationChecker polls external price adapters via HTTP to check for price swings.
func NewPollingDeviationChecker ¶
func NewPollingDeviationChecker( store *store.Store, ethKeyStore *keystore.Eth, fluxAggregator flux_aggregator_wrapper.FluxAggregatorInterface, flags flags_wrapper.FlagsInterface, logBroadcaster log.Broadcaster, initr models.Initiator, minJobPayment *assets.Link, runManager RunManager, fetcher Fetcher, minSubmission, maxSubmission *big.Int, ) (*PollingDeviationChecker, error)
NewPollingDeviationChecker returns a new instance of PollingDeviationChecker.
func (*PollingDeviationChecker) HandleLog ¶
func (p *PollingDeviationChecker) HandleLog(broadcast log.Broadcast)
func (*PollingDeviationChecker) IsV2Job ¶ added in v0.9.3
func (p *PollingDeviationChecker) IsV2Job() bool
func (*PollingDeviationChecker) JobID ¶ added in v0.8.3
func (p *PollingDeviationChecker) JobID() models.JobID
func (*PollingDeviationChecker) JobIDV2 ¶ added in v0.9.3
func (p *PollingDeviationChecker) JobIDV2() int32
func (*PollingDeviationChecker) SetOracleAddress ¶ added in v0.9.6
func (p *PollingDeviationChecker) SetOracleAddress() error
func (*PollingDeviationChecker) Start ¶
func (p *PollingDeviationChecker) Start()
Start begins the CSP consumer in a single goroutine to poll the price adapters and listen to NewRound events.
func (*PollingDeviationChecker) Stop ¶
func (p *PollingDeviationChecker) Stop()
Stop stops this instance from polling, cleaning up resources.