When to activate
- Designing DAO governance structures and voting systems
- Building treasury management contracts with multi-sig
- Implementing token-weighted or quadratic voting
- Creating proposal lifecycle (draft → vote → execute)
- Setting up governance delegation and representative systems
When NOT to use
- For centralized organization management
- For simple multi-sig wallets without governance
- For off-chain voting tools (Snapshot is sufficient alone)
Instructions
- Define governance model. Token-weighted (1 token = 1 vote), quadratic (sqrt), conviction voting, or hybrid.
- Design proposal lifecycle. Draft → Discussion → Voting → Timelock → Execution. Define quorum and thresholds.
- Implement voting. Governor contract (OpenZeppelin), delegation, vote snapping, late quorum extension.
- Treasury management. Multi-sig (Gnosis Safe), timelock controller, spending limits, budget allocation.
- Delegation. Delegate votes without transferring tokens. Partial delegation. Liquid democracy patterns.
- Execution. Timelock for approved proposals. Optimistic governance (execute unless vetoed). Module-based execution.
- Security. Prevent vote buying (snapshot at proposal time), flash loan governance attacks, delegation cycles.
Example
// OpenZeppelin Governor with Timelock
contract MyDAO is Governor, GovernorSettings, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {
constructor(IVotes _token, TimelockController _timelock)
Governor("MyDAO")
GovernorSettings(1, 50400, 1000e18) // 1 block delay, 1 week voting, 1000 token threshold
GovernorVotes(_token)
GovernorVotesQuorumFraction(4) // 4% quorum
GovernorTimelockControl(_timelock)
{}
}
1---2name: dao-governance3description: Build DAO governance systems — voting mechanisms, treasury management, delegation, and proposal lifecycle4---56## When to activate78- Designing DAO governance structures and voting systems9- Building treasury management contracts with multi-sig10- Implementing token-weighted or quadratic voting11- Creating proposal lifecycle (draft → vote → execute)12- Setting up governance delegation and representative systems1314## When NOT to use1516- For centralized organization management17- For simple multi-sig wallets without governance18- For off-chain voting tools (Snapshot is sufficient alone)1920## Instructions21221. **Define governance model.** Token-weighted (1 token = 1 vote), quadratic (sqrt), conviction voting, or hybrid.232. **Design proposal lifecycle.** Draft → Discussion → Voting → Timelock → Execution. Define quorum and thresholds.243. **Implement voting.** Governor contract (OpenZeppelin), delegation, vote snapping, late quorum extension.254. **Treasury management.** Multi-sig (Gnosis Safe), timelock controller, spending limits, budget allocation.265. **Delegation.** Delegate votes without transferring tokens. Partial delegation. Liquid democracy patterns.276. **Execution.** Timelock for approved proposals. Optimistic governance (execute unless vetoed). Module-based execution.287. **Security.** Prevent vote buying (snapshot at proposal time), flash loan governance attacks, delegation cycles.2930## Example3132```solidity33// OpenZeppelin Governor with Timelock34contract MyDAO is Governor, GovernorSettings, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {35 constructor(IVotes _token, TimelockController _timelock)36 Governor("MyDAO")37 GovernorSettings(1, 50400, 1000e18) // 1 block delay, 1 week voting, 1000 token threshold38 GovernorVotes(_token)39 GovernorVotesQuorumFraction(4) // 4% quorum40 GovernorTimelockControl(_timelock)41 {}42}43```