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

v0 state

Back to all declarations

realmPath

untyped string

realmPath 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 string

denom is the only coin this realm handles.

Value

"ugnot"

plans

*v0.Registry

plans holds every plan and the credit ledger. A redeploy wipes it, which is the trade \`private = true\` makes: see gnomod.toml.

Open
OID
022ab8…a062:4
plans details

Inspect pointer

Open

func(title string, description string, pricePerPeriod int64, periodBlocks int64) int64

Open 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.

Open
OID
022ab8…a062:13
Open details

Inspect func

Subscribe

func(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](#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\`.

Open
OID
022ab8…a062:15
Subscribe details

Inspect func

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.

Open
OID
022ab8…a062:16
Close details

Inspect func

Reopen

func(planID int64)

Reopen lets a closed plan take subscriptions again. Creator only.

Open
OID
022ab8…a062:17
Reopen details

Inspect func

Withdraw

func() int64

Withdraw 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.

Open
OID
022ab8…a062:18
Withdraw details

Inspect func

Get

func(planID int64) (creator .uverse.address, title string, description string, pricePerPeriod int64, periodBlocks int64, open bool)
Open
OID
022ab8…a062:19
Get details

Inspect func

Count

func() int

Count is how many plans exist.

Open
OID
022ab8…a062:20
Count details

Inspect func

IsActive

func(planID int64, who .uverse.address) bool

IsActive 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.

Open
OID
022ab8…a062:21
IsActive details

Inspect func

PaidThrough

func(planID int64, who .uverse.address) int64

PaidThrough is the height who stops being active at on this plan, or zero if they never paid.

Open
OID
022ab8…a062:22
PaidThrough details

Inspect func

SupporterCount

func(planID int64) int

SupporterCount is how many distinct addresses have ever paid this plan, active or not.

Open
OID
022ab8…a062:23
SupporterCount details

Inspect func

Supporters

func(planID int64) [].uverse.address
Open
OID
022ab8…a062:24
Supporters details

Inspect func

EarnedBy

func(creator .uverse.address) int64

EarnedBy is the lifetime ugnot credited to creator across every plan, whether or not it has been withdrawn.

Open
OID
022ab8…a062:25
EarnedBy details

Inspect func

CreditOf

func(addr .uverse.address) int64

CreditOf is what addr can withdraw right now.

Open
OID
022ab8…a062:26
CreditOf details

Inspect func

TotalOwed

func() int64

TotalOwed is everything this realm owes, which is what it must keep in reserve at its own address.

Open
OID
022ab8…a062:27
TotalOwed details

Inspect func

mustGet

func(id v0.ID) *v0.Plan

mustGet reads a plan or aborts naming it.

Open
OID
022ab8…a062:28
mustGet details

Inspect func

pageSize

untyped bigint

pageSize is how many plans the index lists at once.

Value

(20 <untyped> bigint)

titleWidth

untyped bigint

titleWidth is how much of a plan's title a listing shows.

Value

(40 <untyped> bigint)

Render

func(path string) string

Render routes two views: the index and one plan.

Open
OID
022ab8…a062:30
Render details

Inspect func

renderIndex

func(req *v0.Request) string
Open
OID
022ab8…a062:32
renderIndex details

Inspect func

renderPlan

func(raw string) string
Open
OID
022ab8…a062:33
renderPlan details

Inspect func

planTable

func(items []v0.Listing, now int64) string

planTable 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.

Open
OID
022ab8…a062:34
planTable details

Inspect func

supporterTable

func(p *v0.Plan, now int64) string
Open
OID
022ab8…a062:35
supporterTable details

Inspect func

pageNum

func(req *v0.Request) int

pageNum 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.

Open
OID
022ab8…a062:36
pageNum details

Inspect func
realmPath : untyped string ="gno.land/r/moul/x/social/patron/v0"
denom : untyped string ="ugnot"
plans : *v0.Registry Inspect
Open : func(title string, description string, pricePerPeriod int64, periodBlocks int64) int64 Inspect
Subscribe : func(planID int64) int64 Inspect
Close : func(planID int64) Inspect
Reopen : func(planID int64) Inspect
Withdraw : func() int64 Inspect
Get : func(planID int64) (creator .uverse.address, title string, description string, pricePerPeriod int64, periodBlocks int64, open bool) Inspect
Count : func() int Inspect
IsActive : func(planID int64, who .uverse.address) bool Inspect
PaidThrough : func(planID int64, who .uverse.address) int64 Inspect
SupporterCount : func(planID int64) int Inspect
Supporters : func(planID int64) [].uverse.address Inspect
EarnedBy : func(creator .uverse.address) int64 Inspect
CreditOf : func(addr .uverse.address) int64 Inspect
TotalOwed : func() int64 Inspect
mustGet : func(id v0.ID) *v0.Plan Inspect
caller : func() .uverse.address Inspect
pageSize : untyped bigint =(20 <untyped> bigint)
titleWidth : untyped bigint =(40 <untyped> bigint)
Render : func(path string) string Inspect
renderIndex : func(req *v0.Request) string Inspect
renderPlan : func(raw string) string Inspect
planTable : func(items []v0.Listing, now int64) string Inspect
supporterTable : func(p *v0.Plan, now int64) string Inspect
pageNum : func(req *v0.Request) int Inspect