quoter

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 28 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) GetPrice added in v1.24.0

func (m *Manager) GetPrice(parentCtx context.Context, tokenName string) (_ float64, err error)

GetPrice gets the price of a token.

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.

func (*Manager) SubscribeActiveRFQ added in v1.29.0

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

SubscribeActiveRFQ subscribes to the RFQ websocket API. This function is blocking and will run until the context is canceled.

type QuoteInput added in v1.4.0

type QuoteInput struct {
	OriginChainID     int
	DestChainID       int
	OriginTokenAddr   common.Address
	DestTokenAddr     common.Address
	OriginBalance     *big.Int
	DestBalance       *big.Int
	OriginAmountExact *big.Int
	DestRFQAddr       string
}

QuoteInput is a wrapper struct for input arguments to generateQuote.

type Quoter

type Quoter interface {
	// SubmitAllQuotes submits all quotes to the RFQ API.
	SubmitAllQuotes(ctx context.Context) (err error)
	// SubscribeActiveRFQ subscribes to the RFQ websocket API.
	SubscribeActiveRFQ(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)
	// GetPrice gets the price of a token.
	GetPrice(ctx context.Context, tokenName string) (float64, 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, apiClient rfqAPIClient.AuthenticatedClient) (Quoter, error)

NewQuoterManager creates a new QuoterManager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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