realmPath
untyped stringrealmPath is this realm's own path, the one its gnomod.toml module line declares. It is written out rather than read from the frame, because a plain read exported by a realm reports the CALLER and would build every link against whoever asked.
Value
"gno.land/r/moul/x/social/patron/v0"
denom
untyped stringdenom is the only coin this realm handles.
Value
"ugnot"
plans
*v0.Registryplans holds every plan and the credit ledger. A redeploy wipes it, which is the trade \`private = true\` makes: see gnomod.toml.
- OID
- 022ab8…a062:4
plans details
Open
func(title string, description string, pricePerPeriod int64, periodBlocks int64) int64Open creates a plan and returns its id. Anyone may open one, and opening one costs nothing beyond gas and the storage deposit. pricePerPeriod is in ugnot and must be at least one: a free plan is a tip jar, not a subscription. periodBlocks is a period in BLOCKS, bounded both ways by the engine, because height is the clock consensus agrees on and a block timestamp is not something to build a billing cliff out of.
- OID
- 022ab8…a062:13
Open details
Subscribe
func(planID int64) int64Subscribe 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](#Withdraw). ### It has to be called directly by a user, and that is not a style choice {#hdr-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\`.
- OID
- 022ab8…a062:15
Subscribe details
Close
func(planID int64)Close stops a plan taking new subscriptions. Creator only. Everything already paid for runs to its own paid-through height. Closing a plan is not a way to take a period back.
- OID
- 022ab8…a062:16
Close details
Reopen
func(planID int64)Reopen lets a closed plan take subscriptions again. Creator only.
- OID
- 022ab8…a062:17
Reopen details
Withdraw
func() int64Withdraw pays the caller everything this realm owes them and returns the amount: a creator's earnings, a supporter's change, or both at once. The credit is zeroed by the engine before a coin moves, so a recipient that calls straight back in finds nothing left to take.
- OID
- 022ab8…a062:18
Withdraw details
Get
func(planID int64) (creator .uverse.address, title string, description string, pricePerPeriod int64, periodBlocks int64, open bool)- OID
- 022ab8…a062:19
Get details
Count
func() intCount is how many plans exist.
- OID
- 022ab8…a062:20
Count details
IsActive
func(planID int64, who .uverse.address) boolIsActive reports whether who is paid up on this plan at the current height. Active means now \< paidThrough, strictly: an address paid through height h is active at h-1 and not at h.
- OID
- 022ab8…a062:21
IsActive details
PaidThrough
func(planID int64, who .uverse.address) int64PaidThrough is the height who stops being active at on this plan, or zero if they never paid.
- OID
- 022ab8…a062:22
PaidThrough details
SupporterCount
func(planID int64) intSupporterCount is how many distinct addresses have ever paid this plan, active or not.
- OID
- 022ab8…a062:23
SupporterCount details
Supporters
func(planID int64) [].uverse.address- OID
- 022ab8…a062:24
Supporters details
EarnedBy
func(creator .uverse.address) int64EarnedBy is the lifetime ugnot credited to creator across every plan, whether or not it has been withdrawn.
- OID
- 022ab8…a062:25
EarnedBy details
CreditOf
func(addr .uverse.address) int64CreditOf is what addr can withdraw right now.
- OID
- 022ab8…a062:26
CreditOf details
TotalOwed
func() int64TotalOwed is everything this realm owes, which is what it must keep in reserve at its own address.
- OID
- 022ab8…a062:27
TotalOwed details
mustGet
func(id v0.ID) *v0.PlanmustGet reads a plan or aborts naming it.
- OID
- 022ab8…a062:28
mustGet details
caller
func() .uverse.address- OID
- 022ab8…a062:29
caller details
pageSize
untyped bigintpageSize is how many plans the index lists at once.
Value
(20 <untyped> bigint)
titleWidth
untyped biginttitleWidth is how much of a plan's title a listing shows.
Value
(40 <untyped> bigint)
Render
func(path string) stringRender routes two views: the index and one plan.
- OID
- 022ab8…a062:30
Render details
renderIndex
func(req *v0.Request) string- OID
- 022ab8…a062:32
renderIndex details
renderPlan
func(raw string) string- OID
- 022ab8…a062:33
renderPlan details
planTable
func(items []v0.Listing, now int64) stringplanTable lists plans. The link text is the plan NUMBER and not its title, which is the one thing to copy from here. md.Link escapes its text with the inline escaper, and the inline escaper does not touch a pipe, because a pipe means nothing in a sentence: a user title carried inside a link inside a table cell therefore still opens a column. So the title gets its own cell and goes through ui.Cell, which is the escaper that knows it is in a table. It is truncated first with ui.ShortN, which does not escape, so the cut can never strand a backslash that the escaper had just inserted.
- OID
- 022ab8…a062:34
planTable details
supporterTable
func(p *v0.Plan, now int64) string- OID
- 022ab8…a062:35
supporterTable details
pageNum
func(req *v0.Request) intpageNum reads ?page= and falls back to the first page for anything it cannot read, which is the only answer a Render can give: there is nobody to report an error to.
- OID
- 022ab8…a062:36