Customizing with EIF and event configuration
This topic provides a detailed explanation of the EIF configuration in chromia.yml
, which defines chain-specific
parameters for tracking events and contracts.
Chain configuration
The chains
section specifies blockchain-related parameters, including network IDs, contract addresses, and event
tracking.
Binance Smart Chain (BSC) testnet configuration
chains:
bsc:
network_id: 97
contracts:
- "0x753218363422002DF74F3D0D8d67f6CB38bE32D0" # Testnet BSC TwoWeeksNotice contract (staking)
- "0x8A2279d4A90B6fe1C4B30fa660cC9f926797bAA2" # Testnet BSC CHR token contract (tCHR)
skip_to_height: 26282055
events: !include ./config/events.yaml
network_id
: Identifies the Binance Smart Chain (BSC) testnet (ID: 97).contracts
:0x753218363422002DF74F3D0D8d67f6CB38bE32D0
: Represents theTwoWeeksNotice
staking contract on the BSC testnet.0x8A2279d4A90B6fe1C4B30fa660cC9f926797bAA2
: Represents the testnet CHR token (tCHR
).
skip_to_height
: Specifies the block height to start tracking events.events
: References an external configuration file (events.yaml
) that defines event tracking rules.
Events configuration for Chromia EVM governance dapp
This section provides an overview of the EVM events configured in the events.yaml
file. These events are listened to
and processed within the Chromia EVM governance dapp.
Events overview
The events.yaml
file defines EVM events that are crucial for tracking governance-related activities. Each event
contains attributes such as indexed parameters, types, and event names. The current configuration supports the following
events:
Transfer
event
The Transfer
event is a standard event in EVM-based blockchains, commonly used to track token transfers. It captures
details of token movements from one address to another.
Event definition
Transfer:
parameters:
- name: from
type: address
indexed: true
- name: to
type: address
indexed: true
- name: value
type: uint256
Parameters
- from (
address
, indexed): The sender's address. - to (
address
, indexed): The recipient's address. - value (
uint256
): The amount transferred.
Processing in governance dapp
- This event is monitored to track token transfers relevant to governance transactions.
- It helps identify governance token movements, ensuring correct allocation and participation tracking.
StakeUpdate
event
The StakeUpdate
event is used to track changes in staking balances, which are essential for governance participation
and voting power.
Event definition
StakeUpdate:
parameters:
- name: from
type: address
indexed: true
- name: balance
type: uint64
Parameters
from
(address
, indexed): The address whose stake is updated.balance
(uint64
): The new stake balance.
Processing in governance dapp
- This event is monitored to update the governance staking records.
- Changes in stake balance influence voting power and governance participation.
Integration with Chromia EVM governance dapp
- The dapp listens for these events using an event listener integrated with the EVM-compatible smart contract.
- When an event is emitted, the dapp processes the data and updates governance-related records accordingly.
- The
Transfer
event helps track token ownership, whileStakeUpdate
ensures accurate staking records for voting mechanisms.
Configuration elements
Below, we also present configuration elements from the YAML-like structure we've provided in the repo:
EIF test configuration (&eif_test):
chains
:- bsc: Configuration for the Binance Smart Chain (BSC):
network_id
: BSC testnet network ID.contracts
: Addresses of two testnet contracts for staking and CHR token.skip_to_height
: Block height to start processing from.events
: Includes external event configuration from ./config/events.yaml.
- bsc: Configuration for the Binance Smart Chain (BSC):
Common arguments (&common_args):
lib.ft4.core.accounts
: Configuration for account rate limits.lib.ft4.core.admin
: Admin public key.lib.ft4.core.auth
: Authorized operations for EVM signatures.- governance:
admin_pubkey
,admin_evm_wallet
economy_chain_brid
required_staked_chr_in_eth
,required_staked_chr_in_bnb
,required_chr_balance
,required_staked_chr_balance
- governance.citizens: Configurations for citizen cooldowns, proposal rejection, and vetoes.
citizen_cooldown_days_on_draft_proposal
,citizen_cooldown_days_on_proposal_rejection
, etc., are all defined with specific cooldown periods.
- governance.proposals: Configuration for proposals:
option_item_limit
,max_duration
,min_duration
- governance.eif: Sync transfers inside dapp.
- governance.votes: Configuration for veto periods.
- governance.auth: Authorization public key for governance.
Compile version:
rellVersion
: Compilation version (0.13.5).
EIF libraries overview
The following libraries used in the governance project are part of the Ethereum Interoperability Framework (EIF) and serve distinct purposes in enabling cross-chain communication between EVM and Postchain nodes.
For detailed information about EIF libraries, see EIF documentation.
Libraries
eif
- Registry: GitLab Repository
- Path:
postchain-eif-rell/rell/src/eif
- Version:
0.9.0
- Resource ID (RID):
x"D9FAA2AA88DEE0D1EAAFDFE8E28C1BAD89284CE4B6E75C1DBA9272DD8C3D944E"
- Insecure:
false
- Description: The core EIF library that manages the main framework for interoperability
eif_event_receiver
- Registry: GitLab Repository
- Path:
postchain-eif-rell/rell/src/eif_event_receiver
- Version:
0.9.0
- Resource ID (RID):
x"BDEB142851437327590715FF0912258D5435D294A59857B545BF69D27A0ADBB0"
- Insecure:
false
- Description: A sub-library for receiving and processing events emitted by EVM nodes or other components.
eif_event_connector
- Registry: GitLab Repository
- Path:
postchain-eif-rell/rell/src/eif_event_connector
- Version:
0.9.0
- Resource ID (RID):
x"4A669C5F98AEE970FECD5B77116E737196C7D3C7C6217DFD7EAC2F9317FC9461"
- Insecure:
false
- Description: Handles the integration and connection of event data into the EIF workflow, enabling seamless data transfer between systems.
These libraries work together to form the backbone of the EIF framework:
- The
eif
library manages the core interoperability features. - The
eif_event_receiver
library ensures efficient event listening and processing. - The
eif_event_connector
library integrates event data into the framework.
Dynamic configuration operations in EIF
We introduce three dynamic configuration operations that enhance its adaptability by allowing real-time updates to its event and contract tracking capabilities:
Operations
add_new_eif_events
- Purpose: Enables administrators to dynamically add new events to be tracked by the framework.
- Input: A list of event configurations (
eif_dynamic_config.event_config
). - Benefit: Provides flexibility for monitoring evolving blockchain activity.
add_new_eif_contracts
- Purpose: Allows administrators to register new contracts within EIF.
- Input: A list of contract configurations (
eif_dynamic_config.contract_config
). - Benefit: Facilitates seamless integration of additional contract systems.
add_new_evm_erc20_and_eif_contract
- Purpose: Streamlines the addition of new ERC20 tokens and their associated contracts to EIF.
- Input:
- Network ID
- Token address
- Token name
- Token symbol
- Decimals
- Functionality: Automatically registers the token on the specified EVM chain and links it as a contract in EIF.
Key advantages
Together, these operations significantly improve EIF's modularity by:
- Enabling dynamic onboarding of tokens, contracts, and event tracking.
- Reducing the need for manual intervention.
- Enhancing scalability for multi-chain environments.