FeeManager Precompile
Learn how to use the FeeManager Precompile on your Avalanche L1 blockchain.
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. For an example of the AllowList
interface, see the TxAllowList above.
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). It can be also found in IFeeManager.sol:
FeeConfigManager precompile uses IAllowList
interface directly, meaning that it uses the same AllowList
interface functions like readAllowList
and setAdmin
, setManager
, setEnabled
, setNone
. For more information see AllowList Solidity interface.
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 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.
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. For further information about precompile initial configurations see Initial Precompile Configurations.
Last updated on