Skip to main content

Customizing functions

The Chromia EVM governance dapp enables you to design reusable code components tailored to your DAO environment by utilizing abstract modules and functions. The key overridden functions detailed below define governance-related permission checks and decision-making logic within the system. You must customize these functions to establish governance rules that align with your specific DAO, proposal system, or blockchain environment.

Key functions and their purposes

Citizen and registration permissions

can_update_citizen_type

This function ensures that only admins can modify a citizen’s type.

can_register

This function checks if a wallet address meets the required staked CHR or locked CHR balance across multiple blockchains (ETH/BSC). Developers should override this function to customize the entry criteria for governance participation.

Proposal management

can_create_draft_proposal

This function confirms that a citizen is not on cooldown before they submit a draft proposal.

can_use_proposal_parameters

This function validates whether the proposal duration, options, and requirements stay within configured limits (e.g., minimum duration, number of options).

can_start_voting_on_proposal

This function ensures that only the proposal creator can initiate the voting process.

can_finalize_proposal

This function sets the conditions for finalizing a proposal, ensuring that:

  • The veto period has ended.
  • The proposal is in the ON_VOTING or ON_VETO state.
  • An admin can bypass the veto period if necessary.

can_close_proposal

This function allows a proposal to close only when it transitions to the correct CLOSED state.

can_change_proposal_config

This function restricts modifications to the proposal configuration parameters to admins only.

can_verify_draft_proposal

This function ensures that only councilors or admins can verify a draft proposal.

can_approve_proposal

This function allows only councilors or admins to approve a proposal, which must be in the draft stage.

can_vote

This function permits a citizen to vote only if:

  • The voting period is active.
  • The citizen is not the proposal author (to prevent self-voting).

Veto system

can_approve_or_disapprove_veto

This function ensures that only councilors or admins can approve or reject a veto request, provided the veto period is still active.

can_finalize_veto

This function permits finalization of a veto if:

  • The veto period has expired.
  • All councilors have voted.
  • The majority approval or disapproval threshold is met.

can_create_veto

This function allows a councilor or admin to initiate a veto, as long as they are not on a veto cooldown.

tip

You can find default implementations for abstract functions, providing a quick start.

Why override these functions?

  • Customize governance rules: Adjust voting power, registration criteria, and proposal approval processes based on your DAO’s policies.
  • Enforce security and access control: Prevent unauthorized actions by restricting permissions to admins and councilors.
  • Optimize voting and proposal mechanisms: Tailor how vetoes, approvals, and vote durations function according to your DAO's specific needs.
  • Multi-chain governance: Modify rules for users participating with CHR on Ethereum or Binance Smart Chain.