Documentation ¶
Overview ¶
Package eventwatcher provides a client for watching ethereum events
Index ¶
- type EventWatcher
- func (ew *EventWatcher) BC() utils.Blockchain
- func (ew *EventWatcher) Close() error
- func (ew *EventWatcher) NewBindings(addresses map[string]string) (map[string]*sigmacore.Sigmacore, error)
- func (ew *EventWatcher) NewWatchedContracts(logger *zap.Logger, bindings map[string]*sigmacore.Sigmacore, ...) ([]*WatchedContract, error)
- type WatchedContract
- func (wc *WatchedContract) Listen(ctx context.Context, db *database.Database, alerter *alerts.Alerter, ...) error
- func (wc *WatchedContract) Name() string
- func (wc *WatchedContract) NotifChanSwap() <-chan *sigmacore.SigmacoreLOGSWAP
- func (wc *WatchedContract) NotifChanToggle() <-chan *sigmacore.SigmacoreLOGPUBLICSWAPTOGGLED
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventWatcher ¶
type EventWatcher struct {
// contains filtered or unexported fields
}
EventWatcher wraps one or more interfaces to the ethereum blockchain to watch events
func New ¶
func New(bc utils.Blockchain) *EventWatcher
New returns a new EventWatcher implementation
func (*EventWatcher) BC ¶
func (ew *EventWatcher) BC() utils.Blockchain
BC returns the underlying blockchain client
func (*EventWatcher) Close ¶
func (ew *EventWatcher) Close() error
Close is used to terminate the event watcher
func (*EventWatcher) NewBindings ¶
func (ew *EventWatcher) NewBindings(addresses map[string]string) (map[string]*sigmacore.Sigmacore, error)
NewBindings constructs poolbindings for various indices, the input addresses argument is a map of pool name -> pool address
func (*EventWatcher) NewWatchedContracts ¶
func (ew *EventWatcher) NewWatchedContracts( logger *zap.Logger, bindings map[string]*sigmacore.Sigmacore, minimumGwei, gasMultiplier *big.Int, ) ([]*WatchedContract, error)
NewWatchedContracts initializes watched contracts and prepares them for event listening
type WatchedContract ¶
type WatchedContract struct {
// contains filtered or unexported fields
}
WatchedContract is a singular watched contract
func (*WatchedContract) Listen ¶
func (wc *WatchedContract) Listen(ctx context.Context, db *database.Database, alerter *alerts.Alerter, authorizer *utils.Authorizer, breakPercentage float64) error
Listen stars the watche contract listening process waiting for incoming events
func (*WatchedContract) Name ¶
func (wc *WatchedContract) Name() string
Name returns the name of the indexed pool this watcher monitors
func (*WatchedContract) NotifChanSwap ¶ added in v0.0.4
func (wc *WatchedContract) NotifChanSwap() <-chan *sigmacore.SigmacoreLOGSWAP
NotifChanSwap returns events when listened on, this is used to notify any listening goroutines of received events without having to worry about multi channel listeners as if we have multiple listeners on a channel golang will randomly choose 1
func (*WatchedContract) NotifChanToggle ¶ added in v0.0.4
func (wc *WatchedContract) NotifChanToggle() <-chan *sigmacore.SigmacoreLOGPUBLICSWAPTOGGLED
NotifChanToggle returns events when listened on, this is used to notify any listening goroutines of received events without having to worry about multi channel listeners as if we have multiple listeners on a channel golang will randomly choose 1