watchers

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterTopics

func FilterTopics() []common.Hash

FilterTopics returns a list of topics to be used when filtering logs

Types

type BlockWatcher

type BlockWatcher interface {
	Subscribe(sink chan<- []*blockwatch.Event) event.Subscription
	GetLatestBlock() (*blockwatch.MiniHeader, error)
}

type EventDecoder

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

EventDecoder decodes logs into events for known contracts

func NewEventDecoder

func NewEventDecoder(addr ethcommon.Address, abiJSON string) (*EventDecoder, error)

NewEventDecoder returns a new instance of EventDecoder with a contract binding to the provided ABI string

func (*EventDecoder) Decode

func (e *EventDecoder) Decode(eventName string, log types.Log, decodedLog interface{}) error

Decode decodes a log into an event struct. An error will be returned if the log is not emitted from a known contract or if it does not map to a known event

func (*EventDecoder) FindEventName

func (e *EventDecoder) FindEventName(log types.Log) (string, error)

FindEventName returns the event name for a log. An error will be returned if the log is not emitted from a known contract or if it does not map to a known event

type OrchestratorWatcher added in v0.5.1

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

func NewOrchestratorWatcher added in v0.5.1

func NewOrchestratorWatcher(bondingManagerAddr ethcommon.Address, watcher BlockWatcher, store common.OrchestratorStore, lpEth eth.LivepeerEthClient, tw timeWatcher) (*OrchestratorWatcher, error)

func (*OrchestratorWatcher) Stop added in v0.5.1

func (ow *OrchestratorWatcher) Stop()

Stop watching for events

func (*OrchestratorWatcher) Watch added in v0.5.1

func (ow *OrchestratorWatcher) Watch()

Watch starts the event watching loop

type PriceFeedWatcher added in v0.7.3

type PriceFeedWatcher interface {
	Currencies() (base string, quote string, err error)
	Current() (eth.PriceData, error)
	Subscribe(ctx context.Context, sink chan<- eth.PriceData)
}

func NewPriceFeedWatcher added in v0.7.3

func NewPriceFeedWatcher(ethClient *ethclient.Client, priceFeedAddr string) (PriceFeedWatcher, error)

NewPriceFeedWatcher creates a new PriceFeedWatcher instance. It will already fetch the current price and start a goroutine to watch for updates.

type SenderWatcher

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

SenderWatcher maintains a concurrency-safe map with SenderInfo

func NewSenderWatcher

func NewSenderWatcher(ticketBrokerAddr ethcommon.Address, watcher BlockWatcher, lpEth eth.LivepeerEthClient, tw timeWatcher) (*SenderWatcher, error)

NewSenderWatcher initiates a new SenderWatcher

func (*SenderWatcher) ClaimedReserve

func (sw *SenderWatcher) ClaimedReserve(reserveHolder ethcommon.Address, claimant ethcommon.Address) (*big.Int, error)

ClaimedReserve returns the amount claimed from a sender's reserve by the node operator

func (*SenderWatcher) Clear

func (sw *SenderWatcher) Clear(addr ethcommon.Address)

Clear removes a key-value pair from the map

func (*SenderWatcher) GetSenderInfo

func (sw *SenderWatcher) GetSenderInfo(addr ethcommon.Address) (*pm.SenderInfo, error)

GetSenderInfo returns information about a sender's deposit and reserve if values for a sender are not cached an RPC call to a remote ethereum node will be made to initialize the cache

func (*SenderWatcher) Stop

func (sw *SenderWatcher) Stop()

Stop watching for events

func (*SenderWatcher) SubscribeReserveChange added in v0.5.9

func (sw *SenderWatcher) SubscribeReserveChange(sink chan<- ethcommon.Address) event.Subscription

SubscribeReserveChange notifies subscribers when the sender info for a particular sender changes

func (*SenderWatcher) Watch

func (sw *SenderWatcher) Watch()

Watch starts the event watching loop

type ServiceRegistryWatcher added in v0.5.1

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

func NewServiceRegistryWatcher added in v0.5.1

func NewServiceRegistryWatcher(serviceRegistryAddr ethcommon.Address, watcher BlockWatcher, store common.OrchestratorStore, lpEth eth.LivepeerEthClient) (*ServiceRegistryWatcher, error)

func (*ServiceRegistryWatcher) Stop added in v0.5.1

func (srw *ServiceRegistryWatcher) Stop()

Stop watching for events

func (*ServiceRegistryWatcher) Watch added in v0.5.1

func (srw *ServiceRegistryWatcher) Watch()

Watch starts the event watching loop

type TimeWatcher added in v0.5.5

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

TimeWatcher allows for subscriptions to certain data feeds using a caller provided sink channel consumers of the TimeWatcher can subscribe to following data feeds:

  • Last Initialized Round Number
  • Last Seen Block Number

func NewTimeWatcher added in v0.5.5

func NewTimeWatcher(roundsManagerAddr ethcommon.Address, watcher BlockWatcher, lpEth eth.LivepeerEthClient) (*TimeWatcher, error)

NewTimeWatcher creates a new instance of TimeWatcher and sets the initial cache through an RPC call to an ethereum node

func (*TimeWatcher) CurrentRoundStartL1Block added in v0.5.28

func (tw *TimeWatcher) CurrentRoundStartL1Block() *big.Int

func (*TimeWatcher) GetTranscoderPoolSize added in v0.5.5

func (tw *TimeWatcher) GetTranscoderPoolSize() *big.Int

func (*TimeWatcher) LastInitializedL1BlockHash added in v0.5.28

func (tw *TimeWatcher) LastInitializedL1BlockHash() [32]byte

LastInitializedL1BlockHash returns the blockhash of the L1 block the last round was initiated in

func (*TimeWatcher) LastInitializedRound added in v0.5.5

func (tw *TimeWatcher) LastInitializedRound() *big.Int

LastInitializedRound gets the last initialized round from cache

func (*TimeWatcher) LastSeenL1Block added in v0.5.28

func (tw *TimeWatcher) LastSeenL1Block() *big.Int

func (*TimeWatcher) PreLastInitializedL1BlockHash added in v0.5.30

func (tw *TimeWatcher) PreLastInitializedL1BlockHash() [32]byte

PreLastInitializedL1BlockHash returns the blockhash of the L1 block for the round proceeding the last initialized round

func (*TimeWatcher) Stop added in v0.5.5

func (tw *TimeWatcher) Stop()

Stop TimeWatcher

func (*TimeWatcher) SubscribeL1Blocks added in v0.5.28

func (tw *TimeWatcher) SubscribeL1Blocks(sink chan<- *big.Int) event.Subscription

SubscribeL1Blocks allows one to subscribe to newly seen L1 block numbers To unsubscribe, simply call `Unsubscribe` on the returned subscription. The sink channel should have ample buffer space to avoid blocking other subscribers. Slow subscribers are not dropped.

func (*TimeWatcher) SubscribeRounds added in v0.5.5

func (tw *TimeWatcher) SubscribeRounds(sink chan<- types.Log) event.Subscription

SubscribeRounds allows one to subscribe to new round events To unsubscribe, simply call `Unsubscribe` on the returned subscription. The sink channel should have ample buffer space to avoid blocking other subscribers. Slow subscribers are not dropped.

func (*TimeWatcher) Watch added in v0.5.5

func (tw *TimeWatcher) Watch() error

Watch the blockwatch subscription for NewRound events

type UnbondingWatcher

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

UnbondingWatcher watches for on-chain events to update the state of an unbonding lock store

func NewUnbondingWatcher

func NewUnbondingWatcher(addr ethcommon.Address, bondingManagerAddr ethcommon.Address, bw BlockWatcher, store unbondingLockStore) (*UnbondingWatcher, error)

NewUnbondingWatcher creates an UnbondingWatcher instance

func (*UnbondingWatcher) Stop

func (w *UnbondingWatcher) Stop()

Stop signals the watcher loop to exit gracefully

func (*UnbondingWatcher) Watch

func (w *UnbondingWatcher) Watch()

Watch kicks off a loop that handles events from a block subscription

Jump to

Keyboard shortcuts

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