listener

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package listener provides the event listener service for the RFQ relayer. This package implements a service that listens for events on the FastBridge contract (for one chain). Functionality includes: - Listening for BridgeRequested and BridgeRelayed events - Dynamically ranging over both blocks in and out of the confirmation range - Caching already seen events in a LRU cache - Sending new unconfirmed events to the RFQ relayer quote freezing service - Storing new confirmed events to the RFQ relayer event processing service

Index

Constants

View Source
const (
	// DefaultCacheSize is the default size of the LRU cache.
	DefaultCacheSize = 1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainListenerConfig

type ChainListenerConfig struct {
	ChainID         uint32
	StartBlock      uint64
	BridgeAddress   common.Address
	Client          client.EVM
	PollInterval    int
	MaxGetLogsRange uint64
	Confirmations   uint64
	ABI             abi.ABI
}

ChainListenerConfig is a config struct for a ChainListener.

type IChainListener

type IChainListener interface {
	// ABI returns the ABI of the bridge contract.
	ABI() abi.ABI
	// ChainID returns the chain ID of the chain the listener is listening on.
	ChainID() uint32
	// StartListening starts listening for events.
	StartListening(ctx context.Context) error
	// IterateThroughLogs iterates through logs and sends them to their respective channels.
	IterateThroughLogs(ctx context.Context, logs []types.Log, lastUnconfirmedBlock uint64) error
}

IChainListener is the interface for a ChainListener.

func NewChainListener

func NewChainListener(config *ChainListenerConfig, db db.DB, eventChan chan relayerTypes.WrappedLog, seenChan chan relayerTypes.WrappedLog) (IChainListener, error)

NewChainListener creates a new chain listener.

Jump to

Keyboard shortcuts

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