gasprice

package
v0.0.0-...-985cc99 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AsDefaultCertainty = math.MaxUint64
	DecimalUnit        = piecefunc.DecimalUnit
)

Variables

View Source
var (
	DefaultMaxGasPrice = big.NewInt(10000000 * params.GWei)
	DecimalUnitBn      = big.NewInt(DecimalUnit)
)

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxGasPrice      *big.Int `toml:",omitempty"`
	MinGasPrice      *big.Int `toml:",omitempty"`
	DefaultCertainty uint64   `toml:",omitempty"`
}

type Oracle

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

Oracle recommends gas prices based on the content of recent blocks. Suitable for both light and full clients.

func NewOracle

func NewOracle(params Config) *Oracle

NewOracle returns a new gasprice oracle which can recommend suitable gasprice for newly created transaction.

func (*Oracle) EffectiveMinGasPrice

func (gpo *Oracle) EffectiveMinGasPrice() *big.Int

EffectiveMinGasPrice returns softly enforced minimum gas price on top of on-chain minimum gas price (base fee)

func (*Oracle) Start

func (gpo *Oracle) Start(backend Reader)

func (*Oracle) Stop

func (gpo *Oracle) Stop()

func (*Oracle) SuggestTip

func (gpo *Oracle) SuggestTip(certainty uint64) *big.Int

SuggestTip returns a tip cap so that newly created transaction can have a very high chance to be included in the following blocks.

Note, for legacy transactions and the legacy eth_gasPrice RPC call, it will be necessary to add the basefee to the returned number to fall back to the legacy behavior.

type Reader

type Reader interface {
	GetLatestBlockIndex() idx.Block
	TotalGasPowerLeft() uint64
	GetRules() opera.Rules
	GetPendingRules() opera.Rules
	PendingTxs() types.Transactions
}

Jump to

Keyboard shortcuts

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