Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

mandate state

Back to all declarations

gnowebSafe

func(s string) string
Open
OID
0a1979…b7a4:6
gnowebSafe details

Inspect func

Denom

untyped string

Denom is the only coin a plan can be paid in.

Value

"ugnot"

MinAmount

int64

Limits. See docs/design.md for the reasoning behind each value.

Value

100000

MaxAmount

int64

Limits. See docs/design.md for the reasoning behind each value.

Value

1000000000000

MinPeriod

int64

Limits. See docs/design.md for the reasoning behind each value.

Value

60

MaxPeriod

int64

Limits. See docs/design.md for the reasoning behind each value.

Value

2592000

MaxTerm

int64

Limits. See docs/design.md for the reasoning behind each value.

Value

31622400

FeeAllowance

int64

Limits. See docs/design.md for the reasoning behind each value.

Value

100000

MaxTitleLen

untyped bigint

Limits. See docs/design.md for the reasoning behind each value.

Value

(80 <untyped> bigint)

PageSize

untyped bigint

Limits. See docs/design.md for the reasoning behind each value.

Value

(20 <untyped> bigint)

MaxSessionsPerWallet

untyped bigint

Limits. See docs/design.md for the reasoning behind each value.

Value

(16 <untyped> bigint)

Plan

type

Plan is published by a payee and never changes. New terms mean a new plan.

Value

mandate.Plan

Mandate

type

Mandate is one payer's permission for one session key on one plan. It keeps only what cannot be derived: the amount paid is Pulls \* the plan's amount, and the last pull was one period before NextPullAt.

Value

mandate.Mandate

Payee

type

Payee holds a payee's plans, totals and published collector key.

Value

mandate.Payee

realmPath

string

// this realm's package path, captured at init

Value

"gno.land/r/g1llc3lq3zmjtjdk29dk52munrzxt5ne746cl7r8/mandate"

nextPlanID

uint64

State. Storage is paid per byte (100 ugnot) and gas mostly per object read or written, so the layout keeps both small, and nothing one address does can grow what another payer's calls read (docs/design.md): - plans, payees and payers live in avl trees: an attacker can only add depth (log2 of the number of entries); - each payer's lookups live in that payer's own record (Payer, stored by value in the tree), capped at MaxActivePerPayer active mandates and MaxCreditsPerPayer kept credits; - each plan's supporter list holds small values in chunks (see fixedList), so adding one costs the same however long it is; - a payer's history is a linked list through the mandates, walked only by free reads.

Value

1

nextMandateID

uint64

State. Storage is paid per byte (100 ugnot) and gas mostly per object read or written, so the layout keeps both small, and nothing one address does can grow what another payer's calls read (docs/design.md): - plans, payees and payers live in avl trees: an attacker can only add depth (log2 of the number of entries); - each payer's lookups live in that payer's own record (Payer, stored by value in the tree), capped at MaxActivePerPayer active mandates and MaxCreditsPerPayer kept credits; - each plan's supporter list holds small values in chunks (see fixedList), so adding one costs the same however long it is; - a payer's history is a linked list through the mandates, walked only by free reads.

Value

1

payers

*v0.Tree

// payer -> Payer (a value, not a pointer)

Open
OID
0a1979…b7a4:17
payers details

Inspect pointer

totalPulls

int64

State. Storage is paid per byte (100 ugnot) and gas mostly per object read or written, so the layout keeps both small, and nothing one address does can grow what another payer's calls read (docs/design.md): - plans, payees and payers live in avl trees: an attacker can only add depth (log2 of the number of entries); - each payer's lookups live in that payer's own record (Payer, stored by value in the tree), capped at MaxActivePerPayer active mandates and MaxCreditsPerPayer kept credits; - each plan's supporter list holds small values in chunks (see fixedList), so adding one costs the same however long it is; - a payer's history is a linked list through the mandates, walked only by free reads.

Value

1

totalPaid

int64

State. Storage is paid per byte (100 ugnot) and gas mostly per object read or written, so the layout keeps both small, and nothing one address does can grow what another payer's calls read (docs/design.md): - plans, payees and payers live in avl trees: an attacker can only add depth (log2 of the number of entries); - each payer's lookups live in that payer's own record (Payer, stored by value in the tree), capped at MaxActivePerPayer active mandates and MaxCreditsPerPayer kept credits; - each plan's supporter list holds small values in chunks (see fixedList), so adding one costs the same however long it is; - a payer's history is a linked list through the mandates, walked only by free reads.

Value

500000

Offer

func(title string, amountUgnot int64, periodSeconds int64) uint64

Offer publishes a plan: amountUgnot every periodSeconds, paid to the caller. Signed with the payee's own key; no session, no coins.

Open
OID
0a1979…b7a4:23
Offer details

Inspect func

SetCollectorKey

func(pubKey string)

SetCollectorKey publishes the public key (bech32, gpub1...) of the key the payee's collector signs pulls with. Plan pages show it in the copy-ready commands, so payers create their session for the right key. Signed with the payee's own key. It does not change existing mandates.

Open
OID
0a1979…b7a4:24
SetCollectorKey details

Inspect func

Subscribe

func(planID uint64, sessionAddr .uverse.address, expiresAtUnix int64) uint64

Subscribe records the terms for one session: the payer allows the holder of sessionAddr to pull the plan's amount once per period until expiresAtUnix, through this realm only. Signed with the payer's own key (never a session), no coins. Create the session on chain in the same transaction or just before (see the plan page for the exact command). The first payment is collected by the first Pull, which is due at once (billing in advance: each period is paid at its start).

Open
OID
0a1979…b7a4:25
Subscribe details

Inspect func

Pull

func()

Pull collects one period's payment. It must be signed with the mandate's session key on behalf of the payer (gnokey ... -master \<payer> \<session key>), as a direct call, sending exactly the plan's amount. The realm forwards the coins to the plan's payee in the same transaction. At most one pull per period; the next one is due one period after this one, the same rule the chain applies to the session's spend period.

Open
OID
0a1979…b7a4:26
Pull details

Inspect func

checkPull

func(isSession bool, sess .uverse.address, paths []string, payer .uverse.address, sent chain.Coins, now int64) (*mandate.Mandate, *mandate.Plan)

checkPull applies every rule of Pull to the transaction's session info, signer and coins, and returns the mandate and plan to pay, or panics. It is separate from Pull so the rules can be unit-tested: \`gno test\` cannot sign with a session key.

Open
OID
0a1979…b7a4:27
checkPull details

Inspect func

recordPull

func(m *mandate.Mandate, p *mandate.Plan, now int64)

recordPull updates the mandate, plan, payee and totals for one payment and emits the event. It never creates an object: Pull runs under the payer's session budget, which also pays its storage deposit. A first pull flips the mandate's entry in the plan's list from unpaid to paid in place (same width) and sets fields that were zero (amino omits zero values), a few dozen bytes at most; later pulls add nothing.

Open
OID
0a1979…b7a4:28
recordPull details

Inspect func

Cancel

func(payer .uverse.address, sessionAddr .uverse.address)

Cancel ends a mandate in the realm. The payer or the payee may cancel, each with their own key (never a session). A payer should also revoke the session on chain (the payer page shows the command); cancelling alone already makes every later Pull fail.

Open
OID
0a1979…b7a4:29
Cancel details

Inspect func

directCaller

func() .uverse.address
Open
OID
0a1979…b7a4:30
directCaller details

Inspect func

planOf

func(id uint64) *mandate.Plan
Open
OID
0a1979…b7a4:31
planOf details

Inspect func

payeeOf

func(a .uverse.address) *mandate.Payee
Open
OID
0a1979…b7a4:32
payeeOf details

Inspect func

validateTitle

func(s string) string

validateTitle returns "" or the reason the title is refused: blank, too long, not UTF-8, or containing control characters or line separators.

Open
OID
0a1979…b7a4:33
validateTitle details

Inspect func

pad

func(id uint64) string

pad formats an id with a fixed width so tree keys sort numerically.

Open
OID
0a1979…b7a4:34
pad details

Inspect func

collectorFunded

func(addr .uverse.address) bool

collectorFunded reports whether a collector key's address holds coins. Receiving any coin makes an address an account for good, and the chain refuses to create a session for a key whose address is an account (tm2/pkg/sdk/auth/handler.go:63-65): no new supporter could join. A balance cannot see an account that received coins and was emptied; the free query auth/accounts/\<address> can, and the collector runs it.

Open
OID
0a1979…b7a4:37
collectorFunded details

Inspect func

PlanInfo

type

PlanInfo is a copy of a plan.

Value

mandate.PlanInfo

MandateInfo

type

MandateInfo is a copy of a mandate with the realm's view of it.

Value

mandate.MandateInfo

PayeeInfo

type

PayeeInfo is a copy of a payee's totals and collector key.

Value

mandate.PayeeInfo

GetPlan

func(id uint64) (mandate.PlanInfo, bool)

GetPlan returns the plan with this id.

Open
OID
0a1979…b7a4:38
GetPlan details

Inspect func

MandateOf

func(payer .uverse.address, sessionAddr .uverse.address) (mandate.MandateInfo, bool)

MandateOf returns the latest mandate of payer for this session address.

Open
OID
0a1979…b7a4:40
MandateOf details

Inspect func

PaidThrough

func(payer .uverse.address, planID uint64) int64

PaidThrough is the read for services that deliver something to paying supporters. It returns the unix time until which the payer's payments for the plan cover them: the latest payment's time plus one period. Paid time stays the payer's when a mandate is cancelled (by either side) or expires, and a new mandate for the same plan starts when it ends, so it is not charged twice. The one exception: a payer who already holds 16 kept periods (MaxCreditsPerPayer). 0 when they never paid for the plan. Deliver while now \< PaidThrough. It turns false at the due time and moves on only when the payee's collector pulls the next payment: allow a grace equal to how often the collector runs (an hour, say) before treating a supporter as lapsed. A payment is proof; a mandate is not: anyone can record a mandate without creating a session and without paying. A realm also cannot see a session revoked on chain: a revoked supporter simply stops paying, so PaidThrough stops moving and runs out within one period.

Open
OID
0a1979…b7a4:41
PaidThrough details

Inspect func

IsPaidUp

func(payer .uverse.address, planID uint64) bool

IsPaidUp reports whether payer's latest payment for the plan still covers now (now \< PaidThrough). See PaidThrough.

Open
OID
0a1979…b7a4:42
IsPaidUp details

Inspect func

HasMandate

func(payer .uverse.address, planID uint64) bool

HasMandate reports whether payer has a mandate for the plan that is neither cancelled nor expired in the realm. It says nothing about payment (a mandate costs only a storage deposit to record) and cannot see a session revoked on chain: do not grant anything on it; use PaidThrough.

Open
OID
0a1979…b7a4:43
HasMandate details

Inspect func

NextPullAt

func(payer .uverse.address, planID uint64) int64

NextPullAt returns when the next pull of payer's active mandate for the plan is allowed (unix seconds), or 0 if there is no active mandate.

Open
OID
0a1979…b7a4:44
NextPullAt details

Inspect func

GetPayee

func(payee .uverse.address) (mandate.PayeeInfo, bool)

GetPayee returns a payee's totals and collector key.

Open
OID
0a1979…b7a4:45
GetPayee details

Inspect func

Totals

func() (plansCount int, mandatesCount int, pulls int64, paid int64)

Totals returns the number of plans and mandates, and all pulls so far.

Open
OID
0a1979…b7a4:46
Totals details

Inspect func

Plans

func(page int) []mandate.PlanInfo

Plans lists all plans, newest first, PageSize per page (page 1 first).

Open
OID
0a1979…b7a4:47
Plans details

Inspect func

PlansOf

func(payee .uverse.address, page int) []mandate.PlanInfo

PlansOf lists a payee's plans, oldest first.

Open
OID
0a1979…b7a4:48
PlansOf details

Inspect func

payeePlans

func(payee .uverse.address, page int) ([]*mandate.Plan, bool)

payeePlans returns page \`page\` of a payee's plans and whether more follow.

Open
OID
0a1979…b7a4:49
payeePlans details

Inspect func

MandatesOf

func(payer .uverse.address, page int) []mandate.MandateInfo

MandatesOf lists a payer's mandates (all states), newest first.

Open
OID
0a1979…b7a4:50
MandatesOf details

Inspect func

payerPage

func(payer .uverse.address, page int) ([]*mandate.Mandate, bool)

payerPage returns page \`page\` of the payer's mandates, newest first, and whether another page follows. It walks the payer's history, which only free reads do.

Open
OID
0a1979…b7a4:51
payerPage details

Inspect func

SupportersOf

func(planID uint64, page int) []mandate.MandateInfo

SupportersOf lists a plan's active mandates (not cancelled, replaced or expired), oldest first. Page n covers entries (n-1)\*PageSize to n\*PageSize-1 of the plan's list, so a page may hold fewer rows than PageSize; inactive ones are on the payers' own pages.

Open
OID
0a1979…b7a4:52
SupportersOf details

Inspect func

ScanLimit

untyped bigint

ScanLimit is the most supporter-list entries one free read resolves (looks up in its payer's record); WalkLimit is the most it reads at all. Entries carry their status, so cancelled ones, and for some reads unpaid ones, are skipped without a lookup. Reads that filter return a cursor to continue from, so junk can delay but never hide a real entry.

Value

(200 <untyped> bigint)

WalkLimit

untyped bigint

ScanLimit is the most supporter-list entries one free read resolves (looks up in its payer's record); WalkLimit is the most it reads at all. Entries carry their status, so cancelled ones, and for some reads unpaid ones, are skipped without a lookup. Reads that filter return a cursor to continue from, so junk can delay but never hide a real entry.

Value

(1000 <untyped> bigint)

CollectorPlans

func(payee .uverse.address, page int) string

CollectorPlans lists a payee's plans for a collector script, one per line: <plan id> <amount ugnot> <period seconds> <mandates> PageSize per page; the last line is "more" or "end".

Open
OID
0a1979…b7a4:53
CollectorPlans details

Inspect func

CollectorScan

func(planID uint64, sessionAddr .uverse.address, from int) string

CollectorScan walks at most ScanLimit entries of a plan's supporter list, from index \`from\` (0 = oldest), and returns the active mandates whose session key is sessionAddr, one per line: <index> <mandate id> <payer> <amount ugnot> <next pull unix> <due|wait> <pulls> <paid> \<paid> is 1 when the payer has paid for this plan (this mandate pulled, or it started with paid time carried over from an earlier one), 0 when it never has. The last line is "next \<index>" when more entries follow, "end" otherwise. Cancelled and expired mandates, and mandates for other keys, are skipped here, so a collector never needs to read them. Anyone can record a mandate without a session, so a collector should check on chain that the session exists, at least before the first pull of a mandate whose payer never paid.

Open
OID
0a1979…b7a4:54
CollectorScan details

Inspect func

payingFrom

func(p *mandate.Plan, from int, now int64) ([]*mandate.Mandate, int)

payingFrom lists a plan's supporters: mandates that have paid at least once and are active now, newest first, up to PageSize, starting at list index \`from\` (or the newest when from \< 0). It reads at most WalkLimit entries and resolves at most ScanLimit of them (only entries marked paid are resolved), and returns the index to continue from (-1 when the list is exhausted).

Open
OID
0a1979…b7a4:55
payingFrom details

Inspect func

PayingSupporters

func(planID uint64, from int) ([]mandate.MandateInfo, int)

PayingSupporters lists a plan's supporters the way its gnoweb page does: mandates that have paid at least once and are active now, newest first, at most PageSize per call. Pass from = -1 for the newest; the second result is where to continue. A client must stop when it is -1 (the list is exhausted): -1 passed back in starts again from the newest, so a client that feeds the cursor back unchecked loops for ever. Each call walks at most WalkLimit entries and looks up at most ScanLimit of them, so a call may return fewer than PageSize (even none) and still a cursor.

Open
OID
0a1979…b7a4:56
PayingSupporters details

Inspect func

PlanCounts

func(planID uint64) (paidThisPeriod int, paidLastPeriod int, unpaid int, unpaidExact bool)

PlanCounts returns the numbers the gnoweb plan page shows: how many supporters paid in the plan's current period window and in the one before (as in GetPlan), and how many active mandates have never paid, among the latest ScanLimit entries (unpaidExact is false when there were more entries than that).

Open
OID
0a1979…b7a4:57
PlanCounts details

Inspect func

countUnpaid

func(p *mandate.Plan, now int64) (int, bool)

countUnpaid counts active mandates that have never paid, among the plan's latest ScanLimit mandates, and says whether that covered them all.

Open
OID
0a1979…b7a4:58
countUnpaid details

Inspect func

infos

func(list []*mandate.Mandate) []mandate.MandateInfo
Open
OID
0a1979…b7a4:59
infos details

Inspect func

offset

func(page int) int

offset turns a 1-based page number into a row offset; pages below 1 and absurdly large pages are clamped.

Open
OID
0a1979…b7a4:60
offset details

Inspect func

pageBounds

func(n int, page int) (lo int, hi int, more bool)

pageBounds returns the slice bounds of page \`page\` (1-based, PageSize rows) in a list of n rows, and whether another page follows.

Open
OID
0a1979…b7a4:61
pageBounds details

Inspect func

paidFlag

func(m *mandate.Mandate) string

paidFlag is CollectorScan's last column: "1" once the payer has paid for the plan through this mandate or carried paid time into it, else "0".

Open
OID
0a1979…b7a4:62
paidFlag details

Inspect func

SourceRepo

untyped string

SourceRepo is where the source code is published, shown in the footer of every page.

Value

"https://github.com/elangrr/mandate"

ChainID

untyped string

Network the copy-ready commands are pinned to.

Value

"onyx-1"

Remote

untyped string

Network the copy-ready commands are pinned to.

Value

"https://rpc.onyx.testnets.gno.land:443"

callGas

untyped string

Gas settings used in the commands. The chain charges the whole fee set, whatever gas is used, and accepts it when fee / gas wanted is at least the current gas price (1 ugnot per 1,000 gas on Onyx). Measured on a local chain: Offer and Subscribe use 7M to 10M gas, Pull 8M to 9M. Reads on Onyx cost more per object (the chain prices a read by its store's depth, and Onyx's store is far larger), so gas wanted keeps about 2x headroom. The Pull fee counts against the session's spend limit (see FeeAllowance).

Value

"-gas-fee 100000ugnot -gas-wanted 60000000"

pullGas

untyped string

Gas settings used in the commands. The chain charges the whole fee set, whatever gas is used, and accepts it when fee / gas wanted is at least the current gas price (1 ugnot per 1,000 gas on Onyx). Measured on a local chain: Offer and Subscribe use 7M to 10M gas, Pull 8M to 9M. Reads on Onyx cost more per object (the chain prices a read by its store's depth, and Onyx's store is far larger), so gas wanted keeps about 2x headroom. The Pull fee counts against the session's spend limit (see FeeAllowance).

Value

"-gas-fee 20000ugnot -gas-wanted 20000000"

Render

func(path string) string

Render returns the gnoweb page for path, with the footer.

Open
OID
0a1979…b7a4:63
Render details

Inspect func

renderPage

func(raw string) string
Open
OID
0a1979…b7a4:66
renderPage details

Inspect func

renderHome

func(from int) string
Open
OID
0a1979…b7a4:67
renderHome details

Inspect func

homeScanPlans

untyped bigint

homeScanPlans is how many plans one home page walks. Each check reads only the plan itself (its payment counters), never its supporters.

Value

(200 <untyped> bigint)

plansWithSupporters

func(from int) string

plansWithSupporters lists, newest first, the plans that someone paid in the current or the previous period, walking at most homeScanPlans plans per page: plans nobody pays for (spam included) never fill this list, and a "more" link continues the walk. A plan someone keeps paying for stays, whatever the churn of its supporter list.

Open
OID
0a1979…b7a4:68
plansWithSupporters details

Inspect func

renderAllPlans

func(page int) string
Open
OID
0a1979…b7a4:69
renderAllPlans details

Inspect func

renderPlan

func(id uint64, from int) string
Open
OID
0a1979…b7a4:70
renderPlan details

Inspect func

renderPayer

func(payer .uverse.address, page int) string
Open
OID
0a1979…b7a4:71
renderPayer details

Inspect func

renderPayee

func(payee .uverse.address, page int) string
Open
OID
0a1979…b7a4:72
renderPayee details

Inspect func

renderNotFound

func() string
Open
OID
0a1979…b7a4:74
renderNotFound details

Inspect func

payingText

func(p *mandate.Plan, now int64) string

payingText is the plan headline's count of payments per period. It counts payments, not distinct people: a creator paying its own plan from a second wallet counts too.

Open
OID
0a1979…b7a4:75
payingText details

Inspect func

payingCell

func(p *mandate.Plan, now int64) string

payingCell is the count in tables: paid this period / the one before.

Open
OID
0a1979…b7a4:76
payingCell details

Inspect func

infoPayingCell

func(p mandate.PlanInfo) string
Open
OID
0a1979…b7a4:77
infoPayingCell details

Inspect func

intParam

func(query string, key string, def int) int

intParam returns the integer value of key in the query, or def.

Open
OID
0a1979…b7a4:78
intParam details

Inspect func

pager

func(page string, n int, more bool) string
Open
OID
0a1979…b7a4:80
pager details

Inspect func

pageParam

func(query string) int
Open
OID
0a1979…b7a4:81
pageParam details

Inspect func

plural

func(n int, one string, many string) string
Open
OID
0a1979…b7a4:82
plural details

Inspect func

price

func(amount int64, period int64) string
Open
OID
0a1979…b7a4:84
price details

Inspect func

formatUgnot

func(n int64) string

formatUgnot shows an amount in GNOT with up to six decimals.

Open
OID
0a1979…b7a4:85
formatUgnot details

Inspect func

formatPeriod

func(sec int64) string

formatPeriod shows a number of seconds in the largest exact unit.

Open
OID
0a1979…b7a4:86
formatPeriod details

Inspect func

formatTime

func(unix int64) string
Open
OID
0a1979…b7a4:87
formatTime details

Inspect func

formatTimeOrNever

func(unix int64) string
Open
OID
0a1979…b7a4:88
formatTimeOrNever details

Inspect func

short

func(a .uverse.address) string
Open
OID
0a1979…b7a4:89
short details

Inspect func

fanout

untyped bigint

fanout is the number of entries per chunk, and of chunks per super-chunk.

Value

(32 <untyped> bigint)

fixedList

type

fixedList is an append-only list of strings of one fixed width, in two levels of chunks. It holds values, never pointers to shared objects (on chain, rewriting an array costs about 0.37M gas for every pointer to a shared object it holds; docs/notes.md), and no array in it grows with the list's length except supers, by one entry per fanout\*fanout appends: - tail: the newest N % fanout entries, inside the owner object; - when tail is full it becomes a chunk, appended to the last super-chunk (at most fanout chunks each); - supers: the list of super-chunks. So an append rewrites the owner and its tail; every fanout appends it also creates a chunk and rewrites one super-chunk (at most fanout pointers to objects that only it holds); every fanout\*fanout appends it rewrites supers. set replaces an entry in place with one of the same width, so it never changes the storage size. Appends happen only in transactions signed with someone's own key (Subscribe, Offer), never under a session budget.

Value

mandate.fixedList

superChunk

type

Value

mandate.superChunk

strChunk

type

Value

mandate.strChunk

statusUnpaid

rune

Supporter entries: the payer's 40-character address, the mandate id padded to 10 digits, and one status character. Pull flips '0' to '1' at a mandate's first payment and Cancel sets 'x', both in place.

Value

48

statusPaid

rune

Supporter entries: the payer's 40-character address, the mandate id padded to 10 digits, and one status character. Pull flips '0' to '1' at a mandate's first payment and Cancel sets 'x', both in place.

Value

49

statusCancelled

rune

Supporter entries: the payer's 40-character address, the mandate id padded to 10 digits, and one status character. Pull flips '0' to '1' at a mandate's first payment and Cancel sets 'x', both in place.

Value

120

entryWidth

untyped bigint

Supporter entries: the payer's 40-character address, the mandate id padded to 10 digits, and one status character. Pull flips '0' to '1' at a mandate's first payment and Cancel sets 'x', both in place.

Value

(51 <untyped> bigint)

entry

type

entry is a decoded supporter entry.

Value

mandate.entry

encodeEntry

func(payer .uverse.address, id uint64, status uint8) string
Open
OID
0a1979…b7a4:90
encodeEntry details

Inspect func

decodeEntry

func(s string) mandate.entry
Open
OID
0a1979…b7a4:92
decodeEntry details

Inspect func

activeMandate

func(e mandate.entry) *mandate.Mandate

activeMandate returns the mandate an entry names if it is still in its payer's active list (cancelled and replaced ones are not), or nil. It may have expired: callers check isActive.

Open
OID
0a1979…b7a4:93
activeMandate details

Inspect func

MaxActivePerPayer

untyped bigint

MaxActivePerPayer is how many active mandates one payer may hold: the chain allows 16 sessions per account (tm2 std.MaxSessionsPerAccount), and each active mandate needs its own session key.

Value

(16 <untyped> bigint)

Payer

type

Payer holds one payer's own lookups and nothing of anyone else's, so no address can make another payer's Pull, Subscribe or Cancel read or write more than the payer tree's depth. - Active: the payer's current mandates, at most MaxActivePerPayer that are not expired. Cancel removes an entry at once; an expired entry is removed at the payer's next Subscribe. Each entry carries the session address and plan id inline, so finding a mandate reads one small array and loads only the mandate found. - Head: the payer's newest mandate; older ones follow through prevOfPayer (history, walked only by free reads). - Credits: time the payer has paid for on a plan where they no longer have an active mandate (cancelled by either side, or expired and pruned), at most MaxCreditsPerPayer, each still in the future. A new mandate for that plan starts when the credit ends, so paid time is not lost or charged twice, unless 16 credits are already held (see MaxCreditsPerPayer for who can then lose what).

Value

mandate.Payer

credit

type

credit is paid time kept for a plan: the payer is covered until Until.

Value

mandate.credit

MaxCreditsPerPayer

untyped bigint

MaxCreditsPerPayer bounds a payer's kept credits: 16 plans left while each is still paid ahead. At the bound, the payer's own Cancel or expiry lets the credit ending soonest give way to a later one (that plan's time is lost); a payee's Cancel never evicts: its new credit is not kept.

Value

(16 <untyped> bigint)

activeRef

type

Value

mandate.activeRef

payerOf

func(a .uverse.address) *mandate.Payer

payerOf returns a copy of the payer's record, or nil. Records are stored by value (no heap item, about 400 bytes less per payer); after changing one, write it back with save.

Open
OID
0a1979…b7a4:94
payerOf details

Inspect func

activeBySession

func(payer .uverse.address, sess .uverse.address) *mandate.Mandate

activeBySession returns the payer's active-list mandate for this session key (it may have expired but not been pruned yet), or nil.

Open
OID
0a1979…b7a4:95
activeBySession details

Inspect func

activeByPlan

func(payer .uverse.address, planID uint64) *mandate.Mandate

activeByPlan returns the payer's active-list mandate for the plan, or nil.

Open
OID
0a1979…b7a4:96
activeByPlan details

Inspect func

latestBySession

func(payer .uverse.address, sess .uverse.address) *mandate.Mandate

latestBySession returns the payer's newest mandate for this session key, active or not, walking the history when it is no longer active. For free reads only.

Open
OID
0a1979…b7a4:97
latestBySession details

Inspect func

payerHead

func(payer .uverse.address) *mandate.Mandate

payerHead returns the payer's newest mandate.

Open
OID
0a1979…b7a4:98
payerHead details

Inspect func
esc : func(s string) string Inspect
escCell : func(s string) string Inspect
gnowebSafe : func(s string) string Inspect
Denom : untyped string ="ugnot"
MinAmount : int64 =100000
MaxAmount : int64 =1000000000000
MinPeriod : int64 =60
MaxPeriod : int64 =2592000
MaxTerm : int64 =31622400
FeeAllowance : int64 =100000
MaxTitleLen : untyped bigint =(80 <untyped> bigint)
PageSize : untyped bigint =(20 <untyped> bigint)
MaxSessionsPerWallet : untyped bigint =(16 <untyped> bigint)
Plan : type =mandate.Plan
Mandate : type =mandate.Mandate
Payee : type =mandate.Payee
realmPath : string ="gno.land/r/g1llc3lq3zmjtjdk29dk52munrzxt5ne746cl7r8/mandate"
nextPlanID : uint64 =1
nextMandateID : uint64 =1
plans : *v0.Tree Inspect
payees : *v0.Tree Inspect
payers : *v0.Tree Inspect
totalPulls : int64 =1
totalPaid : int64 =500000
init.24 : func() Inspect
Offer : func(title string, amountUgnot int64, periodSeconds int64) uint64 Inspect
SetCollectorKey : func(pubKey string) Inspect
Subscribe : func(planID uint64, sessionAddr .uverse.address, expiresAtUnix int64) uint64 Inspect
Pull : func() Inspect
checkPull : func(isSession bool, sess .uverse.address, paths []string, payer .uverse.address, sent chain.Coins, now int64) (*mandate.Mandate, *mandate.Plan) Inspect
recordPull : func(m *mandate.Mandate, p *mandate.Plan, now int64) Inspect
Cancel : func(payer .uverse.address, sessionAddr .uverse.address) Inspect
directCaller : func() .uverse.address Inspect
planOf : func(id uint64) *mandate.Plan Inspect
payeeOf : func(a .uverse.address) *mandate.Payee Inspect
validateTitle : func(s string) string Inspect
pad : func(id uint64) string Inspect
itoa : func(n int64) string Inspect
utoa : func(n uint64) string Inspect
collectorFunded : func(addr .uverse.address) bool Inspect
PlanInfo : type =mandate.PlanInfo
MandateInfo : type =mandate.MandateInfo
PayeeInfo : type =mandate.PayeeInfo
GetPlan : func(id uint64) (mandate.PlanInfo, bool) Inspect
MandateOf : func(payer .uverse.address, sessionAddr .uverse.address) (mandate.MandateInfo, bool) Inspect
PaidThrough : func(payer .uverse.address, planID uint64) int64 Inspect
IsPaidUp : func(payer .uverse.address, planID uint64) bool Inspect
HasMandate : func(payer .uverse.address, planID uint64) bool Inspect
NextPullAt : func(payer .uverse.address, planID uint64) int64 Inspect
GetPayee : func(payee .uverse.address) (mandate.PayeeInfo, bool) Inspect
Totals : func() (plansCount int, mandatesCount int, pulls int64, paid int64) Inspect
Plans : func(page int) []mandate.PlanInfo Inspect
PlansOf : func(payee .uverse.address, page int) []mandate.PlanInfo Inspect
payeePlans : func(payee .uverse.address, page int) ([]*mandate.Plan, bool) Inspect
MandatesOf : func(payer .uverse.address, page int) []mandate.MandateInfo Inspect
payerPage : func(payer .uverse.address, page int) ([]*mandate.Mandate, bool) Inspect
SupportersOf : func(planID uint64, page int) []mandate.MandateInfo Inspect
ScanLimit : untyped bigint =(200 <untyped> bigint)
WalkLimit : untyped bigint =(1000 <untyped> bigint)
CollectorPlans : func(payee .uverse.address, page int) string Inspect
CollectorScan : func(planID uint64, sessionAddr .uverse.address, from int) string Inspect
payingFrom : func(p *mandate.Plan, from int, now int64) ([]*mandate.Mandate, int) Inspect
PayingSupporters : func(planID uint64, from int) ([]mandate.MandateInfo, int) Inspect
PlanCounts : func(planID uint64) (paidThisPeriod int, paidLastPeriod int, unpaid int, unpaidExact bool) Inspect
countUnpaid : func(p *mandate.Plan, now int64) (int, bool) Inspect
infos : func(list []*mandate.Mandate) []mandate.MandateInfo Inspect
offset : func(page int) int Inspect
pageBounds : func(n int, page int) (lo int, hi int, more bool) Inspect
paidFlag : func(m *mandate.Mandate) string Inspect
SourceRepo : untyped string ="https://github.com/elangrr/mandate"
ChainID : untyped string ="onyx-1"
Remote : untyped string ="https://rpc.onyx.testnets.gno.land:443"
callGas : untyped string ="-gas-fee 100000ugnot -gas-wanted 60000000"
pullGas : untyped string ="-gas-fee 20000ugnot -gas-wanted 20000000"
Render : func(path string) string Inspect
renderPage : func(raw string) string Inspect
renderHome : func(from int) string Inspect
homeScanPlans : untyped bigint =(200 <untyped> bigint)
plansWithSupporters : func(from int) string Inspect
renderAllPlans : func(page int) string Inspect
renderPlan : func(id uint64, from int) string Inspect
renderPayer : func(payer .uverse.address, page int) string Inspect
renderPayee : func(payee .uverse.address, page int) string Inspect
renderHelp : func() string Inspect
renderNotFound : func() string Inspect
payingText : func(p *mandate.Plan, now int64) string Inspect
payingCell : func(p *mandate.Plan, now int64) string Inspect
infoPayingCell : func(p mandate.PlanInfo) string Inspect
intParam : func(query string, key string, def int) int Inspect
pager : func(page string, n int, more bool) string Inspect
pageParam : func(query string) int Inspect
plural : func(n int, one string, many string) string Inspect
netFlags : func() string Inspect
price : func(amount int64, period int64) string Inspect
formatUgnot : func(n int64) string Inspect
formatPeriod : func(sec int64) string Inspect
formatTime : func(unix int64) string Inspect
formatTimeOrNever : func(unix int64) string Inspect
short : func(a .uverse.address) string Inspect
fanout : untyped bigint =(32 <untyped> bigint)
fixedList : type =mandate.fixedList
superChunk : type =mandate.superChunk
strChunk : type =mandate.strChunk
statusUnpaid : rune =48
statusPaid : rune =49
statusCancelled : rune =120
entryWidth : untyped bigint =(51 <untyped> bigint)
entry : type =mandate.entry
encodeEntry : func(payer .uverse.address, id uint64, status uint8) string Inspect
decodeEntry : func(s string) mandate.entry Inspect
activeMandate : func(e mandate.entry) *mandate.Mandate Inspect
MaxActivePerPayer : untyped bigint =(16 <untyped> bigint)
Payer : type =mandate.Payer
credit : type =mandate.credit
MaxCreditsPerPayer : untyped bigint =(16 <untyped> bigint)
activeRef : type =mandate.activeRef
payerOf : func(a .uverse.address) *mandate.Payer Inspect
activeBySession : func(payer .uverse.address, sess .uverse.address) *mandate.Mandate Inspect
activeByPlan : func(payer .uverse.address, planID uint64) *mandate.Mandate Inspect
latestBySession : func(payer .uverse.address, sess .uverse.address) *mandate.Mandate Inspect
payerHead : func(payer .uverse.address) *mandate.Mandate Inspect