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

friends_surf_club source realm

Constants 1

const TemplateVersion, APIVersion, maxMembers, maxPower, maxTitleLen, maxDescLen, maxOpenPerMember, maxPageSize, renderPageSize, kindText, kindAddMember, kindRemoveMember, kindSetRoles, kindArchive, statusActive, statusAccepted, statusRejected, statusExecuted, statusExpired, statusLapsed, statusInvalidated, statusArchived

 1const (
 2	TemplateVersion  = "memba-dao/2"
 3	APIVersion       = "2.0"
 4	maxMembers       = 100
 5	maxPower         = 1_000_000_000 // total <= 1e11, so x100 stays far below MaxInt64
 6	maxTitleLen      = 128
 7	maxDescLen       = 8000
 8	maxOpenPerMember = 10
 9	maxPageSize      = 50
10	renderPageSize   = 20
11
12	kindText         = "text"
13	kindAddMember    = "add_member"
14	kindRemoveMember = "remove_member"
15	kindSetRoles     = "set_roles"
16	kindArchive      = "archive"
17
18	statusActive      = "ACTIVE"
19	statusAccepted    = "ACCEPTED"
20	statusRejected    = "REJECTED"
21	statusExecuted    = "EXECUTED"
22	statusExpired     = "EXPIRED"
23	statusLapsed      = "LAPSED"
24	statusInvalidated = "INVALIDATED"
25	statusArchived    = "ARCHIVED"
26)
source

Functions 19

func Execute

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

Execute applies an accepted proposal after the execution delay and before the execution window closes. The stored action is checked again against the current state first; the proposal is marked EXECUTED only after it applied.

func GetMembersJSON

Action
1func GetMembersJSON(offset, limit int) string
source

GetMembersJSON returns one page of members (limit 1..50).

func GetProposalsJSON

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

GetProposalsJSON lists proposals newest first (limit 1..50). before=0 starts at the newest; pass the returned next_before to get the following page (next_before 0 means there is none). Descriptions are only returned by GetProposalJSON, which keeps a full page small.

func GetStateJSON

Action
1func GetStateJSON(offset, limit int) string
source

GetStateJSON exports the settings and one page of members, so the DAO can be recreated elsewhere.

func GetVotesJSON

Action
1func GetVotesJSON(id uint64, offset, limit int) string
source

GetVotesJSON returns one page of a proposal's votes (limit 1..50).

func IsMember

Action
1func IsMember(addr address) bool
source

IsMember lets a companion realm check membership.

func ProposeAddMember

crossing Action
1func ProposeAddMember(cur realm, title, desc string, target address, power int, rolesCSV string) uint64
source

ProposeAddMember proposes adding target with power and comma-separated roles.

func ProposeArchive

crossing Action
1func ProposeArchive(cur realm, title, desc string) uint64
source

ProposeArchive proposes archiving the DAO. Archiving is permanent.

func ProposeRemoveMember

crossing Action
1func ProposeRemoveMember(cur realm, title, desc string, target address) uint64
source

ProposeRemoveMember proposes removing target.

func ProposeSetRoles

crossing Action
1func ProposeSetRoles(cur realm, title, desc string, target address, rolesCSV string) uint64
source

ProposeSetRoles proposes replacing target's role labels.

func ProposeText

crossing Action
1func ProposeText(cur realm, title, desc, category string) uint64
source

ProposeText creates a proposal with no on-chain effect.

func Vote

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

Vote records the caller's YES, NO or ABSTAIN. A proposal is ACCEPTED once YES alone reaches the threshold of all voting power (and quorum is met), and REJECTED once that has become impossible.

Types 4

type Action

struct
1type Action struct {
2	Kind   string
3	Target address
4	Power  int
5	Roles  []string
6}
source

Action is stored by value inside its proposal at propose time. It holds primitives only and is never modified afterwards. The handler for an action is chosen by Kind in Execute; there is no other dispatch.

type Member

struct
1type Member struct {
2	Address address
3	Power   int
4	Roles   []string
5}
source

type Proposal

struct
 1type Proposal struct {
 2	ID                uint64
 3	Title             string
 4	Category          string
 5	Author            address
 6	Action            Action
 7	Status            string    // stored: ACTIVE, ACCEPTED, REJECTED, EXECUTED
 8	Votes             *avl.Tree // voter address -> VoteRecord
 9	Yes               int
10	No                int
11	Abstain           int
12	ElectorateVersion int
13	ElectoratePower   int
14	CreatedAt         int64 // unix seconds (block time)
15	VotingEndsAt      int64
16	AcceptedAt        int64  // 0 until accepted
17	FixedJSON         string // JSON of the fields that never change, built once at propose time
18}
source

Imports 7

Source Files 2