quoter

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package quoter submits quotes to the RFQ API for which assets the relayer is willing to relay.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager submits quotes to the RFQ API. TODO: should be unexported.

func (*Manager) IsProfitable added in v0.0.44

func (m *Manager) IsProfitable(parentCtx context.Context, quote reldb.QuoteRequest) (isProfitable bool, err error)

IsProfitable determines if a quote is profitable, i.e. we will not lose money on it, net of fees.

func (*Manager) ShouldProcess

func (m *Manager) ShouldProcess(parentCtx context.Context, quote reldb.QuoteRequest) (res bool, err error)

ShouldProcess determines if a quote should be processed.

func (*Manager) SubmitAllQuotes

func (m *Manager) SubmitAllQuotes(ctx context.Context) (err error)

SubmitAllQuotes submits all quotes to the RFQ API.

type Quoter

type Quoter interface {
	// SubmitAllQuotes submits all quotes to the RFQ API.
	SubmitAllQuotes(ctx context.Context) (err error)
	// ShouldProcess determines if a quote should be processed.
	// We do this by either saving all quotes in-memory, and refreshing via GetSelfQuotes() through the API
	// The first comparison is does bridge transaction OriginChainID+TokenAddr match with a quote + DestChainID+DestTokenAddr, then we look to see if we have enough amount to relay it + if the price fits our bounds (based on that the Relayer is relaying the destination token for the origin)
	// validateQuote(BridgeEvent)
	ShouldProcess(ctx context.Context, quote reldb.QuoteRequest) (bool, error)
	// IsProfitable determines if a quote is profitable, i.e. we will not lose money on it, net of fees.
	IsProfitable(ctx context.Context, quote reldb.QuoteRequest) (bool, error)
}

Quoter submits quotes to the RFQ API.

func NewQuoterManager

func NewQuoterManager(config relconfig.Config, metricsHandler metrics.Handler, inventoryManager inventory.Manager, relayerSigner signer.Signer, feePricer pricer.FeePricer) (Quoter, error)

NewQuoterManager creates a new QuoterManager.

Jump to

Keyboard shortcuts

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