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

Package memba\_appstore\_v1 is a curated App Store for gno.land dApps: publishers pay a flat listing fee to register ...

Overview

Package memba_appstore_v1 is a curated App Store for gno.land dApps: publishers pay a flat listing fee to register an app; a curator flips it live.

MONEY PATH (the only one): RegisterApp collects a flat `registrationFee` in ugnot and forwards 100% to the treasury in the SAME call — nothing is ever custodied. The safety contract mirrors memba_token_otc_v1 + the O-13 lesson:

  1. IsUserCall() guard BEFORE reading OriginSend — an ephemeral `maketx run` realm can never attach unrecoverable coins (the guard agent_registry missed).
  2. exact-coin via unsafe.OriginSend() (the coins on THIS call, not the wallet balance) — closes the overpay-trap and the wallet-balance bypass.
  3. treasury-misconfig is fail-closed: an unset treasury panics (→ tx reverts → coins refunded), never silent custody.
  4. CEI: state is written before the banker moves funds.
  5. NewBanker(RealmSend, cur) sends the fee from the realm's own address to the treasury — no custody, no escrow (which is why no escrow is needed to be safe).

TREASURY: stored LOCALLY (admin-settable, 2-step handoff, defaults to the samcrew multisig) rather than read from memba_market_config — this keeps the realm self-contained so the whole money path is unit-tested locally. Keep it in sync with memba_market_config.GetTreasury(); a future version may read the fee spine directly (which makes the realm non-locally-testable — a deliberate later trade-off).

Constants 5

const DefaultRegistrationFee, MaxRegistrationFee, MaxNameLen, MaxTaglineLen, MaxDescrLen, MaxURLLen, MaxPkgPathLen, MaxCIDLen, FlagHideThreshold

 1const (
 2	// DefaultRegistrationFee is the launch listing fee: 1 GNOT (1_000_000 ugnot).
 3	// The DAO/admin can change it via SetRegistrationFee (bounded by MaxRegistrationFee).
 4	DefaultRegistrationFee = int64(1_000_000)
 5	// MaxRegistrationFee caps a fat-finger / compromised-proposal fee at 100 GNOT.
 6	MaxRegistrationFee = int64(100_000_000)
 7
 8	MaxNameLen    = 80
 9	MaxTaglineLen = 140
10	MaxDescrLen   = 2000
11	MaxURLLen     = 400
12	MaxPkgPathLen = 200
13	MaxCIDLen     = 100
14	// FlagHideThreshold auto-hides a listing from the live list once this many
15	// distinct addresses have flagged it (a curator can DelistApp / restore).
16	FlagHideThreshold = 5
17)
source

const AdminAddress

1const AdminAddress = "g10kw7e55e9wc8j8v6904ck29dqwr9fm9u280juh"
source

AdminAddress is the samcrew-core 2-of-2 multisig (same as the fee spine's admin/ treasury). It is the initial owner AND the initial treasury.

const RenderMaxRows

1const RenderMaxRows = 100
source

RenderMaxRows bounds the Render() output so a large catalog can never make the realm render-DoS (mirrors the feed's live-only bounded render).

Functions 18

func AcceptOwnership

crossing Action
1func AcceptOwnership(cur realm)
source

AcceptOwnership completes the handoff. Only the staged pendingOwner may call it.

func AddCurator

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

AddCurator grants the curate role (approve pending listings). Owner only.

func AppCount

Action
1func AppCount() int
source

AppCount returns the total number of registered listings (any status).

func ApproveApp

crossing Action
1func ApproveApp(cur realm, pkgPath string)
source

ApproveApp flips a pending listing live. Curator-only.

func DelistApp

crossing Action
1func DelistApp(cur realm, pkgPath string)
source

DelistApp removes a listing from public view. The publisher or a curator may do it.

func FlagApp

crossing Action
1func FlagApp(cur realm, pkgPath string)
source

FlagApp lets any user flag a LIVE listing once. At FlagHideThreshold distinct flags the listing stops appearing live; a curator then DelistApp's it or leaves it for review (a delisted app can be brought back with RestoreApp).

func GetListingJSON

Action
1func GetListingJSON(pkgPath string) string
source

GetListingJSON returns a single listing (any status) with its description, or the JSON literal `null` if the package path is not registered.

func ListLiveJSON

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

ListLiveJSON returns a bounded JSON array of the visible (live, un-hidden) listings: skip `offset`, take up to clamped `limit`. Iteration stops as soon as the window is filled, so the scan is bounded by offset+limit regardless of catalog size.

func Pause

crossing Action
1func Pause(cur realm, state bool)
source

Pause is the kill switch: while paused, RegisterApp aborts (reads stay available). Owner only.

func RegisterApp

crossing Action
1func RegisterApp(
2	cur realm,
3	pkgPath, name, tagline, descr, category, iconCID, appURL string,
4) uint64
source

RegisterApp lists a new app. The caller pays EXACTLY registrationFee ugnot with the call; the whole fee is forwarded to the treasury (no custody). The listing starts `pending` and is not shown live until a curator approves it.

func RemoveCurator

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

RemoveCurator revokes the curate role. Owner only.

func Render

1func Render(path string) string
source

Render shows the live catalog (bounded) — a read-only trust surface for gnoweb. The frontend reads structured data via the getters, not this markdown.

func RestoreApp

crossing Action
1func RestoreApp(cur realm, pkgPath string)
source

RestoreApp brings a delisted app back to `pending` (re-curation required before it shows live again). Curator-only — this is the reverse of DelistApp, so a mistaken or contested delist is recoverable.

func SetRegistrationFee

crossing Action
1func SetRegistrationFee(cur realm, fee int64)
source

SetRegistrationFee sets the flat listing fee in ugnot (0..MaxRegistrationFee). Zero is allowed (a fee waiver). Owner only.

func SetTreasury

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

SetTreasury repoints the fee recipient. Must be non-empty (an empty treasury would fail-close RegisterApp). Owner only. Keep this in sync with memba_market_config.GetTreasury().

func TransferOwnership

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

TransferOwnership stages a new owner; it takes effect only after AcceptOwnership is called BY that address (2-step, so a typo can't brick admin).

Types 1

type Listing

struct
 1type Listing struct {
 2	Id        uint64
 3	PkgPath   string
 4	Name      string
 5	Tagline   string
 6	Descr     string
 7	Category  string
 8	IconCID   string
 9	AppURL    string
10	Publisher address
11	Status    string
12	FlagCount int
13	CreatedAt int64
14}
source

Listing is one app. PkgPath (the realm/package path) is the unique key.

Imports 7

Source Files 5