Skip to main content

Governance Tool ICMF extension

The Governance Tool ICMF extension adds ICMF functionality to your decentralized application (dapp). It is important not to confuse it with the internal ICCF module of Chromia. The ICMF extension tracks ICMF CHR stake update messages, enabling the tracking of both economy chain and EVM chain stakes.

Since the data from the ICMF message pertains to both EVM and the Economy Chain, we cannot rely solely on the native stake balance to determine the Economy Chain stake balance.

This extension module does not require the EIF and can be used either with or without it.

The EVM data obtained comes from the Economy Chain, which sends stake updates from all chains as a single message, making it impossible to differentiate between EVM and Economy Chain stakes.

How to use

To utilize the ICMF extension, import the lib.governance.extensions.icmf module into your dapp.

Configuration

blockchains:
your_dapp_name: # your dapp name
module: main
config:
features:
merkle_hash_version: 2
gtx:
modules:
- "net.postchain.d1.icmf.IcmfSenderGTXModule"
- "net.postchain.d1.icmf.IcmfReceiverGTXModule"
- "net.postchain.d1.iccf.IccfGTXModule"
sync_ext:
- "net.postchain.d1.icmf.IcmfReceiverSynchronizationInfrastructureExtension"
icmf:
receiver:
local:
- topic: "G_staking_state_update"
bc-rid: x"15C0CA99BEE60A3B23829968771C50E491BD00D2E3AE448580CD48A8D71E7BBA"
global:
topics:
- G_staking_state_update
libs:
...
iccf:
registry: https://gitlab.com/chromaway/core/directory-chain
path: src/lib/iccf
tagOrBranch: 1.76.3
rid: x"050298A4A457D8E8922CF662765739A3A16B3256C49BE646FA7D198ECF0214C5"
insecure: false
icmf:
registry: https://gitlab.com/chromaway/core/directory-chain
path: src/lib/icmf
tagOrBranch: 1.82.6
rid: x"B56524EE85B679371EAB1A069B03BE6A3E94F36993DEA900747BA5BAE8B99122"

Custom modules

The ICMF module includes several custom modules that can inspire you or be used independently to facilitate implementation. These modules are optional and must be imported into your main module in addition to the icmf extension module. There are three custom modules:

  • icmf_register_requirements.rell: This module defines registration requirements based on native stake data from ICMF, which combines the total value of EVM stake and Economy Chain stake.
  • icmf_vote_power_strategies.rell: This module establishes vote power strategies derived from CHR stake balance for a given dapp.
  • icmf_vote_requirements.rell: This module outlines vote requirements based on native stake data from ICMF, which combines the total value of EVM stake and Economy Chain stake.

icmf_register_requirements.rell

This custom module introduces a new requirement in the registration process. It mandates that a specific native stake balance must be staked in the dapp.

Configuration:

blockchains:
your_dapp_name:
module: main
...
moduleArgs:
lib.governance.extensions.icmf.icmf_register_requirements:
required_native_stake_balance: 1000000 # 1 CHR because we use 10^6 (6 decimals) as a base for CHR

Operations:

operation update_native_stake_register_requirements(required_native_stake_balance: big_integer)

This operation updates the required native stake balance for the registration process and is accessible when this custom module is imported.

icmf_vote_power_strategies.rell

This custom module introduces a new vote power strategy to the Governance Tool. It utilizes the native stake balance to calculate the vote power.

No additional configuration is necessary for this module. It adds one vote power strategy:

  • TOTAL_CHR_STAKE: This strategy determines vote power based on the user's total CHR staked balance across both EVM and the Economy Chain.

icmf_vote_requirements.rell

This custom module establishes a new vote requirement for the Governance Tool. It utilizes the native stake balance to calculate the vote requirement.

No additional configuration is needed for this module. It includes two vote requirements:

  • TOTAL_CHR_STAKE: This requirement determines vote power based on the user's total CHR staked balance across both EVM and the Economy Chain.
  • TOTAL_CHR_STAKE_SNAPSHOT: This requirement determines vote power based on the user's total CHR staked balance across both EVM and the Economy Chain at a specific snapshot time.