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 ¶
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 ¶
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. nolint: wrapcheck
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.
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.