Skip to main content

ChatGPT/Claude Prompt to Build a DAO Governance Contract

Build a DAO governance system with proposals, voting, timelock execution, delegation, treasury management, and attack mitigations.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
Build a DAO governance system for a protocol grants and development DAO with 5,000 token holders expected members. The DAO controls $10M in stablecoins and protocol tokens in its treasury and governs grant allocation, protocol parameter changes, and contract upgrades. Implement: 1) Governance token: existing ERC-20 with ERC20Votes wrapper — if using existing ERC-20, add ERC20Votes extension for delegation and vote checkpointing. Include vote weight calculation based on token balance at proposal snapshot block. 2) Governor contract using OpenZeppelin Governor with GovernorVotes and GovernorTimelockControl: configure voting delay (1 day (allow time for delegation)), voting period (5 days), proposal threshold (100,000 (1% of supply) tokens to propose), and quorum (4% of total supply must vote). 3) Proposal lifecycle: create → active → succeeded/defeated → queued → executed. Support transfer funds, update contract, change parameters, add/remove modules proposal types with calldata encoding for on-chain execution. Include proposal description with IPFS-hosted JSON with title, description, discussion link, and specification metadata for off-chain rendering. 4) Timelock controller with 48 hours minimum delay — separate roles for proposer (Governor), executor (open or restricted), and canceller (Guardian multisig). Critical operations (contract upgrades, guardian changes, treasury transfers exceeding $500K) require 7 days extended delay. 5) Delegation system: allow token holders to delegate to any address including recognized delegates with public profiles with split delegation support (yes, split voting power across multiple delegates by percentage) if needed. Track delegation history for vote weight snapshots. 6) Treasury management: the Governor can execute ERC-20 transfers, ETH transfers, contract calls for DeFi yield strategies through the Timelock. Implement spending limits: grants committee can approve up to $50K per proposal with 3-of-5 multisig without full governance vote. 7) Off-chain voting integration with Snapshot for temperature checks before on-chain proposals. 8) Security: prevent flash loan voting, last-minute vote swings, malicious proposal bundling with vote checkpointing at proposal creation, timelock review period, guardian veto power.

What this prompt does

This prompt builds a DAO governance system that is both safe and usable. You set the [dao_purpose], [member_count], [treasury_value], and [governance_scope], and it implements a governance token with [vote_weight_model], a Governor contract on [governor_base] with configured [voting_delay], [voting_period], [proposal_threshold], and [quorum_requirement], a proposal lifecycle, a timelock, delegation, treasury management, and attack mitigations.

The structure works because governance has to defend itself while staying approachable. The timelock with [timelock_delay] (and [extended_delay] for [critical_operations]), vote checkpointing at proposal creation, and guardian veto are the guardrails that stop flash-loan voting and rushed malicious proposals. By also specifying [proposal_types] with calldata encoding, delegation including [split_delegation], treasury [spending_limits] without a full vote, and off-chain [offchain_tool] temperature checks, the prompt produces a system matched to a DAO's real scope. The [member_count] and [treasury_value] inputs calibrate the thresholds, since a small DAO and one controlling millions need very different quorum and proposal bars.

When to use it

  • You are building DAO governance and need both safety guardrails and a usable flow
  • You want an OpenZeppelin Governor configured to your real treasury and scope
  • You need a timelock with extended delay for [critical_operations]
  • You want delegation, including [split_delegation], with vote checkpointing
  • You need treasury [spending_limits] that avoid a full vote for small grants
  • You want a clear proposal lifecycle with on-chain calldata execution
  • You want explicit mitigations for [governance_attacks] like flash-loan voting

Example output

Expect a governance system design: a token with the ERC20Votes extension and [vote_weight_model], a Governor on [governor_base] with [voting_delay], [voting_period], [proposal_threshold], and [quorum_requirement] configured, a proposal lifecycle from create through execute supporting [proposal_types] with [metadata_standard] metadata, a timelock controller with [timelock_delay] and [extended_delay] for [critical_operations] plus proposer/executor/canceller roles, a delegation system with [split_delegation] and snapshot tracking, treasury operations through the timelock with [spending_limits], off-chain [offchain_tool] integration, and mitigations for [governance_attacks]. The role separation across proposer, executor, and canceller is spelled out so no single party can both queue and rush an execution.

Pro tips

  • Match the Governor config to your real DAO — [proposal_threshold] and [quorum_requirement] set too low invite capture, too high cause governance paralysis
  • Keep vote checkpointing at proposal creation; without it, flash-loan voting where attackers borrow tokens to swing a vote becomes possible
  • Use [extended_delay] for [critical_operations] like upgrades and large treasury transfers, so the community has time to react to anything dangerous
  • Define [spending_limits] so routine small grants do not need a full vote, but anything large goes through the timelock and full process
  • Set [voting_delay] long enough that holders can delegate before the snapshot, or late delegators are silently disenfranchised
  • Configure the guardian veto and [critical_operations] list before launch, since a guardian role added after an attack starts is too late
  • Wire [offchain_tool] temperature checks in front of on-chain proposals to filter noise before anything reaches a binding, gas-costing vote

Frequently Asked Questions

How does it prevent flash-loan governance attacks?
Through vote checkpointing at proposal creation, so vote weight is snapshotted and tokens borrowed after that block carry no power. Combined with the `[voting_delay]` and timelock review period, this removes the window an attacker would use to borrow tokens and swing a vote.
What Governor framework does it use?
The default `[governor_base]` is OpenZeppelin Governor with GovernorVotes and GovernorTimelockControl. This gives you battle-tested proposal lifecycle, vote counting, and timelock integration rather than custom governance code, which is far riskier for a contract controlling a `[treasury_value]` treasury.
Can small grants bypass a full governance vote?
Yes, within `[spending_limits]`. The design lets a grants committee approve up to a defined amount through a multisig without a full proposal, while larger spending and `[critical_operations]` still route through the timelock and full vote. This balances agility against safety.
Does it integrate off-chain voting?
Yes. It integrates an `[offchain_tool]` such as Snapshot for temperature checks before on-chain proposals. This filters out proposals that lack support before they consume gas and a binding vote, keeping the on-chain process focused on proposals with real backing.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Blockchain & Web3 Development Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support