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_weighted_policy source pure

Package memba\_weighted\_policy implements the approved founding coalition and delay rules. The hosting DAO must auth...

Overview

Package memba_weighted_policy implements the approved founding coalition and delay rules. The hosting DAO must authenticate callers, classify and freeze typed actions, and keep every Policy and Proposal private. This package grants no authority over a realm and is not a replacement for those integration gates.

Constants 3

const VotingPeriod

1const VotingPeriod = 7 * 24 * time.Hour
source

VotingPeriod is fixed by the approved founding policy, not proposer input.

Functions 1

func New

1func New(members []Member) *Policy
source

Types 6

type Member

struct
1type Member struct {
2	PersonID string
3	Address  address
4	Founder  bool
5}
source

PersonID is the directory's unique human identity, never a wallet alias. The host must establish that different PersonIDs really are different people.

type Policy

struct
1type Policy struct {
2	members    [7]Member
3	generation uint64
4}
source

Policy fixes one founding seven-person roster. Reconfiguration deliberately invalidates every pending proposal, including already mature proposals. Only a reviewed critical-action handler in the host may call Reconfigure.

Methods on Policy

func MayPause

method on Policy
1func (p *Policy) MayPause(who address) bool
source

MayPause establishes member eligibility only. The host must dispatch only a typed, allowlisted pause operation; this is never spend or unpause authority.

func NewProposal

method on Policy
1func (p *Policy) NewProposal(category Category, action string) *Proposal
source

func Reconfigure

method on Policy
1func (p *Policy) Reconfigure(members []Member)
source

Reconfigure is a host-only operation, not an authenticated public DAO API. It preserves the approved seven seats and 2/1 weights. Invalid input cannot mutate the roster or invalidate proposals, even if the host recovers a panic.

type Proposal

struct
 1type Proposal struct {
 2	policy         *Policy
 3	generation     uint64
 4	category       Category
 5	action         string
 6	votes          [7]Vote
 7	yesSince       [7]time.Time
 8	createdAt      time.Time
 9	votingDeadline time.Time
10	lastChange     time.Time
11	consumed       bool
12}
source

Proposal freezes the category, exact action bytes and roster generation. The host determines the category from the action handler, never user input. Each proposal has its own vote storage and qualification clocks. yesSince[i] is the start of seat i's current uninterrupted YES ballot and is meaningful only while votes[i] is Yes.

Methods on Proposal

func Consume

method on Proposal
1func (p *Proposal) Consume(action string)
source

Consume binds execution to the frozen action and marks it consumed BEFORE the host invokes its typed handler. The host must let handler failure abort the transaction: recovering a panic does not roll back Gno realm state. Caller authentication and current-member executor eligibility belong to the host. Do not expose Proposal pointers or call Consume from a read endpoint.

func State

method on Proposal
1func (p *Proposal) State() State
source

func Vote

method on Proposal
1func (p *Proposal) Vote(who address, vote Vote)
source

Vote requires a caller identity already authenticated by the host realm. Voting closes at the deadline, including changes to existing ballots. A critical route starts when some coalition that is still voting YES without interruption first met its threshold. A withdrawal moves the clock only when every such coalition needed that ballot, so voters the rest of the YES set does not need cannot postpone execution by withdrawing and rejoining.

type State

struct
 1type State struct {
 2	Category       Category
 3	CreatedAt      time.Time
 4	VotingDeadline time.Time
 5	VotingClosed   bool
 6	Qualified      bool
 7	Expired        bool
 8	WeightYes      int
 9	PeopleYes      int
10	DevelopersYes  int
11	WeightedAfter  time.Time
12	DeveloperAfter time.Time
13	Invalidated    bool
14	Consumed       bool
15	Ready          bool
16}
source

State is a copy for rendering. Reading never starts or advances a clock. An invalidated proposal reports no current tally or execution authorization.

Imports 2

  • strings stdlib
  • time stdlib

Source Files 2