PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/samcrew/memba_weighted_host

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
memba_weighted_host
Namespace
samcrew
Files
32 (gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/samcrew/memba_weighted_host
gno
0.9

Files (32)

  • gnomod.tomltoml
  • appstore_actions.gnogno
  • appstore_host.gnogno
  • appstore_reads.gnogno
  • arcade_actions.gnogno
  • arcade_host.gnogno
  • arcade_reads.gno
gno
  • badges_actions.gnogno
  • badges_host.gnogno
  • badges_reads.gnogno
  • channels_actions.gnogno
  • channels_host.gnogno
  • channels_reads.gnogno
  • escrow_actions.gnogno
  • escrow_host.gnogno
  • escrow_reads.gnogno
  • feed_actions.gnogno
  • feed_host.gnogno
  • feed_reads.gnogno
  • feedback_actions.gnogno
  • feedback_host.gnogno
  • feedback_reads.gnogno
  • host.gnogno
  • market_actions.gnogno
  • market_host.gnogno
  • quest_actions.gnogno
  • quest_host.gnogno
  • quest_reads.gnogno
  • reads.gnogno
  • reviews_actions.gnogno
  • reviews_host.gnogno
  • reviews_reads.gnogno
  • feed_actions.gnogno
    1package memba_weighted_host23import (4	"chain"5	"gno.land/p/samcrew/memba_weighted_policy"6)78

    Functions

    not supported for pure packages by the node (vm/qfuncs)

    Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

    const FeedPath = "gno.land/r/samcrew/memba_feed_v1"
    9
    10type FeedActionKind string
    11
    12const (
    13 FeedAcceptOwner FeedActionKind = "accept-owner"
    14 FeedReturnOwner FeedActionKind = "return-owner"
    15 FeedAbortReturn FeedActionKind = "abort-return"
    16 FeedAddModerator FeedActionKind = "add-moderator"
    17 FeedRemoveModerator FeedActionKind = "remove-moderator"
    18 FeedUnpause FeedActionKind = "unpause"
    19)
    20
    21type FeedPolicy struct{ dao, successor address }
    22
    23func NewFeedPolicy(dao, successor address) FeedPolicy {
    24 if !dao.IsValid() || dao != chain.PackageAddress("gno.land/r/samcrew/memba_dao") {
    25 panic("feed policy requires the founding DAO address")
    26 }
    27 if !successor.IsValid() || successor == dao || successor == chain.PackageAddress(FeedPath) {
    28 panic("feed policy requires a valid distinct successor")
    29 }
    30 return FeedPolicy{dao: dao, successor: successor}
    31}
    32func (p FeedPolicy) DAO() address { return p.dao }
    33func (p FeedPolicy) Successor() address { return p.successor }
    34
    35type FeedAction struct {
    36 kind FeedActionKind
    37 recipient address
    38 subject address
    39}
    40
    41func (p FeedPolicy) Accept() FeedAction { return FeedAction{kind: FeedAcceptOwner} }
    42func (p FeedPolicy) Return() FeedAction {
    43 return FeedAction{kind: FeedReturnOwner, recipient: p.successor}
    44}
    45func (p FeedPolicy) AbortReturn() FeedAction {
    46 return FeedAction{kind: FeedAbortReturn, recipient: p.successor}
    47}
    48func (p FeedPolicy) AddModerator(who address) FeedAction {
    49 if who == p.dao || who == chain.PackageAddress(FeedPath) {
    50 panic("feed moderator must be an external account")
    51 }
    52 a := FeedAction{kind: FeedAddModerator, subject: who}
    53 a.Bytes()
    54 return a
    55}
    56func FeedRevokeModerator(who address) FeedAction {
    57 a := FeedAction{kind: FeedRemoveModerator, subject: who}
    58 a.Bytes()
    59 return a
    60}
    61func FeedResume() FeedAction { return FeedAction{kind: FeedUnpause} }
    62func (a FeedAction) Kind() FeedActionKind { return a.kind }
    63func (a FeedAction) Recipient() address { return a.recipient }
    64func (a FeedAction) Subject() address { return a.subject }
    65func (a FeedAction) Bytes() string {
    66 base := "feed/v1|" + FeedPath + "|" + string(a.kind)
    67 switch a.kind {
    68 case FeedAcceptOwner, FeedUnpause:
    69 if a.recipient != "" || a.subject != "" {
    70 panic("malformed feed action")
    71 }
    72 return base
    73 case FeedReturnOwner, FeedAbortReturn:
    74 if !a.recipient.IsValid() || a.subject != "" {
    75 panic("malformed feed return action")
    76 }
    77 return base + "|" + string(a.recipient)
    78 case FeedAddModerator, FeedRemoveModerator:
    79 if !a.subject.IsValid() || a.recipient != "" {
    80 panic("invalid feed moderator action")
    81 }
    82 return base + "|" + string(a.subject)
    83 default:
    84 panic("unsupported feed action")
    85 }
    86}
    87func (a FeedAction) Category() memba_weighted_policy.Category {
    88 a.Bytes()
    89 if a.kind == FeedUnpause {
    90 return memba_weighted_policy.Financial
    91 }
    92 return memba_weighted_policy.Critical
    93}
    94