feemanager

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: GPL-3.0, LGPL-3.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	SetFeeConfigGasCost     = contract.WriteGasCostPerSlot * (numFeeConfigField + 1) // plus one for setting last changed at
	GetFeeConfigGasCost     = contract.ReadGasCostPerSlot * numFeeConfigField
	GetLastChangedAtGasCost = contract.ReadGasCostPerSlot
)
View Source
const ConfigKey = "feeManagerConfig"

ConfigKey is the key used in json config files to specify this precompile config. must be unique across all precompiles.

Variables

View Source
var (

	// Singleton StatefulPrecompiledContract for setting fee configs by permissioned callers.
	FeeManagerPrecompile contract.StatefulPrecompiledContract = createFeeManagerPrecompile()

	ErrCannotChangeFee = errors.New("non-enabled cannot change fee config")
)
View Source
var ContractAddress = common.HexToAddress("0x0200000000000000000000000000000000000003")
View Source
var Module = modules.Module{
	ConfigKey:    ConfigKey,
	Address:      ContractAddress,
	Contract:     FeeManagerPrecompile,
	Configurator: &configurator{},
}

Functions

func GetFeeConfigLastChangedAt

func GetFeeConfigLastChangedAt(stateDB contract.StateDB) *big.Int

func GetFeeManagerStatus

func GetFeeManagerStatus(stateDB contract.StateDB, address common.Address) allowlist.Role

GetFeeManagerStatus returns the role of [address] for the fee config manager list.

func GetStoredFeeConfig

func GetStoredFeeConfig(stateDB contract.StateDB) commontype.FeeConfig

GetStoredFeeConfig returns fee config from contract storage in given state

func PackFeeConfig

func PackFeeConfig(feeConfig commontype.FeeConfig) ([]byte, error)

PackFeeConfig packs [feeConfig] without the selector into the appropriate arguments for fee config operations.

func PackGetFeeConfigInput

func PackGetFeeConfigInput() []byte

PackGetFeeConfigInput packs the getFeeConfig signature

func PackGetLastChangedAtInput

func PackGetLastChangedAtInput() []byte

PackGetLastChangedAtInput packs the getFeeConfigLastChangedAt signature

func PackSetFeeConfig

func PackSetFeeConfig(feeConfig commontype.FeeConfig) ([]byte, error)

PackSetFeeConfig packs [feeConfig] with the selector into the appropriate arguments for setting fee config operations.

func SetFeeManagerStatus

func SetFeeManagerStatus(stateDB contract.StateDB, address common.Address, role allowlist.Role)

SetFeeManagerStatus sets the permissions of [address] to [role] for the fee config manager list. assumes [role] has already been verified as valid.

func StoreFeeConfig

func StoreFeeConfig(stateDB contract.StateDB, feeConfig commontype.FeeConfig, blockContext contract.ConfigurationBlockContext) error

StoreFeeConfig stores given [feeConfig] and block number in the [blockContext] to the [stateDB]. A validation on [feeConfig] is done before storing.

func UnpackFeeConfigInput

func UnpackFeeConfigInput(input []byte) (commontype.FeeConfig, error)

UnpackFeeConfigInput attempts to unpack [input] into the arguments to the fee config precompile assumes that [input] does not include selector (omits first 4 bytes in PackSetFeeConfigInput)

Types

type Config

type Config struct {
	allowlist.AllowListConfig // Config for the fee config manager allow list
	precompileconfig.Upgrade
	InitialFeeConfig *commontype.FeeConfig `json:"initialFeeConfig,omitempty"` // initial fee config to be immediately activated
}

Config implements the StatefulPrecompileConfig interface while adding in the FeeManager specific precompile config.

func NewConfig

func NewConfig(blockTimestamp *uint64, admins []common.Address, enableds []common.Address, managers []common.Address, initialConfig *commontype.FeeConfig) *Config

NewConfig returns a config for a network upgrade at [blockTimestamp] that enables FeeManager with the given [admins], [enableds] and [managers] as members of the allowlist with [initialConfig] as initial fee config if specified.

func NewDisableConfig

func NewDisableConfig(blockTimestamp *uint64) *Config

NewDisableConfig returns config for a network upgrade at [blockTimestamp] that disables FeeManager.

func (*Config) Equal

func (c *Config) Equal(cfg precompileconfig.Config) bool

Equal returns true if [cfg] is a [*FeeManagerConfig] and it has been configured identical to [c].

func (*Config) Key

func (*Config) Key() string

func (*Config) Verify

func (c *Config) Verify(chainConfig precompileconfig.ChainConfig) error

Jump to

Keyboard shortcuts

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