Documentation ¶
Overview ¶
Package config provides a configuration struct and getters for the submitter.
Config contains configuration for the submitter. It can be loaded from a YAML file. Chain-specific configuration items can be provided via the `Chains` map, which overrides the global config for each chain. If a chain-specific item is not provided, the global config is used.
Index ¶
- Constants
- Variables
- type ChainConfig
- type Config
- func (c *Config) GetBatch(chainID int) bool
- func (c *Config) GetBumpInterval(chainID int) time.Duration
- func (c *Config) GetDynamicGasEstimate(chainID int) bool
- func (c *Config) GetGasBumpPercentage(chainID int) (gasBumpPercentage int)
- func (c *Config) GetGasEstimate(chainID int) (gasEstimate uint64)
- func (c *Config) GetMaxBatchSize(chainID int) int
- func (c *Config) GetMaxGasPrice(chainID int) (maxPrice *big.Int)
- func (c *Config) IsL2(chainID int) bool
- func (c *Config) SetGlobalEIP1559Support(supportsEIP1559 bool)
- func (c *Config) SetGlobalMaxGasPrice(maxPrice *big.Int)
- func (c *Config) SupportsEIP1559(chainID int) bool
- type IConfig
Constants ¶
const ( // DefaultMaxBatchSize is the default maximum number of transactions to send in a batch. DefaultMaxBatchSize = 10 // DefaultBumpIntervalSeconds is the default number of seconds to wait before bumping a transaction. DefaultBumpIntervalSeconds = 30 // DefaultGasBumpPercentage is the default percentage to bump the gas price by. DefaultGasBumpPercentage = 5 // DefaultGasEstimate is the default gas estimate to use for transactions. DefaultGasEstimate = uint64(1200000) )
Variables ¶
var DefaultMaxPrice = big.NewInt(500 * params.GWei)
DefaultMaxPrice is the default max price of a tx.
Functions ¶
This section is empty.
Types ¶
type ChainConfig ¶
type ChainConfig struct { // MaxBatchSize is the maximum number of transactions to send in a batch // if this is zero, the default will be used. This field is ignored if batching is disabled. MaxBatchSize int `yaml:"max_batch_size"` // Batch is whether or not to batch transactions at the rpc level DoNotBatch bool `yaml:"skip_batching"` // MaxGasPrice is the maximum gas price to use for transactions MaxGasPrice *big.Int `yaml:"max_gas_price"` // BumpIntervalSeconds is the number of seconds to wait before bumping a transaction BumpIntervalSeconds int `yaml:"bump_interval_seconds"` // GasBumpPercentages is the percentage to bump the gas price by // this is applied to the greatrer of the chainprice or the last price GasBumpPercentage int `yaml:"gas_bump_percentage"` // IsL2 is whether or not this chain is an L2 chain IsL2 bool `yaml:"is_l2"` // GasEstimate is the gas estimate to use for transactions // if dynamic gas estimation is enabled, this is only used as a default if the estimate fails GasEstimate uint64 `yaml:"gas_estimate"` // DynamicGasEstimate is whether or not to use dynamic gas estimation DynamicGasEstimate bool `yaml:"dynamic_gas_estimate"` // SupportsEIP1559 is whether or not this chain supports EIP1559 SupportsEIP1559 bool `yaml:"supports_eip_1559"` }
ChainConfig contains configuration for a specific chain.
type Config ¶
type Config struct { // GlobalConfig stores the default configuration ChainConfig `yaml:",inline"` // Chains overrides the global config for each chain Chains map[int]ChainConfig `yaml:"chains"` }
Config contains configuration for the submitter.
func (*Config) GetBumpInterval ¶
GetBumpInterval returns the number of seconds to wait before bumping a transaction TODO: test this method.
func (*Config) GetDynamicGasEstimate ¶
GetDynamicGasEstimate returns whether or not to use dynamic gas estimation TODO: test this method.
func (*Config) GetGasBumpPercentage ¶
GetGasBumpPercentage returns the percentage to bump the gas price by TODO: test this method.
func (*Config) GetGasEstimate ¶
GetGasEstimate returns the gas estimate to use for transactions TODO: test this method.
func (*Config) GetMaxBatchSize ¶
GetMaxBatchSize returns the maximum number of transactions to send in a batch.
func (*Config) GetMaxGasPrice ¶
GetMaxGasPrice returns the maximum gas price to use for transactions.
func (*Config) SetGlobalEIP1559Support ¶
SetGlobalEIP1559Support is a helper function that sets the global EIP1559 support.
func (*Config) SetGlobalMaxGasPrice ¶
SetGlobalMaxGasPrice is a helper function that sets the global gas price.
func (*Config) SupportsEIP1559 ¶
SupportsEIP1559 returns whether or not this chain supports EIP1559.
type IConfig ¶
type IConfig interface { // GetMaxBatchSize returns the maximum number of transactions to send in a batch. GetMaxBatchSize(chainID int) int // GetBatch returns whether or not to batch transactions at the rpc level. GetBatch(chainID int) bool // GetMaxGasPrice returns the maximum gas price to use for transactions. GetMaxGasPrice(chainID int) (maxPrice *big.Int) // GetBumpInterval returns the number of seconds to wait before bumping a transaction // TODO: test this method. GetBumpInterval(chainID int) time.Duration // IsL2 returns whether or not this chain is an L2 chain. IsL2(chainID int) bool // GetGasBumpPercentage returns the percentage to bump the gas price by // TODO: test this method. GetGasBumpPercentage(chainID int) (gasBumpPercentage int) // GetGasEstimate returns the gas estimate to use for transactions // TODO: test this method. GetGasEstimate(chainID int) (gasEstimate uint64) // GetDynamicGasEstimate returns whether or not to use dynamic gas estimation // TODO: test this method. GetDynamicGasEstimate(chainID int) bool // SupportsEIP1559 returns whether or not this chain supports EIP1559. SupportsEIP1559(chainID int) bool // SetGlobalMaxGasPrice is a helper function that sets the global gas price. SetGlobalMaxGasPrice(maxPrice *big.Int) // SetGlobalEIP1559Support is a helper function that sets the global EIP1559 support. SetGlobalEIP1559Support(supportsEIP1559 bool) }
IConfig ...