pricer

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package pricer contains pricing logic for RFQ relayer quotes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoingeckoPriceFetcher added in v0.0.40

type CoingeckoPriceFetcher interface {
	GetPrice(ctx context.Context, token string) (float64, error)
}

CoingeckoPriceFetcher is an interface for fetching prices from coingecko.

type CoingeckoPriceFetcherImpl added in v0.0.40

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

CoingeckoPriceFetcherImpl is an implementation of CoingeckoPriceFetcher.

func NewCoingeckoPriceFetcher added in v0.0.40

func NewCoingeckoPriceFetcher(timeout time.Duration) *CoingeckoPriceFetcherImpl

NewCoingeckoPriceFetcher creates a new instance of CoingeckoPriceFetcherImpl.

func (*CoingeckoPriceFetcherImpl) GetPrice added in v0.0.40

func (c *CoingeckoPriceFetcherImpl) GetPrice(ctx context.Context, token string) (price float64, err error)

GetPrice fetches the price of a token from coingecko.

type FeePricer

type FeePricer interface {
	// Start starts the fee pricer.
	Start(ctx context.Context)
	// GetOriginFee returns the total fee for a given chainID and gas limit, denominated in a given token.
	GetOriginFee(ctx context.Context, origin, destination uint32, denomToken string, isQuote bool) (*big.Int, error)
	// GetDestinationFee returns the total fee for a given chainID and gas limit, denominated in a given token.
	GetDestinationFee(ctx context.Context, origin, destination uint32, denomToken string, isQuote bool) (*big.Int, error)
	// GetTotalFee returns the total fee for a given origin and destination chainID, denominated in a given token.
	GetTotalFee(ctx context.Context, origin, destination uint32, denomToken string, isQuote bool) (*big.Int, error)
	// GetGasPrice returns the gas price for a given chainID in native units.
	GetGasPrice(ctx context.Context, chainID uint32) (*big.Int, error)
	// GetTokenPrice returns the price of a token in USD.
	GetTokenPrice(ctx context.Context, token string) (float64, error)
}

FeePricer is the interface for the fee pricer.

func NewFeePricer

func NewFeePricer(config relconfig.Config, clientFetcher submitter.ClientFetcher, priceFetcher CoingeckoPriceFetcher, handler metrics.Handler) FeePricer

NewFeePricer creates a new fee pricer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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