gasupdater

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuitableTransactions = errors.New("no suitable transactions")
)

Functions

func HexToInt64

func HexToInt64(input interface{}) int64

HexToInt64 performs the inverse of Int64ToHex Returns 0 on invalid input

func Int64ToHex

func Int64ToHex(n int64) string

Int64ToHex converts an int64 into go-ethereum's hex representation

Types

type Block

type Block struct {
	Number       int64
	Hash         common.Hash
	ParentHash   common.Hash
	Transactions []Transaction
}

Block represents an ethereum block This type is only used for the gas updater, and can be expensive to unmarshal. Don't add unnecessary fields here.

func (Block) MarshalJSON

func (b Block) MarshalJSON() ([]byte, error)

MarshalJSON implements json marshalling for Block

func (*Block) UnmarshalJSON

func (b *Block) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals to a Block

type Config

type Config interface {
	GasUpdaterBlockHistorySize() uint16
	GasUpdaterBlockDelay() uint16
	GasUpdaterTransactionPercentile() uint16
	GasUpdaterBatchSize() uint32
	EthMaxGasPriceWei() *big.Int
	EthMinGasPriceWei() *big.Int
	EthFinalityDepth() uint
	SetEthGasPriceDefault(value *big.Int) error
	ChainID() *big.Int
}

Config defines the interface for the supplied config

type GasUpdater

type GasUpdater interface {
	httypes.HeadTrackable
	service.Service
}

GasUpdater listens for new heads and updates the base gas price dynamically based on the configured percentile of gas prices in that block

func NewGasUpdater

func NewGasUpdater(ethClient eth.Client, config Config) GasUpdater

NewGasUpdater returns a new gas updater.

type Transaction

type Transaction struct {
	GasPrice *big.Int
	GasLimit uint64
}

Transaction represents an ethereum transaction Use our own type because geth's type has validation failures on e.g. zero gas used, which can occur on other chains. This type is only used for the gas updater, and can be expensive to unmarshal. Don't add unnecessary fields here.

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a Transaction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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