londinium

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package londinium as the name implies, contains the pre-london version of the gas price estimation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMaxPrice = big.NewInt(500 * params.GWei)

DefaultMaxPrice is the default max price of a tx.

Functions

This section is empty.

Types

type Config

type Config struct {
	Blocks     int
	Percentile int
	Default    *big.Int `toml:",omitempty"`
	MaxPrice   *big.Int `toml:",omitempty"`
}

Config is the londinium config format.

func ToLondiniumConfig

func ToLondiniumConfig(newConfig gasprice.Config) Config

ToLondiniumConfig converts a post-london gasprice.Config to a legacy confiy.

type HeightOracleBackend

type HeightOracleBackend struct {
	OracleBackend
	// contains filtered or unexported fields
}

HeightOracleBackend returns deterministic prices for a given gas amount.

func NewOracleBackendFromHeight

func NewOracleBackendFromHeight(height uint64, oracle OracleBackend) HeightOracleBackend

NewOracleBackendFromHeight creates a gas price oracleBackend for deterministically generating gas prices from a given height this hijacks the HeaderByNumber method (when it's passed -1) and returns the block height passed in the constructor.

func (HeightOracleBackend) HeaderByNumber

func (d HeightOracleBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)

HeaderByNumber overrides the default behavior on header by number when getting the latest block.

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(backend OracleBackend, params Config) *Oracle

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

func (*Oracle) SuggestPrice

func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error)

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

type OracleBackend

type OracleBackend interface {
	HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
	BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)
	ChainConfig() *params.ChainConfig
}

OracleBackend includes all necessary background APIs for oracle.

func NewOracleBackendFromChain

func NewOracleBackendFromChain(unwrapped backend.OracleBackendChain) OracleBackend

NewOracleBackendFromChain there are conflicting method names between evm.Chain and gasprice.OracleBackend, this wraps chain to create a gasprice.OracleBackend.

Jump to

Keyboard shortcuts

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