Actually Smart ContractsalphaTemplates

Templates / Treasury and governance

DAO Constitution: a treasury that executes only what the constitution allows

A DAO can pass a constitution but has no one to enforce it. This template puts the treasury behind a judiciary signer that executes a passed proposal only if no article is broken. The constitution is pinned by hash; when the jury can't tell, the answer is no.

Why it exists

DAO governance checks votes, not content. A proposal that passes executes, whatever it does.

The failures are familiar: calldata that does more than the text says, a payment to a council member's company buried in paragraph six, a spending cap broken across several small proposals, a constitution changed by a thin quorum.

DAOs

A constitution that binds the treasury, not just the forum.

Delegates and council members

A neutral check on every proposal, with reasons cited by article.

How it works

Pin the constitution

The articles are hashed into the policy id. Changing an article makes a new policy and a new signer, which the current signer must approve.

Pass a proposal

The DAO votes as it does today.

Check the code rules

Programs, the per-proposal cap, and the 91-day cap counted across every proposal.

Ask the jury, article by article

First: does the transaction do exactly what the text says? Then one question per article. The proposal and forum thread are untrusted material.

Execute or block

Any broken article blocks, with the article cited. When in doubt, block.

What you fill in

The fields of dao-constitution. The whole document is hashed, and that hash is what everyone signs and the signer on chain carries.

FieldWhat it holds
nameThe DAO
articlesEach with an id and text; pinned by hash
quarterlyCapThe most that can leave in 91 days, across proposals
perTransactionThe largest single proposal
minTimeLockSecondsTwo days by default

What code checks, and what the jury decides

Code: the same answer on every computer

  • Only token and system programs
  • At most perTransaction per proposal
  • At most quarterlyCap in any 91 days, counting every proposal
  • Config changes go to the jury

Jury: the questions only judgment can answer

  • Does the decoded transaction do exactly what the passed proposal says it does?
  • Article 1.1: No proposal may spend more than 5% of the treasury in one quarter. Does this proposal break it?
  • Article 2.3: A proposal may not pay a council member or a company they run unless its first paragraph says so. Does this proposal break it?

A rule violation is final: the signer refuses it whatever the jury says.

Attacks, and what stops them

AttackDefenseStatus
Calldata that does more than the textThe first jury question compares themBuilt
A cap broken across small proposalsThe 91-day window counts all of themTested
A quiet edit to the constitutionAny change makes a new hash and a new signerTested
Instructions in the proposal textUntrusted material, never followedBuilt

Every case the signer builds labels the parties' own text as untrusted and never follows instructions in it. See Security for the threat model behind all templates.

Example: Treasury articles

policyFromTemplate('dao-constitution', {
  name: 'Example DAO',
  articles: [
    { id: '1.1', text: 'No proposal may spend more than 5% of the treasury in one quarter, counting every proposal that quarter.' },
    { id: '1.2', text: 'What the proposal does on chain must match what its text says it does.' },
    { id: '2.3', text: 'A proposal may not pay a council member, their known wallets or a company they run, unless its first paragraph says so plainly.' },
  ],
  quarterlyCap: 50_000_000_000, perTransaction: 20_000_000_000,
})

The prompt

Paste this into any capable AI. It asks you about your case one group at a time, writes the dao constitution for it, explains who gets what in each outcome, points out risks in your terms, and ends with the harness call that checks the result. It never asks for keys: each party signs with its own, outside the conversation.

templates/prompts/dao-constitution.md
You are helping me turn my DAO's constitution into a Verafy DAO Constitution policy (VIP-0032): the treasury executes a passed proposal only if it breaks no article. Caps are code; each article becomes a question the jury answers on every proposal; when the jury can't tell, the answer is no.

Rules for you, the AI:
- Ask me the questions below one group at a time. Don't invent facts about my deal; if I don't know an answer, propose a sensible default and say it is a default.
- Amounts are whole base units as strings (1 SOL = "1000000000"). Times are unix seconds.
- Write every term, outcome and article so a stranger could decide from evidence alone whether it was met. No "reasonable", "high quality" or "timely" without a number or a test.
- Name the evidence that proves each thing, and prefer evidence that can be pinned by hash (a file, a commit, a transaction signature, an export).
- Never ask for or handle private keys. Each party signs with its own key, outside this conversation.
- When you're done, output: (1) the JSON, (2) a plain-English summary of who gets what in each outcome, (3) the risks you see in my terms, and (4) the harness call that checks it.

Ask me:
1. The DAO's name and the treasury asset.
2. The constitution, or the parts that govern the treasury. Paste it; I'll ask you to split it.
3. For each article that should bind the treasury: rewrite it as one testable rule with an id, keeping its meaning. Flag articles that can't be checked from a proposal and its transaction, and leave them out.
4. Any article that is really a number (a spending cap, a quorum) should become a code limit instead: the largest single proposal and the most that can leave in any 91 days.
5. The Squads time lock (two days by default).

Then produce the call policyFromTemplate('dao-constitution', { name, asset, articles [{id, text}], quarterlyCap, perTransaction, minTimeLockSeconds }), list the jury questions it will ask, and test it against two example proposals: one that should pass and one that should be blocked, citing the article.

Run it

In code

policyFromTemplate('dao-constitution', params)

Status, honestly

Measured
  • 2 of 2 tests pass: the constitution hash, one question per article, both caps, and the articles reaching the case
Not done yet
  • Amending the constitution means a new policy and a signer swap; there's no amendment flow inside the template
  • The signer program isn't on devnet yet
ProposalStatus
VIP-0032: DAO constitution: a treasury that executes only what the constitution allowsShipped (v0.0.5-alpha)
VIP-0011: Policies, and Covenant Launch: rules a wallet cannot breakShipped (v0.0.4-alpha)
VIP-0010: Judiciary Signer: a multisig member that votes only as a jury rulesShipped (v0.0.4-alpha); devnet deploy open

Other templates