gasprice

package
v0.3.5-RC11 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: AGPL-3.0, AGPL-3.0-or-later Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewL2GasPriceSuggester

func NewL2GasPriceSuggester(ctx context.Context, cfg Config, pool poolInterface, ethMan *etherman.Client, state *state.State)

NewL2GasPriceSuggester init.

Types

type Config

type Config struct {
	Type EstimatorType `mapstructure:"Type"`

	// DefaultGasPriceWei is used to set the gas price to be used by the default gas pricer or as minimim gas price by the follower gas pricer.
	DefaultGasPriceWei uint64 `mapstructure:"DefaultGasPriceWei"`
	// MaxGasPriceWei is used to limit the gas price returned by the follower gas pricer to a maximum value. It is ignored if 0.
	MaxGasPriceWei            uint64         `mapstructure:"MaxGasPriceWei"`
	MaxPrice                  *big.Int       `mapstructure:"MaxPrice"`
	IgnorePrice               *big.Int       `mapstructure:"IgnorePrice"`
	CheckBlocks               int            `mapstructure:"CheckBlocks"`
	Percentile                int            `mapstructure:"Percentile"`
	UpdatePeriod              types.Duration `mapstructure:"UpdatePeriod"`
	CleanHistoryPeriod        types.Duration `mapstructure:"CleanHistoryPeriod"`
	CleanHistoryTimeRetention types.Duration `mapstructure:"CleanHistoryTimeRetention"`

	Factor float64 `mapstructure:"Factor"`
}

Config for gas price estimator.

type DefaultGasPricer

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

DefaultGasPricer gas price from config is set.

func (*DefaultGasPricer) UpdateGasPriceAvg

func (d *DefaultGasPricer) UpdateGasPriceAvg()

UpdateGasPriceAvg not needed for default strategy.

type EstimatorType

type EstimatorType string

EstimatorType different gas estimator types.

const (
	// DefaultType default gas price from config is set.
	DefaultType EstimatorType = "default"
	// LastNBatchesType calculate average gas tip from last n batches.
	LastNBatchesType EstimatorType = "lastnbatches"
	// FollowerType calculate the gas price basing on the L1 gasPrice.
	FollowerType EstimatorType = "follower"
)

type FollowerGasPrice

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

FollowerGasPrice struct.

func (*FollowerGasPrice) UpdateGasPriceAvg

func (f *FollowerGasPrice) UpdateGasPriceAvg()

UpdateGasPriceAvg updates the gas price.

type L2GasPricer

type L2GasPricer interface {
	UpdateGasPriceAvg()
}

L2GasPricer interface for gas price suggester.

type LastNL2BlocksGasPrice

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

LastNL2BlocksGasPrice struct for gas price estimator last n l2 blocks.

func (*LastNL2BlocksGasPrice) UpdateGasPriceAvg

func (g *LastNL2BlocksGasPrice) UpdateGasPriceAvg()

UpdateGasPriceAvg for last n bathes strategy is not needed to implement this function.

Jump to

Keyboard shortcuts

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