const CommonDAOID
CommonDAOID is the ID of the realm's DAO.
v0 - Unaudited: This is an initial version that has not yet been formally audited. A fully audited version will be pu...
v0 - Unaudited This is an initial version of this realm that has not yet been formally audited. A fully audited version will be published as a subsequent release. Use in production at your own risk.
Reference realm implementation of the gno.land/p/nt/commondao/v0 package for
managing Decentralized Autonomous Organizations per the Common DAO Spec
(docs/CONSTITUTION.md, Appendix).
What it hosts:
cur.Sub("dao/<id>")).manage-kinds), and manage-kinds can never be deregistered.gno.land/p/nt/bylaws/v0); the mandates/ folder is
reserved for the (deferred) ancestor amendment power.Design records live in gno.land/adr/pr6012_commondao_*.md; the extension
guide for building your own realm on the /p/ package is in
gno.land/p/nt/commondao/v0's README.
v0 - Unaudited: This is an initial version that has not yet been formally audited. A fully audited version will be published as a subsequent release. Use in production at your own risk.
Package commondao provides a reference realm implementation of the gno.land/p/nt/commondao/v0 package for managing Decentralized Autonomous Organizations per the Common DAO Spec: DAO and sub-DAO trees with councils and charters, a governable registry of proposal kinds (ten defaults plus an opt-in arbitrary-execution kind), per-DAO treasuries on derived sub-identity addresses with ancestor clawback/freeze powers, and bylaws documents amended by verifiable diff patches. See README.md and the ADRs under gno.land/adr/ for the design record.
CommonDAOID is the ID of the realm's DAO.
AmendBylawsPayload builds the CreateAmendBylawsProposal payload that changes a DAO's document at path to the proposed text: a new path adds a document, empty proposed text removes one. It diffs against the document's current text and pins its hash, so build the payload fresh (e.g. through a vm/qeval query) and propose promptly — a payload built against superseded text is rejected. Read-only.
CreateAmendBylawsProposal creates a proposal to add, amend or remove one of the DAO's bylaws documents with a verifiable diff patch (see gno.land/p/nt/bylaws/v0). The mandates/ folder is reserved: the Constitution grants a council self-power over its Bylaws only, so mandates change from above (creation or an ancestor's amendment — not implemented yet), never through this proposal. The payload is an encoded patch — build it with AmendBylawsPayload (e.g. through a vm/qeval query) or with bylaws.Diff(...).Encode() from a realm. The patch pins the sha256 of the document text it was diffed against, so an amendment racing a concurrent change to the same document fails cleanly instead of clobbering it; a patch already stale at creation is rejected here. Amendments are decided by supermajority — the default council rule; the Constitution names no special threshold for a council amending its own documents.
Parameters: - daoID: ID of the DAO (required) - payload: encoded bylaws patch (required)
1func CreateAncestorCouncilUpdateProposal(cur realm, daoID, targetID uint64, newMembers, removeMembers string) uint64CreateAncestorCouncilUpdateProposal creates a proposal for an ancestor DAO to add and/or remove members of a descendant's council (docs/CONSTITUTION.md :1531-1532) — the rescue path for a stuck or empty descendant council. It is hosted and voted in the ancestor (daoID) and decided by supermajority; the proposing DAO must be a proper ancestor of the target, verified at proposal validation.
Parameters: - daoID: ID of the proposing ancestor DAO (required) - targetID: ID of the descendant DAO whose council changes (required) - newMembers: Newline separated list of addresses to add to the council - removeMembers: Newline separated list of council addresses to remove
1func CreateCouncilUpdateProposal(cur realm, daoID uint64, newMembers, removeMembers string) uint64CreateCouncilUpdateProposal creates a new proposal to add and/or remove council members.
Parameters: - daoID: ID of the DAO (required) - newMembers: Newline separated list of addresses to add to the council - removeMembers: Newline separated list of council addresses to remove
CreateDeregisterKindProposal creates a proposal to deregister a proposal kind from a DAO by name, through the permanent manage-kinds kind.
The proposal is hosted and voted in the DAO itself and decided by supermajority; on approval the kind is deregistered, which blocks new proposals of that kind while in-flight ones still vote and execute. The manage-kinds kind itself cannot be deregistered, so a DAO always keeps the ability to manage its kind set (and to re-register a catalog kind by name).
Parameters: - daoID: ID of the DAO (required) - kindName: name of the proposal kind to deregister (required)
CreateDissolutionProposal creates a new proposal to dissolve a DAO or SubDAO.
SubDAOs can only be dissolved by the parent DAO, which owns and controls its sub-DAOs (docs/CONSTITUTION.md :1507). When the parent is itself already dissolved, the proposal is hosted in the nearest non-dissolved ancestor, so orphans below a dissolved middle DAO remain dissolvable.
Dissolution sweeps any remaining treasury balance. A sub-DAO's sweep goes to its parent and destination must be empty; a root DAO has no parent, so a valid destination address is required.
Parameters: - daoID: ID of the DAO to dissolve (required) - destination: sweep destination, root DAOs only
1func CreateExecutionProposal(cur realm, daoID uint64, title, body string, fn commondao.ExecFunc) uint64CreateExecutionProposal creates a proposal that runs an arbitrary ExecFunc as the DAO's own sub on approval, through the realm's execution kind.
The execution kind is opt-in: it is not seeded on new DAOs and must be registered first through a supermajority CreateRegisterKindProposal.
Freeze policy: an execution proposal moves value under the DAO's own authority, so it is subject to the treasury freeze exactly like a spend. This wrapper fails fast when the treasury is already frozen, and the definition re-checks at Execute (so a freeze landing after the proposal passed fails it cleanly, StatusFailed, no funds leaving). An ancestor's clawback/dissolution is a separate power and is not blocked by freeze.
Sharp edges (known limitations):
Parameters: - daoID: ID of the DAO (required) - title: proposal title (raw text, escaped when rendered) - body: proposal body (raw text, escaped when rendered) - fn: the closure executed on approval (required, non-nil)
CreateRegisterKindProposal creates a proposal to register one of the realm's catalog proposal kinds on a DAO by name, through the permanent manage-kinds kind (e.g. register "execution").
The proposal is hosted and voted in the DAO itself and decided by supermajority; on approval the named catalog kind is registered, so new proposals of that kind can be created. The manage-kinds kind is seeded on every DAO, so this path is always available.
Parameters: - daoID: ID of the DAO (required) - kindName: name of the catalog proposal kind to register (required)
1func CreateSubDAOProposal(cur realm, daoID uint64, name, purpose, description, members string) uint64CreateSubDAOProposal creates a new proposal to create a new SubDAO.
Parameters: - daoID: ID of the parent DAO (required) - name: A name for the SubDAO (required) - purpose: A purpose for the SubDAO (required) - description: A description for the SubDAO - members: Newline separated list of initial SubDAO council addresses (required)
1func CreateTextProposal(cur realm, daoID uint64, title, body string, votingDays uint8) uint64CreateTextProposal creates a new general text proposal.
Parameters: - daoID: ID of the DAO (required) - title: Title of the proposal (required) - body: Body of the proposal (required) - votingDays: The number of days where proposal accepts votes.
The default voting period is 7 days.
CreateTreasuryClawbackProposal creates a new proposal for an ancestor DAO to sweep a descendant DAO's full treasury balance to the target's parent (docs/CONSTITUTION.md :1507). The proposing DAO must be a proper ancestor of the target; a target's own options can never block an ancestor's clawback.
Parameters: - daoID: ID of the proposing ancestor DAO (required) - targetID: ID of the descendant DAO to claw back (required)
CreateTreasuryFreezeProposal creates a new proposal for an ancestor DAO to freeze or unfreeze a descendant DAO's treasury. While frozen, no treasury spend can execute. Only a proper ancestor can unfreeze — the frozen DAO's own council cannot.
Parameters: - daoID: ID of the proposing ancestor DAO (required) - targetID: ID of the descendant DAO to freeze or unfreeze (required) - frozen: true to freeze the target's treasury, false to unfreeze
1func CreateTreasurySpendProposal(cur realm, daoID uint64, to address, denom string, amount int64) uint64CreateTreasurySpendProposal creates a new proposal to send coins from the DAO's own treasury (docs/CONSTITUTION.md :1542-1543).
Parameters: - daoID: ID of the DAO whose treasury is spent (required) - to: recipient address (required) - denom: coin denomination, e.g. "ugnot" (required) - amount: coin amount, must be positive (required)
Execute executes a DAO proposal.
Executing a proposal that passed early (decided by the default Council rules before its voting deadline) requires the caller to be a council member. Once the voting deadline has passed execution is permissionless: the tally is deterministic, so anyone can finalize the proposal.
GetBylawsDoc returns the text of a DAO's bylaws/mandates document, or an empty string when the document does not exist (a stored document is never empty).
GetView returns a read only view of a common DAO searched by ID.
HasProposalKind reports whether a proposal kind is registered on a DAO.
Invite invites a user to the realm. A user invitation is required to start creating new DAOs.
IsInvited checks if an address has an invitation to the realm.
IsListed reports whether a DAO appears in the realm's public home index.
ListBylawsDocs returns the sorted paths of a DAO's bylaws/mandates documents under a prefix (empty prefix lists all).
New creates a new CommonDAO and returns its ID. The caller must be a user, not a realm (see assertCallerIsUser), and must hold an invite. The invite is consumed when that caller creates a DAO for the first time, after which the caller may create further DAOs freely. The caller becomes a council member along with any additional member addresses listed on separate lines; those may be realm addresses, so a DAO can be handed to a realm by seating it here and resigning. DAOs with a parent are created through proposals (see CreateSubDAOProposal).
Resign removes the caller from a DAO council. The last remaining council member cannot resign.
SetListed adds or removes a DAO from the realm's public home index. Listing is cosmetic — it affects only how this realm presents the DAO in its own UI — so any single council member of the DAO may toggle it, like Resign. It defaults to off.
Vote submits a vote for a DAO proposal. Voting is allowed to the members of the proposal's electorate: the council snapshot taken when the proposal was created.
Withdraw withdraws an active DAO proposal that has no votes. Only the proposal creator can withdraw it.
Funded is the optional contract a proposal definition implements when its executor moves funds from a DAO other than the proposal's host: it names, by ID, the DAO whose sub-identity address funds the executor. Execute resolves that DAO, mints its terminal RealmSend-only sub and passes it to the ExecFunc; a definition that does not implement Funded receives the host DAO's own sub by default. The returned ID must identify the DAO the definition validates its fund movement against (e.g. the DAO being spent, swept or dissolved).
It lives realm-side, not in /p/: minting a DAO sub needs the host realm's cur (cur.Sub), so only the host — never the package — can honor it. /p/ dispatches CapExempt/Executable/Validable itself, but Execute (the host) is the sole consumer of Funded, so the package has no reason to know it.