listener

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: LGPL-3.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Erc20DepositHandler

func Erc20DepositHandler(sourceID, destId uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error)

Erc20DepositHandler converts data pulled from event logs into message handlerResponse can be an empty slice

func Erc721DepositHandler

func Erc721DepositHandler(sourceID, destId uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error)

Erc721DepositHandler converts data pulled from ERC721 deposit event logs into message

func GenericDepositHandler

func GenericDepositHandler(sourceID, destId uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error)

GenericDepositHandler converts data pulled from generic deposit event logs into message

Types

type BlockDeltaMeter added in v1.4.0

type BlockDeltaMeter interface {
	TrackBlockDelta(domainID uint8, head *big.Int, current *big.Int)
}

type BlockStorer added in v1.4.2

type BlockStorer interface {
	StoreBlock(block *big.Int, domainID uint8) error
}

type ChainClient

type ChainClient interface {
	LatestBlock() (*big.Int, error)
}

type DepositEventHandler

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

func NewDepositEventHandler

func NewDepositEventHandler(eventListener EventListener, depositHandler DepositHandler, bridgeAddress common.Address, domainID uint8) *DepositEventHandler

func (*DepositEventHandler) HandleEvent

func (eh *DepositEventHandler) HandleEvent(startBlock *big.Int, endBlock *big.Int, msgChan chan []*message.Message) error

type DepositHandler

type DepositHandler interface {
	HandleDeposit(sourceID, destID uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error)
}

type DepositHandlerFunc

type DepositHandlerFunc func(sourceID, destId uint8, nonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error)

type DepositHandlers

type DepositHandlers map[common.Address]DepositHandlerFunc

type ETHDepositHandler

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

func NewETHDepositHandler

func NewETHDepositHandler(handlerMatcher HandlerMatcher) *ETHDepositHandler

NewETHDepositHandler creates an instance of ETHDepositHandler that contains handler functions for processing deposit events

func (*ETHDepositHandler) HandleDeposit

func (e *ETHDepositHandler) HandleDeposit(sourceID, destID uint8, depositNonce uint64, resourceID types.ResourceID, calldata, handlerResponse []byte) (*message.Message, error)

func (*ETHDepositHandler) RegisterDepositHandler

func (e *ETHDepositHandler) RegisterDepositHandler(handlerAddress string, handler DepositHandlerFunc)

RegisterDepositHandler registers an event handler by associating a handler function to a specified address

type EVMListener

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

func NewEVMListener

func NewEVMListener(
	client ChainClient,
	eventHandlers []EventHandler,
	blockstore BlockStorer,
	metrics BlockDeltaMeter,
	domainID uint8,
	blockRetryInterval time.Duration,
	blockConfirmations *big.Int,
	blockInterval *big.Int) *EVMListener

NewEVMListener creates an EVMListener that listens to deposit events on chain and calls event handler when one occurs

func (*EVMListener) ListenToEvents

func (l *EVMListener) ListenToEvents(ctx context.Context, startBlock *big.Int, msgChan chan []*message.Message, errChn chan<- error)

ListenToEvents goes block by block of a network and executes event handlers that are configured for the listener.

type EventHandler

type EventHandler interface {
	HandleEvent(startBlock *big.Int, endBlock *big.Int, msgChan chan []*message.Message) error
}

type EventListener

type EventListener interface {
	FetchDeposits(ctx context.Context, address common.Address, startBlock *big.Int, endBlock *big.Int) ([]*events.Deposit, error)
}

type HandlerMatcher

type HandlerMatcher interface {
	GetHandlerAddressForResourceID(resourceID types.ResourceID) (common.Address, error)
}

Directories

Path Synopsis
Package mock_listener is a generated GoMock package.
Package mock_listener is a generated GoMock package.

Jump to

Keyboard shortcuts

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