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

patron/v0 package

Overview

Package patron is recurring support for a builder, on chain.

A creator opens a plan with a price per period and a period measured in blocks. A supporter attaches ugnot to Subscribe and buys whole periods of it. Anybody can ask at any height whether a given address is still active, which is the one question a tip cannot answer.

There is no cron on chain, so a renewal is a pull and not a push

Nothing in this realm can charge anybody. A renewal happens because the supporter sends another payment, never because a timer fired: there is no scheduler here, and there is no way to write one, since a native coin cannot be pulled at all. A reader arriving from web2 expects a standing mandate on a card and there is nothing of the kind, anywhere on this chain.

What this adds over the tip jar

gno.land/r/moul/x/daily/tipjar is the one-shot version and is already live: one payment, a leaderboard, and then nothing. The recurrence is the whole difference. A plan has a price and a period, a payment buys whole periods of it, renewing early never discards time already paid for, and the realm answers "is this address active right now" at any height. It is the one app in the x/social family that produces a recurring write rather than a one-off.

Earnings are credited at payment time, not streamed

The creator can withdraw the full price the instant it is paid. A supporter who stops being active is NOT refunded, and no part of a paid period ever comes back. That is a deliberate v0 limitation: escrowed streaming, where the creator claims only what has elapsed and the supporter cancels and reclaims the rest, needs a claim schedule and a refund path, and that is a larger realm than this one rather than a flag on it.

Money leaves by pull

Both halves of what this realm owes, a creator's earnings and a supporter's change, land in one credit ledger and leave through Withdraw. The credit is zeroed before any coin moves, and the realm never loops over payees: one unpayable address would otherwise fail the whole batch and hand a griefer a cheap denial of service.

v0 ships no token

Deliberately, and the README says why: a creator coin minted per period paid is easy, and the sink is not, because what it would be redeemed for is a promise made off chain.

Function

Subscribe

func Subscribe(cur realm, planID int64) int64

Subscribe buys whole periods on a plan with the ugnot attached to the call, and returns the caller's new paid-through height.

Attach the coins with -send: a payment short of one period is refused, and the remainder under one period is credited back to the caller rather than kept, so an overpayment is change and never a silent fee. Take it back with Withdraw.

It has to be called directly by a user, and that is not a style choice

The envelope is what the SIGNER attached to the transaction. A realm the user called has already received those coins itself, and could then call in here as many times as it liked against one payment, so the caller is checked before the envelope is read. The same property means a realm cannot forward an envelope it was handed (`NewBanker` requires the previous frame to be a user call), and that `maketx run` cannot reach this function at all, because a run script is itself a code realm. Use `maketx call -send`.

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/moul/x/social/patron/v0" -func "Subscribe" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/social/patron/v0" -func "Subscribe" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx