service

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package service contains the core of the relayer. The entire application is a db sourced event architecture so here we: 1. listen to the chains, mark any events as seen or our own events as complete 2. Check each status in the db and see what, if any, action needs to be taken. This makes the application safe against abrupt crashes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(ctx context.Context, span trace.Span, req reldb.QuoteRequest) error

Handler is the handler for a quote request.

type QuoteRequestHandler

type QuoteRequestHandler struct {
	// Origin is the origin chain.
	Origin chain.Chain
	// Dest is the destination chain.
	Dest chain.Chain

	// Inventory is the inventory.
	Inventory inventory.Manager
	// Quoter is the quoter.
	Quoter quoter.Quoter

	// RelayerAdress is the relayer RelayerAdress
	RelayerAdress common.Address
	// contains filtered or unexported fields
}

QuoteRequestHandler is the helper for a quote request. lowercase fields are private, uppercase are public. the plan is to move this out of relayer which is when this distinction will matter.

func (*QuoteRequestHandler) Handle

func (q *QuoteRequestHandler) Handle(ctx context.Context, request reldb.QuoteRequest) (err error)

Handle handles a quote request. Note: this will panic if no method is available. This is done on purpose.

type Relayer

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

Relayer is the core of the relayer application.

func NewRelayer

func NewRelayer(ctx context.Context, metricHandler metrics.Handler, cfg relconfig.Config) (*Relayer, error)

NewRelayer creates a new relayer.

The relayer is the core of the application. It is responsible for starting the listener and quoter event loops.

func (*Relayer) Start

func (r *Relayer) Start(ctx context.Context) error

Start starts the relayer.

This will: 1. Check if approvals need to be issued on chain & issue them if needed. This allows _pullToken to function correctly. 2. Start the chain parser: This will listen to and process any events on chain 3. Start the db selector: This will check the db for any requests that need to be processed. 4. Start the submitter: This will submit any transactions that need to be submitted. nolint: cyclop

Jump to

Keyboard shortcuts

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