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 package

Overview

Package mandate is capped, revocable direct debit on native GNOT, built on Gno session keys.

A payee publishes a plan ("1 GNOT every 7 days"). A payer subscribes with two things signed by the payer's own key:

  1. a session on chain for the payee's collector key, scoped to this realm only, with a spend limit of the plan's amount plus a small fee allowance per period, and an expiry;
  2. Subscribe here, which records the terms for that session.

The payee's collector then calls Pull once per period, signed with the session key on behalf of the payer and sending exactly the plan's amount. The realm is the rulebook: it checks who, how much and when, then forwards the coins to the payee in the same transaction. It never keeps funds.

Honest limits, also shown on the home page:

  • It is direct debit, not escrow. A payer can revoke the session, cancel, or empty the account at any time; the payee is then not paid.
  • The chain caps what the payer can lose per period at the session's spend limit: amount plus fee allowance. A hostile payee can burn the allowance as gas fees (it goes to the network, not to the payee).
  • The chain allows at most 16 sessions per account, so a wallet can have at most 16 mandates at a time.
  • A realm cannot see an on-chain session revoke. A service deciding whether someone has paid reads PaidThrough, which moves only when a payment succeeds; HasMandate is only the realm's view (recorded, not cancelled, not expired), and the chain's own view of the session is the free query auth/accounts/<payer>/session/<session address>.
  • A session scoped to vm/exec:<this realm> also allows every realm under this path (the chain's scope match is prefix-based). Nothing must ever be deployed under a sub-path of this realm. Pull also refuses any session whose allow list is not exactly this realm, but that cannot protect a payer from a sub-realm called directly.

There is no admin, owner, pause, upgrade or sweep.

Function

PaidThrough

func PaidThrough(payer address, planID uint64) int64
Ask AI Claude ChatGPT

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.

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1llc3lq3zmjtjdk29dk52munrzxt5ne746cl7r8/mandate.PaidThrough(,)"

Result

Gno Expression Evaluator

Evaluate any read-only Gno expression against gno.land/r/g1llc3lq3zmjtjdk29dk52munrzxt5ne746cl7r8/mandate, for example a function call with arguments.