Overview
A full on-chain governance system. Token holders can create proposals, vote, and execute transactions through a timelock-protected treasury. This follows the OpenZeppelin Governor pattern.Quick Start
Generated Files
my-dao
dokrypt.yaml
foundry.toml
README.md
contracts
token
VotingToken.sol
governance
Governor.sol
Timelock.sol
Treasury.sol
test
token
VotingToken.t.sol
governance
Governor.t.sol
Timelock.t.sol
Treasury.t.sol
scripts
deploy-dao.js
create-proposal.js
Governance Lifecycle
- Propose — A token holder creates a proposal (requires >= 100 tokens)
- Voting Delay — 1 block before voting opens
- Voting Period — 45,818 blocks (~1 week at 12s/block) for token holders to vote
- Succeed/Defeat — Proposal passes if quorum (10,000 tokens) reached and more For than Against votes
- Queue — Passed proposal is queued in the Timelock
- Timelock — 1 day (86,400 seconds) mandatory waiting period
- Execute — After the delay, anyone can execute the proposal
Contracts
VotingToken.sol
ERC-20 with vote delegation and checkpoint-based historical voting power tracking. Constructor:
Checkpoint System:
Governor.sol
The core governance engine that manages proposals and voting. Configuration:
Proposal States:
Pending → Active → Canceled / Defeated / Succeeded → Queued → Executed
Functions:
Events:
ProposalCreated, VoteCast, ProposalExecuted, ProposalCanceled, ProposalQueued
Timelock.sol
Enforces a mandatory delay before executing governance decisions. This gives token holders time to react to passed proposals. Configuration:
Roles:
- Proposer — Can schedule operations (Governor contract)
- Executor — Can execute ready operations (Governor contract)
- Admin — Can manage roles and update delay
Events:
CallScheduled, CallExecuted, Cancelled, MinDelayChanged
Treasury.sol
Holds ETH and ERC-20 tokens for the DAO. Only the Timelock (via Governor proposals) can withdraw funds. Functions:
Events:
Deposited, ETHDeposited, Withdrawn, ETHWithdrawn, ControllerUpdated
Deployment
- VotingToken — 1,000,000 initial supply
- Timelock — 1 day delay
- Governor — Connected to VotingToken and Timelock
- Treasury — Controlled by Timelock