cairo-governor
Generate governance contract source code for DAOs with customizable voting, quorum, and delay settings. Supports ERC20/ERC721 token-based voting and integrates with OpenZeppelin TimelockController.
Instructions
Make a contract to implement governance, such as for a DAO.
Returns the source code of the generated contract, formatted in a Markdown code block. Does not write to disk.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
appName | No | Required when votes is enabled, for hashing and signing typed structured data. Name for domain separator implementing SNIP12Metadata trait. Prevents two applications from producing the same hash. | |
appVersion | No | Required when votes is enabled, for hashing and signing typed structured data. Version for domain separator implementing SNIP12Metadata trait. Prevents two versions of the same application from producing the same hash. | |
clockMode | No | The clock mode used by the voting token. For now, only timestamp mode where the token uses voting durations expressed as timestamps is supported. For Governor, this must be chosen to match what the ERC20 or ERC721 voting token uses. | |
decimals | No | The number of decimals to use for the contract, default is 18 for ERC20Votes and 0 for ERC721Votes (because it does not apply to ERC721Votes). | |
delay | Yes | The delay since proposal is created until voting starts, in readable date time format matching /^(\d+(?:\.\d+)?) +(second|minute|hour|day|week|month|year)s?$/, default is "1 day". | |
info | No | Metadata about the contract and author | |
name | Yes | The name of the contract | |
period | Yes | The length of period during which people can cast their vote, in readable date time format matching /^(\d+(?:\.\d+)?) +(second|minute|hour|day|week|month|year)s?$/, default is "1 week". | |
proposalThreshold | No | Minimum number of votes an account must have to create a proposal, default is 0. | |
quorumAbsolute | No | The absolute quorum required, in cases of quorumMode equals absolute. | |
quorumMode | No | The type of quorum mode to use, either by percentage or absolute value. | |
quorumPercent | No | The percent required, in cases of quorumMode equals percent. | |
settings | No | Whether to allow governance to update voting settings (delay, period, proposal threshold). | |
timelock | No | Whether to add a delay to actions taken by the Governor. Gives users time to exit the system if they disagree with governance decisions. If "openzeppelin", Module compatible with OpenZeppelin's TimelockController. | |
upgradeable | No | Whether the smart contract is upgradeable. | |
votes | No | The type of voting to use. Either erc20votes, meaning voting power with a votes-enabled ERC20 token. Either erc721votes, meaning voting power with a votes-enabled ERC721 token. Voters can entrust their voting power to a delegate. |