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

revshare package

Overview

Package revshare is a team revenue realm that IS a subscription provider. The live subscriptions realm supports realm providers but warns, in its own frozen header, that a realm provider "must expose its own crossing path to Claim, or what it earns is stranded." revshare is that crossing path, plus the one thing a team needs on top of it: pulled revenue is split among weighted members into pull-claimable balances.

THE ECONOMIC COMPOSITION, PRECISELY:

Example
 1components            : subscriptions (live realm — the revenue
 2                        machine and the upstream custodian),
 3                        feeledger (member balance accounting,
 4                        fee cap 0), coinio (payouts, held-balance
 5                        reads, reserve-protected sweep).
 6value boundaries      : B1 subscriber EOA -> subscriptions (plan
 7                        price, origin envelope; governed by
 8                        subscriptions' own H == U + F). B2
 9                        subscriptions -> revshare (banker send:
10                        ClaimAll pays the caller, and the caller
11                        is this realm). B3 revshare -> member EOA
12                        (coinio.Payout on Claim/ClaimAll).
13who owns which state  : subscriptions owns plans, subs and the
14                        provider's claimable balance (revshare's
15                        RECEIVABLE); revshare owns the member
16                        table, weights, and the member balances in
17                        its own ledger. No state is shared; the
18                        only coupling is the crossing calls and
19                        the coins that move over B2.
20who controls funds    : upstream, only a claim by this realm can
21                        move its receivable (provider-keyed
22                        ledger). Here, member balances move only
23                        to their owner (pull claims); the admin
24                        can NEVER touch earned balances — sweep
25                        reserves them, weight changes affect only
26                        FUTURE distributions.
27identity propagation  : downstream sees cur.Previous() = THIS
28                        realm on every crossing call, so the plan
29                        provider and the claim beneficiary are the
30                        realm address by construction — no admin
31                        or member identity ever reaches the
32                        downstream realm.
33conservation          : Held == UsersTotal + S (surplus above the
34                        Liabilities() reserve, recoverable only by
35                        SweepDenom). Distribution is exact: shares
36                        are floor(amount*w/W) via the
37                        overflow-free split (A/W)*w + ((A%W)*w)/W,
38                        and the remainder goes to the
39                        highest-weight member (ties: lowest
40                        address) — fee_split's deterministic dust
41                        policy, so no residual pool exists.
42                        Cross-boundary: lifetime Pulled equals the
43                        sum of all distributions, and the
44                        downstream receivable is NOT part of Held.
45ordering              : Pull refuses BEFORE the downstream call
46                        (no members configured = refuse), claims
47                        downstream, MEASURES the arrival as a
48                        held-balance delta, then distributes
49                        exactly what arrived. State-after-call:
50                        the only local mutations happen after the
51                        boundary, on measured coins.
52downstream abort      : "nothing to claim" (or any downstream
53                        panic) aborts the whole Pull — no local
54                        state exists yet to corrupt, by ordering
55                        AND by VM atomicity. There is no recover
56                        anywhere in this realm, and none may be
57                        added.
58replay                : a second Pull finds a zero downstream
59                        balance and aborts there. Distribution
60                        credits are driven by the measured delta,
61                        so a replayed Pull cannot double-count
62                        even in principle.
63trust                 : revshare does not trust the downstream
64                        reply beyond "it did not abort" — it
65                        distributes the measured balance delta,
66                        not a reported amount. Downstream
67                        validates nothing about this caller; the
68                        provider ledger is keyed by address.
69terminal states       : plans retire downstream (provider-only,
70                        exposed here admin-gated); members can be
71                        removed (earned balances survive removal
72                        and stay claimable); the realm itself has
73                        no terminal state — a team that walks away
74                        leaves only pull-claimable balances.
75adversarial callers   : Pull is permissionless — it can only move
76                        the receivable into member balances at the
77                        fixed weights, so a stranger's Pull is a
78                        free favor. Plan creation/retirement is
79                        admin-gated (the downstream per-provider
80                        plan quota is a griefable resource).
81                        Members trust the admin for FUTURE weights
82                        only, never for earned balances. All
83                        entrypoints refuse coin-carrying
84                        transactions (the downstream assertNoSend
85                        reads the origin envelope; ours matches).

One team per deploy: subscriptions keeps ONE claimable balance per provider address, so a multi-team router behind one realm address could not attribute revenue at the boundary. This is a measured constraint of the downstream API, not a choice.

Functions

AcceptAdmin

func AcceptAdmin(cur realm)

AcceptAdmin completes the handover; only the staged successor may. The sweeper role moves with the admin.

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "AcceptAdmin" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "AcceptAdmin" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

AddMember

func AddMember(cur realm, a address, weight int64)

AddMember adds a weighted member. Weight changes never touch earned balances; they shape future pulls only.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "AddMember" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "AddMember" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

BalanceOf

func BalanceOf(a address) int64

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.BalanceOf()"

Result

Claim

func Claim(cur realm, amount int64)

Claim sends amount ugnot of the caller's earned balance to the caller.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "Claim" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "Claim" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

ClaimAll

func ClaimAll(cur realm)

ClaimAll sends the caller's entire earned balance to the caller.

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "ClaimAll" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "ClaimAll" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

CreatePlan

func CreatePlan(cur realm, title, description string, price, periodBlocks, maxFeeBps int64) int64

CreatePlan creates a subscription plan THROUGH this realm, making the realm the plan's provider downstream. Admin only: the per-provider plan quota downstream is a griefable resource.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "CreatePlan" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "CreatePlan" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

Held

func Held() int64

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.Held()"

Result

MemberCount

func MemberCount() int64

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.MemberCount()"

Result

MemberWeight

func MemberWeight(a address) int64

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.MemberWeight()"

Result

NumPlans

func NumPlans() int64

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.NumPlans()"

Result

PlanID

func PlanID(i int64) int64

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.PlanID()"

Result

Pull

func Pull(cur realm) int64

Pull claims this realm's entire accrued provider balance from the subscriptions realm and distributes it to the members by weight. Permissionless: pulling can only move the receivable into member balances at the fixed weights, so anyone may crank it. Refuses BEFORE the downstream call when no member could receive the funds.

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "Pull" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "Pull" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

Pulled

func Pulled() int64

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.Pulled()"

Result

Receivable

func Receivable() int64

Receivable reads this realm's accrued, not-yet-pulled provider balance inside the subscriptions realm — the other side of value boundary B2. It is deliberately NOT part of Held or of the local conservation equation.

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.Receivable()"

Result

RemoveMember

func RemoveMember(cur realm, a address)

RemoveMember removes a member from future distributions. The member's earned balance is untouched and stays claimable forever.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "RemoveMember" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "RemoveMember" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

Render

func Render(path string) string

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.Render()"

Result

RetirePlan

func RetirePlan(cur realm, planID int64)

RetirePlan retires one of this realm's plans downstream. Admin only.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "RetirePlan" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "RetirePlan" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

SetWeight

func SetWeight(cur realm, a address, weight int64)

SetWeight changes a member's weight for future distributions.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "SetWeight" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "SetWeight" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

SweepDenom

func SweepDenom(cur realm, denom string)

SweepDenom recovers out-of-band coins to the sweeper. For the accounting denom the reserve is the full ledger liability — member balances are structurally unsweepable. Sweeper only.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "SweepDenom" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "SweepDenom" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

TotalWeight

func TotalWeight() int64

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.TotalWeight()"

Result

TransferAdmin

func TransferAdmin(cur realm, successor address)

TransferAdmin stages a two-step admin handover.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "TransferAdmin" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare" -func "TransferAdmin" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

UsersTotal

func UsersTotal() int64

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/revshare.UsersTotal()"

Result