Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

memba_gov source realm

Package memba\_gov is the Memba DAO governance core. It holds the roster, proposals and votes, and grants nothing by ...

Overview

Package memba_gov is the Memba DAO governance core. It holds the roster, proposals and votes, and grants nothing by itself: a governed realm asks for an approval by crossing-calling Consume before a privileged step, and the core checks that the caller is exactly the realm the proposal names, with exactly the arguments members voted on. The core never calls another realm.

Rules (design note GOV-1, approved 2026-10-06):

  • members propose, vote and execute by direct calls from their own account, and an invited key joins by its own direct call; only a governed realm's crossing call reaches Consume;
  • a key counts toward the roster only after it signed Join itself;
  • one action per proposal, stored by value; approvals are used once;
  • every executed roster action and every Join invalidates every open proposal, so votes always count against an unchanged roster;
  • Consume invalidates the other open proposals of its (target, scope).

Constants 4

const VotingPeriod, ExecutionWindow, WeightedDelay, HeadcountDelay, RosterDelay, InactiveDelay, InactiveAfter, SeedInviteTTL, VotedInviteTTL

 1const (
 2	VotingPeriod    = 7 * 24 * time.Hour
 3	ExecutionWindow = 7 * 24 * time.Hour
 4	WeightedDelay   = 24 * time.Hour // critical, weight route
 5	HeadcountDelay  = 72 * time.Hour // critical, headcount route
 6	RosterDelay     = 7 * 24 * time.Hour
 7	InactiveDelay   = 14 * 24 * time.Hour
 8	InactiveAfter   = 180 * 24 * time.Hour
 9	SeedInviteTTL   = 90 * 24 * time.Hour
10	VotedInviteTTL  = 30 * 24 * time.Hour
11)
source

The policy's durations, in their own file so a node fixture, which cannot wait days, can replace this file alone and run the real rules faster.

const corePath, MaxSeats, MinSeats, MaxScope, MaxNote, MaxAction, actAddMember, actRemoveMember, actSetWeight, actRecover, actRemoveInactive, actUninvite, voteYes, voteNo, voteAbstain

 1const (
 2	corePath  = "gno.land/r/samcrew/memba_gov"
 3	MaxSeats  = 25
 4	MinSeats  = 2
 5	MaxScope  = 160
 6	MaxNote   = 280
 7	MaxAction = 64
 8
 9	actAddMember      = "AddMember"
10	actRemoveMember   = "RemoveMember"
11	actSetWeight      = "SetWeight"
12	actRecover        = "Recover"
13	actRemoveInactive = "RemoveInactive"
14	actUninvite       = "Uninvite"
15
16	voteYes     = "yes"
17	voteNo      = "no"
18	voteAbstain = "abstain"
19)
source

const MaxListed

1const MaxListed = 20
source

MaxListed is the most proposals ProposalsJSON and Render return at once.

Functions 12

func ConstantsJSON

Action
1func ConstantsJSON() string
source

ConstantsJSON returns the fixed policy: durations in seconds, roster bounds.

func Consume

crossing Action
1func Consume(cur realm, pid uint64, action, args, scope string, minClass int, executor address)
source

Consume is crossing-called by a governed realm right before the step a proposal approved. It panics unless the caller is exactly the proposal's target, the action, arguments and scope are the voted ones byte for byte, the class is at least minClass, the proposal is ready, and executor, the account that called the target directly, is a seated member. It marks the proposal used and invalidates the other open proposals of (target, scope).

func Execute

crossing Action
1func Execute(cur realm, pid uint64)
source

Execute runs a ready roster action of this realm. The roster it was checked against at Propose is unchanged: any change would have invalidated it.

func IsMember

Action
1func IsMember(addr address) bool
source

IsMember reports whether addr is a seated member's current key.

func Join

crossing Action
1func Join(cur realm)
source

Join seats the caller's invitation: a new person, or a recovered key.

func PersonOf

Action
1func PersonOf(addr address) string
source

PersonOf returns the id of the seated member whose current key is addr, or "". The id survives a key recovery.

func ProposalJSON

Action
1func ProposalJSON(pid uint64) string
source

ProposalJSON returns one proposal with its ballots and current status, or null for an unknown id.

func ProposalsJSON

Action
1func ProposalsJSON(before uint64, limit int) string
source

ProposalsJSON lists up to limit proposals (at most MaxListed) with ids below before, newest first; before = 0 starts from the newest.

func Propose

crossing Action
1func Propose(cur realm, target, action, args, scope string, class int, note string) uint64
source

Propose files one action. target is the realm that will consume it, or this realm for a roster action; scope is the invalidation key that realm computes for the action; class is at least the class it requires.

func Render

1func Render(_ string) string
source

Render shows the roster and the latest proposals. Each proposal's line holds only fields the realm sets (id, status, class, proposer id); every value a proposer wrote follows as its own labelled, escaped item, so none can forge a field.

func Vote

crossing Action
1func Vote(cur realm, pid uint64, choice string)
source

Vote records yes, no or abstain until the voting deadline. After it, a YES can still be withdrawn while the proposal is not executed or expired, so members can stop an approval they no longer back.

Imports 5

Source Files 6