Documentation ¶
Index ¶
- Constants
- Variables
- func GetFeeConfigLastChangedAt(stateDB contract.StateDB) *big.Int
- func GetFeeManagerStatus(stateDB contract.StateDB, address common.Address) allowlist.Role
- func GetStoredFeeConfig(stateDB contract.StateDB) commontype.FeeConfig
- func PackFeeConfig(feeConfig commontype.FeeConfig) ([]byte, error)
- func PackGetFeeConfigInput() []byte
- func PackGetLastChangedAtInput() []byte
- func PackSetFeeConfig(feeConfig commontype.FeeConfig) ([]byte, error)
- func SetFeeManagerStatus(stateDB contract.StateDB, address common.Address, role allowlist.Role)
- func StoreFeeConfig(stateDB contract.StateDB, feeConfig commontype.FeeConfig, ...) error
- func UnpackFeeConfigInput(input []byte) (commontype.FeeConfig, error)
- type Config
Constants ¶
const ( SetFeeConfigGasCost = contract.WriteGasCostPerSlot * (numFeeConfigField + 1) // plus one for setting last changed at GetFeeConfigGasCost = contract.ReadGasCostPerSlot * numFeeConfigField GetLastChangedAtGasCost = contract.ReadGasCostPerSlot )
const ConfigKey = "feeManagerConfig"
ConfigKey is the key used in json config files to specify this precompile config. must be unique across all precompiles.
Variables ¶
var ( // Singleton StatefulPrecompiledContract for setting fee configs by permissioned callers. FeeManagerPrecompile contract.StatefulPrecompiledContract = createFeeManagerPrecompile() ErrCannotChangeFee = errors.New("non-enabled cannot change fee config") )
var ContractAddress = common.HexToAddress("0x0200000000000000000000000000000000000003")
var Module = modules.Module{ ConfigKey: ConfigKey, Address: ContractAddress, Contract: FeeManagerPrecompile, Configurator: &configurator{}, }
Functions ¶
func GetFeeManagerStatus ¶
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 ¶
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 ¶
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) Verify ¶
func (c *Config) Verify(chainConfig precompileconfig.ChainConfig) error