gasstation

package
v2.1.2-rc3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	SuggestBlockWindow:  20,
	DefaultGas:          uint64(unit.Qev),
	Percentile:          60,
	FeeHistoryCacheSize: 1024,
}

DefaultConfig is the default config

Functions

This section is empty.

Types

type BlockDAO

type BlockDAO interface {
	GetBlockHash(uint64) (hash.Hash256, error)
	GetBlockByHeight(uint64) (*block.Block, error)
	GetReceipts(uint64) ([]*action.Receipt, error)
}

BlockDAO represents the block data access object

type Config

type Config struct {
	SuggestBlockWindow  int    `yaml:"suggestBlockWindow"`
	DefaultGas          uint64 `yaml:"defaultGas"`
	Percentile          int    `yaml:"Percentile"`
	FeeHistoryCacheSize int    `yaml:"feeHistoryCacheSize"`
}

Config is the gas station config

type GasStation

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

GasStation provide gas related api

func NewGasStation

func NewGasStation(bc blockchain.Blockchain, dao BlockDAO, cfg Config) *GasStation

NewGasStation creates a new gas station

func (*GasStation) FeeHistory added in v2.1.1

func (gs *GasStation) FeeHistory(ctx context.Context, blocks, lastBlock uint64, rewardPercentiles []float64) (uint64, [][]*big.Int, []*big.Int, []float64, []*big.Int, []float64, error)

FeeHistory returns fee history over a series of blocks

func (*GasStation) SuggestGasPrice

func (gs *GasStation) SuggestGasPrice() (uint64, error)

SuggestGasPrice suggest gas price

type SimulateFunc

SimulateFunc is function that simulate execution

Jump to

Keyboard shortcuts

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