Skip to content Search Apps Documentation Source Content 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.

access state

Back to all declarations

owner

.uverse.address

Value

<gnolang.StringValue>

priceUsdCents

int64

Value

2500

periodSec

int64

Value

2592000

creditsPerUsdCent

int64

Value

1600

maxTopUpUgnot

int64

Value

1000000000000

quoteUgnot

int64

// ugnot for one period

Value

422749053

quotedAt

int64

// when it was posted

Value

1793490004

prevUgnot

int64

Value

422749053

prevUntil

int64

Value

1793490904

quoteTtlSec

int64

Value

900

quoteGraceSec

int64

Value

900

quoteGraceBand

int64

Value

4

pendingOwner

.uverse.address

Value

<zero>

operator

.uverse.address

Value

<gnolang.StringValue>

subs

map[.uverse.address]int64

// addr -> expiry (unix)

Open
OID
01a52d…53ae:18
subs details

Inspect map

credits

map[.uverse.address]int64

// addr -> credit balance

Open
OID
01a52d…53ae:20
credits details

Inspect map

settled

map[.uverse.address]int64
Open
OID
01a52d…53ae:22
settled details

Inspect map

Subscribe

func()

Subscribe buys pro time for the caller at the live quote. Each whole quote sent buys one period; anything left over becomes units at the same rate a top-up gets, rather than being kept, so the payer keeps the value of every ugnot they sent. Every call is priced at the quote in force when it executes, so a renewal costs what a period costs today. Pinning a renewal to the price paid at first purchase is a known trap: Unlock Protocol does it and a renewal simply reverts once the price has moved.

Open
OID
01a52d…53ae:23
Subscribe details

Inspect func

subscribe

func(payer .uverse.address, paid int64)

subscribe holds the money math, separate from the origin/caller plumbing above so it can be exercised directly (AssertOriginCall cannot be satisfied from a test frame).

Open
OID
01a52d…53ae:25
subscribe details

Inspect func

Login

func()

Login does nothing. Sign-In-With-Gno signs (never broadcasts) a call to it so the wallet shows a "Login" to GnoPulse rather than a token transfer; the challenge nonce rides in the tx memo.

Open
OID
01a52d…53ae:26
Login details

Inspect func

TopUp

func()

TopUp buys prepaid credits for the caller.

Open
OID
01a52d…53ae:27
TopUp details

Inspect func

topUp

func(payer .uverse.address, paid int64)

topUp converts the payment to units at the SAME quote the subscription uses, so a credit is worth the same in dollars whatever GNOT is doing. Paying in GNOT, priced in USD.

Open
OID
01a52d…53ae:28
topUp details

Inspect func

unitsFor

func(paid int64, price int64) int64

unitsFor converts a ugnot payment into API units at a given quote. The payment is worth paid/price of a period, a period costs priceUsdCents, and one cent buys creditsPerUsdCent units. One helper so a top-up and the change from a subscription can never diverge.

Open
OID
01a52d…53ae:29
unitsFor details

Inspect func

HasAccess

func(addr .uverse.address) bool
Open
OID
01a52d…53ae:30
HasAccess details

Inspect func

TierOf

func(addr .uverse.address) string
Open
OID
01a52d…53ae:31
TierOf details

Inspect func

CreditsOf

func(addr .uverse.address) int64
Open
OID
01a52d…53ae:32
CreditsOf details

Inspect func

ExpiresAt

func(addr .uverse.address) int64
Open
OID
01a52d…53ae:33
ExpiresAt details

Inspect func

SettledOf

func(addr .uverse.address) int64
Open
OID
01a52d…53ae:34
SettledOf details

Inspect func

Config

func() (int64, int64, int64, int64, int64)
Open
OID
01a52d…53ae:36
Config details

Inspect func

Consume

func(addr .uverse.address, uptoUnits int64)

Consume charges an address for metered API usage, up to a cumulative cost-unit total. The owner passes the caller's running lifetime usage, not a delta: the realm keeps the watermark itself and charges only the part it has not charged before. That makes the call idempotent (a replay is rejected, not re-billed) and means a restored or rolled-back off-chain database cannot double-charge anyone. A caller with too few credits is charged what they have and the watermark still advances; the event records both what was owed and what was actually taken, so a shortfall is visible rather than silently forgiven.

Open
OID
01a52d…53ae:37
Consume details

Inspect func

consume

func(addr .uverse.address, uptoUnits int64)
Open
OID
01a52d…53ae:38
consume details

Inspect func

Forgive

func(addr .uverse.address, uptoUnits int64)

Forgive advances the billing watermark without charging: usage already covered by an active time-based subscription. Separate from Consume so that "we decided not to bill this" is its own auditable on-chain act rather than an invisible gap in the watermark.

Open
OID
01a52d…53ae:39
Forgive details

Inspect func

forgive

func(addr .uverse.address, uptoUnits int64)
Open
OID
01a52d…53ae:40
forgive details

Inspect func

SetQuote

func(ugnotPerPeriod int64)

SetQuote posts the price of one period in ugnot. Called on a short schedule by the job that already tracks the GNOT price, which converts priceUsdCents off chain and publishes only the result. The previous quote stays payable for quoteGraceSec so payments already in flight are not repriced.

Open
OID
01a52d…53ae:41
SetQuote details

Inspect func

setQuote

func(ugnotPerPeriod int64)
Open
OID
01a52d…53ae:42
setQuote details

Inspect func

Quote

func() (int64, int64, int64)

Quote is what the payment page reads: the amount to send for one period, and the moment it stops being honoured. Reading it from here rather than from a price feed is what makes the figure on screen and the figure charged the same number.

Open
OID
01a52d…53ae:43
Quote details

Inspect func

currentPrice

func() int64

currentPrice is what Subscribe charges. While a superseded quote is still inside its grace window both are live, and the payer is charged the lower of the two: we cannot tell which one they were shown, and charging the lower one guarantees it is never more than they saw.

Open
OID
01a52d…53ae:44
currentPrice details

Inspect func

SetConfig

func(cents int64, period int64, perUsdCent int64, ttl int64, grace int64)
Open
OID
01a52d…53ae:45
SetConfig details

Inspect func

setConfig

func(cents int64, period int64, perUsdCent int64, ttl int64, grace int64)
Open
OID
01a52d…53ae:46
setConfig details

Inspect func

TransferOwnership

func(newOwner .uverse.address)

TransferOwnership OFFERS the realm to newOwner. It does not hand it over: the offer stands until that address claims it with AcceptOwnership. A mistyped address therefore costs nothing, where a single-step transfer would have locked every admin function and the revenue behind an address nobody holds, permanently, because the realm cannot be redeployed.

Open
OID
01a52d…53ae:48
TransferOwnership details

Inspect func

transferOwnership

func(newOwner .uverse.address)

transferOwnership holds the offer itself, split from the owner gate above for the same reason subscribe is split from Subscribe: assertOwner cannot be satisfied from a test frame.

Open
OID
01a52d…53ae:49
transferOwnership details

Inspect func

CancelOwnershipTransfer

func()

CancelOwnershipTransfer withdraws a standing offer.

Open
OID
01a52d…53ae:50
CancelOwnershipTransfer details

Inspect func

AcceptOwnership

func()

AcceptOwnership completes the handover. Only the offered address can call it, which proves the key exists and can sign before anything irreversible happens.

Open
OID
01a52d…53ae:51
AcceptOwnership details

Inspect func

acceptOwnership

func(caller .uverse.address)
Open
OID
01a52d…53ae:52
acceptOwnership details

Inspect func

PendingOwner

func() .uverse.address
Open
OID
01a52d…53ae:53
PendingOwner details

Inspect func

SetOperator

func(op .uverse.address)

SetOperator appoints, rotates or (with an empty address) revokes the hot role. One step, unlike TransferOwnership, and the asymmetry is deliberate: a mistyped owner is permanent and locks the revenue, while a mistyped operator only means quotes stop until the owner sets it again. Making revocation a two-step handshake would be worse than useless, since the address being revoked is the one you no longer trust to act.

Open
OID
01a52d…53ae:54
SetOperator details

Inspect func

setOperator

func(op .uverse.address)
Open
OID
01a52d…53ae:55
setOperator details

Inspect func

assertOwner

func()

assertOwner requires a DIRECT call from the owner. cur.Previous() is the immediate caller, so a relaying realm (owner -> X -> here) would fail this, no separate origin assert needed.

Open
OID
01a52d…53ae:57
assertOwner details

Inspect func

isOperator

func(caller .uverse.address) bool

isOperator is the routine-work gate as a pure predicate, so it is unit-testable: assertOperator below cannot be satisfied from a test frame, exactly as assertOwner cannot. The owner always passes. A fresh deploy has no operator yet, so the owner must be able to post the first quote or the realm is unusable until one is appointed, and the owner must be able to take over the moment an operator is revoked.

Open
OID
01a52d…53ae:58
isOperator details

Inspect func

assertOperator

func()

assertOperator gates the two jobs that run on a schedule. Everything that moves money or changes the terms stays behind assertOwner, including Forgive, which is the repair for an operator that over-charges and therefore must never be reachable by one.

Open
OID
01a52d…53ae:59
assertOperator details

Inspect func

usd

func(cents int64) string

usd renders cents as dollars, keeping the two decimal places (2500 -> "25.00", 2505 -> "25.05").

Open
OID
01a52d…53ae:61
usd details

Inspect func
owner : .uverse.address =<gnolang.StringValue>
priceUsdCents : int64 =2500
periodSec : int64 =2592000
creditsPerUsdCent : int64 =1600
maxTopUpUgnot : int64 =1000000000000
quoteUgnot : int64 =422749053
quotedAt : int64 =1793490004
prevUgnot : int64 =422749053
prevUntil : int64 =1793490904
quoteTtlSec : int64 =900
quoteGraceSec : int64 =900
quoteGraceBand : int64 =4
pendingOwner : .uverse.address =<zero>
operator : .uverse.address =<gnolang.StringValue>
subs : map[.uverse.address]int64 Inspect
credits : map[.uverse.address]int64 Inspect
settled : map[.uverse.address]int64 Inspect
Subscribe : func() Inspect
subscribe : func(payer .uverse.address, paid int64) Inspect
Login : func() Inspect
TopUp : func() Inspect
topUp : func(payer .uverse.address, paid int64) Inspect
unitsFor : func(paid int64, price int64) int64 Inspect
HasAccess : func(addr .uverse.address) bool Inspect
TierOf : func(addr .uverse.address) string Inspect
CreditsOf : func(addr .uverse.address) int64 Inspect
ExpiresAt : func(addr .uverse.address) int64 Inspect
SettledOf : func(addr .uverse.address) int64 Inspect
Owner : func() .uverse.address Inspect
Config : func() (int64, int64, int64, int64, int64) Inspect
Consume : func(addr .uverse.address, uptoUnits int64) Inspect
consume : func(addr .uverse.address, uptoUnits int64) Inspect
Forgive : func(addr .uverse.address, uptoUnits int64) Inspect
forgive : func(addr .uverse.address, uptoUnits int64) Inspect
SetQuote : func(ugnotPerPeriod int64) Inspect
setQuote : func(ugnotPerPeriod int64) Inspect
Quote : func() (int64, int64, int64) Inspect
currentPrice : func() int64 Inspect
SetConfig : func(cents int64, period int64, perUsdCent int64, ttl int64, grace int64) Inspect
setConfig : func(cents int64, period int64, perUsdCent int64, ttl int64, grace int64) Inspect
Withdraw : func(amount int64) Inspect
TransferOwnership : func(newOwner .uverse.address) Inspect
transferOwnership : func(newOwner .uverse.address) Inspect
CancelOwnershipTransfer : func() Inspect
AcceptOwnership : func() Inspect
acceptOwnership : func(caller .uverse.address) Inspect
PendingOwner : func() .uverse.address Inspect
SetOperator : func(op .uverse.address) Inspect
setOperator : func(op .uverse.address) Inspect
Operator : func() .uverse.address Inspect
assertOwner : func() Inspect
isOperator : func(caller .uverse.address) bool Inspect
assertOperator : func() Inspect
Render : func(path string) string Inspect
usd : func(cents int64) string Inspect