Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllBatches ¶
type AllBatches struct {
// contains filtered or unexported fields
}
AllBatches struct for all batches avg price strategy.
func NewEstimatorAllBatches ¶
func NewEstimatorAllBatches() *AllBatches
NewEstimatorAllBatches init gas price estimator for all batches strategy.
func (*AllBatches) GetAvgGasPrice ¶
GetAvgGasPrice get avg gas price from all blocks.
func (*AllBatches) UpdateGasPriceAvg ¶
func (g *AllBatches) UpdateGasPriceAvg(newValue *big.Int)
UpdateGasPriceAvg Updates the rolling average value of the gas price.
type Config ¶
type Config struct { Type EstimatorType `mapstructure:"Type"` DefaultGasPriceWei uint64 `mapstructure:"DefaultGasPriceWei"` MaxPrice *big.Int `mapstructure:"MaxPrice"` IgnorePrice *big.Int `mapstructure:"IgnorePrice"` CheckBlocks int `mapstructure:"CheckBlocks"` Percentile int `mapstructure:"Percentile"` }
Config for gas price estimator.
type Default ¶
type Default struct {
// contains filtered or unexported fields
}
Default gas price from config is set.
func NewDefaultEstimator ¶
NewDefaultEstimator init default gas price estimator.
func (*Default) GetAvgGasPrice ¶
GetAvgGasPrice get default gas price from the pool.
func (*Default) UpdateGasPriceAvg ¶
UpdateGasPriceAvg not needed for default strategy.
type EstimatorType ¶
type EstimatorType string
EstimatorType different gas estimator types.
const ( // DefaultType default gas price from config is set. DefaultType EstimatorType = "default" // AllBatchesType calculate average gas used from all batches. AllBatchesType EstimatorType = "allbatches" // LastNBatchesType calculate average gas tip from last n batches. LastNBatchesType EstimatorType = "lastnbatches" )
type LastNL2Blocks ¶
type LastNL2Blocks struct {
// contains filtered or unexported fields
}
LastNL2Blocks struct for gas price estimator last n l2 blocks.
func NewEstimatorLastNL2Blocks ¶
func NewEstimatorLastNL2Blocks(cfg Config, state stateInterface) *LastNL2Blocks
NewEstimatorLastNL2Blocks init gas price estimator for last n l2 blocks strategy.
func (*LastNL2Blocks) GetAvgGasPrice ¶
GetAvgGasPrice calculate avg gas price from last n l2 blocks.
func (*LastNL2Blocks) UpdateGasPriceAvg ¶
func (g *LastNL2Blocks) UpdateGasPriceAvg(newValue *big.Int)
UpdateGasPriceAvg for last n bathes strategy is not needed to implement this function.