Customizing functions
The Governance Tool allows you to create reusable code components tailored to your Decentralized Autonomous Organization
(DAO) environment by utilizing abstract modules and functions. The key overridden functions described below define
governance-related permission checks and decision-making logic within the system. It is essential to customize these
functions to establish governance rules that align with your specific DAO, proposal system, or blockchain environment.
All functions that start with the prefix can_
are abstract functions that can be overridden to customize the
governance system's behavior.
Note that some descriptions of the functions are derived from the Governance EVM tool implementation. You will notice a "default" label if a function is a default implementation and has not been overridden from the Governance Library.
Most of the overridden functions are similar to the default implementations of the abstract functions. They are provided as examples to make it easier for you to understand their purpose, rather than requiring you to search through the library code.
Key functions
Citizen and registration permissions
can_update_citizen_type
(default implementation)
This function ensures that only admins can modify a citizen’s type.
can_register
(extendable function)
This extended version of the function, available in the eif extension, checks whether a wallet address meets the required staked CHR or locked CHR balance across multiple blockchains (ETH/BSC). Developers can extend this function to customize the entry criteria for governance participation.
Proposal management
can_create_draft_proposal
(default implementation)
This function checks that a citizen is not on cooldown before submitting a draft proposal.
can_use_proposal_parameters
(default implementation)
This function validates whether the proposal duration, options, and requirements comply with configured limits (e.g., minimum duration, number of options).
can_start_voting_on_proposal
(default implementation)
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
,VOTING_ENDED
, orON_VETO
state. - An admin can bypass the veto period if necessary.
can_close_proposal
(default implementation)
This function allows a proposal to close only when it has transitioned to the correct CLOSED
state.
can_change_proposal_config
(default implementation)
This function restricts modifications to proposal configuration parameters to admins only.
can_verify_draft_proposal
(default implementation)
This function ensures that only councilors or admins can verify a draft proposal.
can_approve_proposal
(default implementation)
This function permits only councilors or admins to approve a proposal, which must be in the draft stage.
can_vote
(default implementation)
This function allows a citizen to vote only if:
- The citizen is not the proposal's author (to prevent self-voting).
Veto system
can_approve_or_disapprove_veto
(default implementation)
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
(default implementation)
This function permits the 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
(default implementation)
This function allows a councilor or admin to initiate a veto, provided they are not on a veto cooldown.
You can find default implementations for abstract functions, providing a quick starting point.
Why override these functions?
- Customize governance rules: Adjust voting power, registration criteria, and proposal approval processes according to 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 to meet your DAO's specific needs.
- Multi-chain governance: Modify rules for users participating with CHR on Ethereum or Binance Smart Chain.