london

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package london provides wrappers to deterministically generate a tip cap + fee cap for evm based chains.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeeOracle

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

FeeOracle is the fee oracle to use for v2 gas price calculations.

func NewFeeOracle

func NewFeeOracle(chain backend.OracleBackendChain, height uint64, config gasprice.Config) FeeOracle

NewFeeOracle creates a new fee oracle.

func (*FeeOracle) SuggestFeeCap

func (f *FeeOracle) SuggestFeeCap(ctx context.Context) (*big.Int, error)

SuggestFeeCap calculates the suggested fee cap in a deterministic manner. because this is done from gas block, it is advisable to bump this number by a percentage.

func (*FeeOracle) SuggestTipCap

func (f *FeeOracle) SuggestTipCap(ctx context.Context) (*big.Int, error)

SuggestTipCap gets the suggested tip cap in a deterministic manner.

type HeightOracleBackend

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

HeightOracleBackend is an oracle that deterministically gets gas + fee prices for a given backend.

func NewOracleBackendFromHeight

func NewOracleBackendFromHeight(chain backend.OracleBackendChain, height uint64) HeightOracleBackend

NewOracleBackendFromHeight creates a fee oracle for deterministically generating gas prices from a given height that hijacks the header by number method (when it's passed -1) and returns the block height passed in the constructor it also overrides PendingBlockAndReceipts to always return nil since these cannot deterministically be used cross-client.

func (HeightOracleBackend) BlockByNumber

func (h HeightOracleBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)

BlockByNumber wraps the oracle backend.

func (HeightOracleBackend) ChainConfig

func (h HeightOracleBackend) ChainConfig() *params.ChainConfig

ChainConfig gets the chainconfig for the chain.

func (HeightOracleBackend) GetReceipts

func (h HeightOracleBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)

GetReceipts gets receipts for a block in a single rpc call.

func (HeightOracleBackend) HeaderByNumber

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

HeaderByNumber wraps oracle baccend.

func (HeightOracleBackend) PendingBlockAndReceipts

func (h HeightOracleBackend) PendingBlockAndReceipts() (*types.Block, types.Receipts)

PendingBlockAndReceipts always returns nil since we can't use this cross-client in a deterministic way.

func (HeightOracleBackend) SubscribeChainHeadEvent

func (h HeightOracleBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription

SubscribeChainHeadEvent is not used, but required for analytics compatibility).

Jump to

Keyboard shortcuts

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