ethgas

package
v1.24.12 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: LGPL-3.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ONE_GWEI               = uint64(1e9)
	ONE_GWEI_MINUS_ONE_WEI = ONE_GWEI - 1
)

Variables

View Source
var (
	ONE_GWEI_BIG               = big.NewInt(int64(ONE_GWEI))
	ONE_GWEI_MINUS_ONE_WEI_BIG = big.NewInt(int64(ONE_GWEI_MINUS_ONE_WEI))
	BUCKET_RANGE               = big.NewInt(int64(5 * ONE_GWEI))
)
View Source
var CustomGasPriceBidReaders = map[uint64]GasPriceReader{}
View Source
var CustomGasPricePaidReaders = map[uint64]GasPriceReader{
	42161:  arbitrumGasPricePaidReader,
	42170:  arbitrumGasPricePaidReader,
	421611: arbitrumGasPricePaidReader,
	421613: arbitrumGasPricePaidReader,
	421614: arbitrumGasPricePaidReader,
	200:    arbitrumGasPricePaidReader,
}

Functions

func DefaultGasPriceBidReader added in v1.14.0

func DefaultGasPriceBidReader(block *ethmonitor.Block) []*big.Int

func DefaultGasPricePaidReader added in v1.14.0

func DefaultGasPricePaidReader(block *ethmonitor.Block) []*big.Int

Types

type EMA

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

EMA is a moving average with exponential decay. It doesn't have any concept of weight so it will only work on homogenous (evenly spaced) time series. ema := NewEMA(0.1818) avg1 = ema.Tick(price1) avg2 = ema.Tick(price2) spike := checkPriceMovingAvg(price, avg, 20%)

func NewEMA

func NewEMA(decay float64) *EMA

NewEMA(decay) returns a new exponential moving average. It weighs new values more than existing values according to the decay. For example: NewEMA(0.05) would give 5% weight to the present and 95% weight to the past. Common to use 2/(selected time period+1).

func (*EMA) Tick

func (ema *EMA) Tick(price *big.Int) *big.Int

func (*EMA) Value

func (ema *EMA) Value() *big.Int

type GasGauge

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

func NewGasGauge

func NewGasGauge(log logger.Logger, monitor *ethmonitor.Monitor, minGasPriceInGwei uint64, useEIP1559 bool) (*GasGauge, error)

func NewGasGaugeWei added in v1.12.6

func NewGasGaugeWei(log logger.Logger, monitor *ethmonitor.Monitor, minGasPriceInWei uint64, useEIP1559 bool) (*GasGauge, error)

func (*GasGauge) IsRunning added in v1.6.1

func (g *GasGauge) IsRunning() bool

func (*GasGauge) Run added in v1.6.1

func (g *GasGauge) Run(ctx context.Context) error

func (*GasGauge) Stop

func (g *GasGauge) Stop()

func (*GasGauge) Subscribe

func (g *GasGauge) Subscribe() ethmonitor.Subscription

func (*GasGauge) SuggestedGasPrice

func (g *GasGauge) SuggestedGasPrice() SuggestedGasPrice

func (*GasGauge) SuggestedGasPriceBid added in v1.14.0

func (g *GasGauge) SuggestedGasPriceBid() SuggestedGasPrice

func (*GasGauge) SuggestedPaidGasPrice added in v1.14.0

func (g *GasGauge) SuggestedPaidGasPrice() SuggestedGasPrice

type GasPriceReader added in v1.14.0

type GasPriceReader func(block *ethmonitor.Block) []*big.Int

type SuggestedGasPrice

type SuggestedGasPrice struct {
	Instant  uint64 `json:"instant"` // in gwei
	Fast     uint64 `json:"fast"`
	Standard uint64 `json:"standard"`
	Slow     uint64 `json:"slow"`

	InstantWei  *big.Int `json:"instantWei"`
	FastWei     *big.Int `json:"fastWei"`
	StandardWei *big.Int `json:"standardWei"`
	SlowWei     *big.Int `json:"slowWei"`

	BlockNum  *big.Int `json:"blockNum"`
	BlockTime uint64   `json:"blockTime"`
}

func (SuggestedGasPrice) WithMin added in v1.24.8

func (p SuggestedGasPrice) WithMin(minWei *big.Int) SuggestedGasPrice

Jump to

Keyboard shortcuts

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