gasprice

package
v0.5.1-metervm Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: LGPL-3.0 Imports: 9 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

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

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"`
}

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) SetGasPrice added in v0.4.0

func (gpo *Oracle) SetGasPrice(newGasPrice *big.Int)

SetGasPrice sets the minimum gas price to [newGasPrice]

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 added in v0.3.1

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.

Jump to

Keyboard shortcuts

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