FeeManager Precompile
Learn how to use the FeeManager Precompile on your Avalanche L1 blockchain.
Activating the Precompile
You can configure the parameters of the dynamic fee algorithm on chain using the FeeManager
. In order to activate this feature, you will need to provide the feeManagerConfig
configuration in the genesis:
Interface and Address
The FeeManager precompile is located at address 0x0200000000000000000000000000000000000003
and implements the following interface:
The FeeManager precompile uses the AllowList interface to restrict access to its functionality.
In addition to the AllowList
interface, the FeeManager 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. This function can only be called by anAdmin
,Manager
orEnabled
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. For more information see here.
Implementation
You can find the implementation of the FeeManager precompile in the subnet-evm repository.
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.
Is this guide helpful?