gasprice

package
v0.0.3-RC10 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: GPL-3.0 Imports: 13 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 pool, ethMan *etherman.Client, state *state.State)

NewL2GasPriceSuggester init.

Types

type Config

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

	DefaultGasPriceWei uint64         `mapstructure:"DefaultGasPriceWei"`
	MaxPrice           *big.Int       `mapstructure:"MaxPrice"`
	IgnorePrice        *big.Int       `mapstructure:"IgnorePrice"`
	CheckBlocks        int            `mapstructure:"CheckBlocks"`
	Percentile         int            `mapstructure:"Percentile"`
	UpdatePeriod       types.Duration `mapstructure:"UpdatePeriod"`
	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