Dynamic Fee Configuration
Dynamically configure transaction fees on the Avalanche network.
Configuring Dynamic Fees
You can configure the parameters of the dynamic fee algorithm on chain using the FeeConfigManager
. In order to activate this feature, you will need to provide the FeeConfigManager
in the genesis:
The precompile implements the FeeManager
interface which includes the same AllowList
interface used by ContractNativeMinter
, TxAllowList
, etc.
The Stateful Precompile contract powering the FeeConfigManager
adheres to the following Solidity interface at 0x0200000000000000000000000000000000000003
(you can load this interface and interact directly in Remix).
FeeConfigManager
precompile uses IAllowList
interface directly, meaning that it uses the same AllowList interface functions like readAllowList
and setAdmin
, setManager
, setEnabled
, setNone
.
In addition to the AllowList interface, the FeeConfigManager
adds the following capabilities:
getFeeConfig
: retrieves the current dynamic fee configgetFeeConfigLastChangedAt
: retrieves the timestamp of the last block where the fee config was updatedsetFeeConfig
: sets the dynamic fee config on chain (see here for details on the fee config parameters). This function can only be called by an Admin, Manager or Enabled address.FeeConfigChanged
: an event that is emitted when the fee config is updated. Topics include the sender, the old fee config, and the new fee config.
You can also get the fee configuration at a block with the eth_feeConfig
RPC method.
Initial Fee Config Configuration
It's possible to enable this precompile with an initial configuration to activate its effect on activation timestamp. This provides a way to define your fee structure to take effect at the activation.
To use the initial configuration, you need to specify the fee config in initialFeeConfig
field in your genesis or upgrade file:
This will set the fee config to the values specified in the initialFeeConfig
field.