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_dao_channels_v2 source realm

Constants 2

const MaxPostLen, MaxTitleLen, MaxChannels, MaxThreadsPerChan, FlagThreshold, MaxRepliesPerThread, ReplyPageSize

 1const (
 2	MaxPostLen        = 5000
 3	MaxTitleLen       = 200
 4	MaxChannels       = 20
 5	MaxThreadsPerChan = 500
 6	FlagThreshold     = 3 // flags before auto-hide
 7
 8	// AAA-1 B1 — render-DoS bounds for replies (mirrors MaxThreadsPerChan).
 9	// renderThread must never iterate the monotonic reply counter (post+delete
10	// reply spam would inflate it without bound → unbounded render scan →
11	// thread permanently unrenderable past maxGasQuery). The live-reply index
12	// (replyLive/replyLiveIDs) caps the live set, and renderThread paginates a
13	// fixed window over it, so render cost is bounded regardless of churn.
14	MaxRepliesPerThread = 500 // live (non-deleted) replies per thread
15	ReplyPageSize       = 50  // replies rendered per page
16)
source

Functions 24

func AddMember

crossing Action
1func AddMember(cur realm, addr address, roles string)
source

AddMember adds an address with specified roles. Only the owner can call this. roles is a comma-separated list (e.g., "admin,dev" or "member").

func CreateChannel

crossing Action
1func CreateChannel(cur realm, name, description string, ctype string)
source

CreateChannel adds a new channel. Only the owner (admin) can create channels.

func DeleteReply

crossing Action
1func DeleteReply(cur realm, channel string, threadID, replyID uint64)
source

DeleteReply lets the reply's author delete it. Caller must be a member and the original author. The reply node is hard-removed (B2 state-shrink) and a slot is freed under MaxRepliesPerThread (B1).

func DeleteThread

crossing Action
1func DeleteThread(cur realm, channel string, threadID uint64)
source

DeleteThread soft-deletes a thread (marks as deleted). Caller must be a member and the original author.

func EditThread

crossing Action
1func EditThread(cur realm, channel string, threadID uint64, newBody string)
source

EditThread allows the original author to edit their thread. Caller must be a member.

func FlagThread

crossing Action
1func FlagThread(cur realm, channel string, threadID uint64)
source

FlagThread flags a thread for moderation review. After FlagThreshold flags, the thread is auto-hidden. Caller must be a member (any role) to flag content.

func GetMemberRoles

Action
1func GetMemberRoles(addr address) string
source

GetMemberRoles returns the roles for a member (comma-separated) or empty string.

func GetTombstoneCount

Action
1func GetTombstoneCount(channel string) int
source

GetTombstoneCount returns how many soft-deleted threads in a channel are still awaiting hard-GC (read-only; lets ops/indexers decide when to call SweepTombstones).

func IsMember

Action
1func IsMember(addr address) bool
source

IsMember returns whether an address is a member.

func PostReply

crossing Action
1func PostReply(cur realm, channel string, threadID uint64, body string)
source

PostReply adds a reply to a thread. Caller must be a member with a role listed in the channel's WriteRoles.

func PostThread

crossing Action
1func PostThread(cur realm, channel, title, body string) uint64
source

PostThread creates a new thread in a channel. Caller must be a member with a role listed in the channel's WriteRoles.

func PurgeNonMembers

crossing Action
1func PurgeNonMembers(cur realm, keepAddresses string)
source

PurgeNonMembers removes all members not in the provided comma-separated list. The owner is never purged.

func RemoveMember

crossing Action
1func RemoveMember(cur realm, addr address)
source

RemoveMember removes an address from the membership. Only the owner can call this.

func RemoveReply

crossing Action
1func RemoveReply(cur realm, channel string, threadID, replyID uint64)
source

RemoveReply permanently removes a reply (moderation — admin role only). Hard- removes the node like DeleteReply, bounding renderThread (B1) + reclaiming storage (B2).

func RemoveThread

crossing Action
1func RemoveThread(cur realm, channel string, threadID uint64)
source

RemoveThread permanently removes a thread (moderation action — admin role only).

func SweepTombstones

crossing Action
1func SweepTombstones(cur realm, channel string, limit int) int
source

SweepTombstones hard-removes up to `limit` soft-deleted threads in a channel (and all of their remaining reply state), reclaiming AVL storage so that post+delete spam can no longer accrete permanent state (B2).

Permissionless GC by design: anyone may call it. Released storage deposits go to the calling tx per the chain's deposit policy (an explicit caller bounty); on restricted-denom chains (e.g. test12/test13 `restricted_denoms=["ugnot"]`) they route to the StorageFeeCollector instead — so this is a state-shrink/ hygiene primitive, not a user-refund path (see plan B2 / Q11).

Bounded + idempotent: each soft-deleted thread holds at most MaxRepliesPerThread reply nodes, so keep `limit` small (1–5) to stay well within block gas; re-running drains the next batch and stops at 0. Returns the number of threads swept.

func SyncMembers

crossing Action
1func SyncMembers(cur realm, addresses string, rolesList string)
source

SyncMembers allows the owner to batch-sync membership from the DAO. addresses and rolesList are comma-separated, with roles pipe-delimited per address. Example: SyncMembers("g1a,g1b", "admin,dev|member")

func TransferOwnership

crossing Action
1func TransferOwnership(cur realm, newOwner address)
source

TransferOwnership transfers realm ownership to a new address. Only the current owner can call this. The new owner gets "admin" added to their existing roles (not overwritten). The old owner is demoted from "admin" to "member".

func UnhideThread

crossing Action
1func UnhideThread(cur realm, channel string, threadID uint64)
source

UnhideThread allows the owner or an admin to clear flags and un-hide a thread.

func UpdateMemberRoles

crossing Action
1func UpdateMemberRoles(cur realm, addr address, newRoles string)
source

UpdateMemberRoles updates the roles for an existing member. Only the owner can call this.

Types 4

type Channel

struct
1type Channel struct {
2	Name        string
3	Description string
4	Type        ChannelType
5	Archived    bool
6	ReadRoles   []string // roles that can read
7	WriteRoles  []string // roles that can write
8}
source

type Reply

struct
1type Reply struct {
2	ID       uint64
3	ThreadID uint64
4	Channel  string
5	Body     string
6	Author   address
7	BlockH   int64
8	Edited   bool
9}
source

type Thread

struct
 1type Thread struct {
 2	ID        uint64
 3	Channel   string
 4	Title     string
 5	Body      string
 6	Author    address
 7	BlockH    int64
 8	Edited    bool
 9	EditedAt  int64
10	Deleted   bool
11	FlagCount int
12	Hidden    bool
13}
source

Imports 7

Source Files 2