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.

v0 state

Back to all declarations

Render

func(path string) string

Render serves three shapes: /r/nym-moultest123/vesting/v0 the seeded schedules /r/nym-moultest123/vesting/v0:g1... one address, its declared schedule /r/nym-moultest123/vesting/v0:g1...?o=&s=&e=&d= one address, a schedule you supply The query form stores nothing. It exists so an address that has not declared anything can still get a real answer: paste the schedule out of \`gnokey query auth/accounts/\<addr>\` and the balance is still read from chain.

Open
OID
058ed5…0366:3
Render details

Inspect func

source

type

Where a schedule came from. This is the distinction the whole page turns on, so it is a value and not a boolean buried in a branch.

Value

v0.source

sourceSeeded

v0.source

// a source constant in this realm

Value

<zero>

sourceDeclared

v0.source

// written by the address itself

Value

<zero>

sourceQuery

v0.source

// typed into the URL by whoever is looking

Value

<zero>

sourceNone

v0.source

// there is none

Value

<zero>

pageSize

untyped bigint

pageSize bounds the declared table. vm/qrender runs on a gas meter and a large return value fails with OutOfGasError{Descriptor:"CPUCycles"} rather than answering slowly, so an unbounded index is a page that eventually stops rendering for everyone. Anyone may Declare, so "eventually" is somebody else's choice unless it is capped here.

Value

(25 <untyped> bigint)

curPage

int

curPage is the page renderIndex is currently building, set by Render before it delegates. A parameter would be cleaner; Render's signature is fixed by the VM, and threading it through every helper for one value is worse.

Value

1

rowFor

func(addr .uverse.address, e *v0.entry) []string

rowFor builds one table row. Shared so the seeded and declared tables cannot drift apart in what they show.

Open
OID
058ed5…0366:9
rowFor details

Inspect func

pager

func(total int) string

pager renders the page links, and nothing at all when everything fits.

Open
OID
058ed5…0366:10
pager details

Inspect func

renderAccount

func(addr .uverse.address, s v0.Schedule, src v0.source, label string) string
Open
OID
058ed5…0366:11
renderAccount details

Inspect func

renderUnknown

func(addr .uverse.address) string
Open
OID
058ed5…0366:12
renderUnknown details

Inspect func

sourceNote

func(src v0.source) string
Open
OID
058ed5…0366:13
sourceNote details

Inspect func

scheduleFromQuery

func(req *v0.Request) (v0.Schedule, string)

scheduleFromQuery reads a one-off schedule out of the URL. It returns a human-readable reason rather than an error value, because every caller turns it straight into page text.

Open
OID
058ed5…0366:15
scheduleFromQuery details

Inspect func

lockedCapped

func(s v0.Schedule, balance int64, n int64) int64

lockedCapped is what the account cannot move, which is never more than it holds. The schedule alone can say otherwise once coins have been spent.

Open
OID
058ed5…0366:17
lockedCapped details

Inspect func

tstamp

func(sec int64) string

tstamp renders a unix second as a plain UTC date, which is all a two-year term needs. gno has no time formatting worth the dependency here.

Open
OID
058ed5…0366:18
tstamp details

Inspect func

civil

func(z int64) (year int64, month int64, day int64)

civil converts a day count since 1970-01-01 to a calendar date, by Howard Hinnant's civil\_from\_days. Integer only, no time package, no locale.

Open
OID
058ed5…0366:19
civil details

Inspect func

ufmtDate

func(y int64, m int64, d int64) string
Open
OID
058ed5…0366:20
ufmtDate details

Inspect func

Path

untyped string

Value

"gno.land/r/nym-moultest123/vesting/v0"

Denom

untyped string

Value

"ugnot"

seeded

[]struct{...} (len=2)

seeded are the schedules this realm ships with, restored by init() after every redeploy. They are source constants and not registry rows on purpose: the realm is private = true, so a redeploy wipes realm state, and the one schedule the page exists to show should not need a transaction to come back. Each is copied from the genesis allocation sheet that built mainnet, which is the public, pinned input named in misc/deployments/mainnet.gno.land/gen-genesis.sh. An address is seeded here only when its LABEL is public too. The addresses are all on chain, but naming one is a claim about who holds it, and this realm is public and permanent. gen-genesis.sh names the investors-vesting multisig outright, so that one ships; the treasuries and the other buckets are identified nowhere public, so they do not, and the URL form serves anyone who wants to check them anyway.

Open
OID
058ed5…0366:23
seeded details (len=2)

+2 more Inspect slice

declared

v0.Tree

declared maps an address to the schedule that address declared for itself. Seeded schedules are NOT in here: they are read from the seeded slice, which is what lets the index render them in full while paging everything else. Anyone may Declare, so this tree is unbounded and the page that shows it cannot be.

Open
OID
058ed5…0366:49
declared details

Inspect ref

seedIndex

v0.Tree

seedIndex resolves a seeded address without walking the slice twice.

Open
OID
058ed5…0366:50
seedIndex details

Inspect ref

entry

type

entry is one row of the registry.

Value

v0.entry

reset

func()

reset restores the registry to exactly what the source declares. init() is its only caller on chain; a test calls it to render a page that does not depend on what the test before it wrote, since an Example runs after every Test in the package and sees the state they left.

Open
OID
058ed5…0366:32
reset details

Inspect func

Declare

func(original int64, start int64, end int64, delayed bool)

Declare records the caller's own vesting schedule, replacing any previous one. It cannot write a row for anybody else, which is what keeps the registry honest without the realm being able to verify a thing. Pass original = 0 to declare that the address has no schedule at all.

Open
OID
058ed5…0366:33
Declare details

Inspect func

Forget

func()

Forget removes the caller's own declaration.

Open
OID
058ed5…0366:34
Forget details

Inspect func

Count

func() int

Count returns how many schedules addresses have declared for themselves. Seeded schedules are not included; SeededCount reports those.

Open
OID
058ed5…0366:35
Count details

Inspect func

SeededCount

func() int

SeededCount returns how many schedules this realm ships in its source.

Open
OID
058ed5…0366:36
SeededCount details

Inspect func

ScheduleOf

func(addr .uverse.address) (original int64, start int64, end int64, delayed bool, ok bool)

ScheduleOf returns the declared schedule for addr, and whether there is one.

Open
OID
058ed5…0366:37
ScheduleOf details

Inspect func

SpendableOf

func(addr .uverse.address) (spendable int64, ok bool)

SpendableOf returns what addr can move right now, and whether the answer rests on a declared schedule. With ok false the figure is the whole balance, which is correct only if the address really has no schedule.

Open
OID
058ed5…0366:38
SpendableOf details

Inspect func

LockedOf

func(addr .uverse.address) (locked int64, ok bool)

LockedOf returns what addr cannot move right now, and whether the answer rests on a declared schedule.

Open
OID
058ed5…0366:39
LockedOf details

Inspect func

lookup

func(addr .uverse.address) (*v0.entry, bool)

lookup reads a row, seeded first so a seeded address can never be shadowed. avl's Get returns ONE value and nil for a miss, unlike Remove which returns two; that asymmetry is a documented gno-vs-Go trap.

Open
OID
058ed5…0366:40
lookup details

Inspect func

balanceOf

func(addr .uverse.address) int64

balanceOf reads the address's TOTAL ugnot, locked included. That is what banker.GetCoins reports and the only balance figure a realm can obtain. A readonly banker takes no realm, so this works from inside Render.

Open
OID
058ed5…0366:41
balanceOf details

Inspect func

gnot

func(u int64) string

gnot renders a ugnot amount as GNOT with six decimals and no float.

Open
OID
058ed5…0366:42
gnot details

Inspect func

pad6

func(n int64) string

pad6 left-pads to six digits. ufmt has no width flags, so this is by hand.

Open
OID
058ed5…0366:43
pad6 details

Inspect func

permille

func(p int64) string

permille renders tenths of a percent as a percentage with one decimal.

Open
OID
058ed5…0366:44
permille details

Inspect func

duration

func(sec int64) string

duration renders a span of seconds as days and hours, which is the only resolution worth reading on a two-year schedule.

Open
OID
058ed5…0366:45
duration details

Inspect func

isAddr

func(s string) bool

isAddr is a cheap shape check, so a typo renders as "not an address" rather than as an account with a zero balance.

Open
OID
058ed5…0366:46
isAddr details

Inspect func

now

func() int64

now is the chain's own clock, in unix seconds. time.Now() in a realm returns the BLOCK time, not a wall clock, which is exactly the value the ante handler compares a vesting schedule against.

Open
OID
058ed5…0366:47
now details

Inspect func
Render : func(path string) string Inspect
source : type =v0.source
sourceSeeded : v0.source =<zero>
sourceDeclared : v0.source =<zero>
sourceQuery : v0.source =<zero>
sourceNone : v0.source =<zero>
header : func() string Inspect
pageSize : untyped bigint =(25 <untyped> bigint)
renderIndex : func() string Inspect
curPage : int =1
pageOffset : func(page int) int Inspect
rowFor : func(addr .uverse.address, e *v0.entry) []string Inspect
pager : func(total int) string Inspect
renderAccount : func(addr .uverse.address, s v0.Schedule, src v0.source, label string) string Inspect
renderUnknown : func(addr .uverse.address) string Inspect
sourceNote : func(src v0.source) string Inspect
lookupForm : func() string Inspect
scheduleFromQuery : func(req *v0.Request) (v0.Schedule, string) Inspect
orZero : func(s string) string Inspect
lockedCapped : func(s v0.Schedule, balance int64, n int64) int64 Inspect
tstamp : func(sec int64) string Inspect
civil : func(z int64) (year int64, month int64, day int64) Inspect
ufmtDate : func(y int64, m int64, d int64) string Inspect
pad2 : func(n int64) string Inspect
Path : untyped string ="gno.land/r/nym-moultest123/vesting/v0"
Denom : untyped string ="ugnot"
seeded : []struct{...} (len=2) Inspect
declared : v0.Tree Inspect
seedIndex : v0.Tree Inspect
entry : type =v0.entry
init.31 : func() Inspect
reset : func() Inspect
Declare : func(original int64, start int64, end int64, delayed bool) Inspect
Forget : func() Inspect
Count : func() int Inspect
SeededCount : func() int Inspect
ScheduleOf : func(addr .uverse.address) (original int64, start int64, end int64, delayed bool, ok bool) Inspect
SpendableOf : func(addr .uverse.address) (spendable int64, ok bool) Inspect
LockedOf : func(addr .uverse.address) (locked int64, ok bool) Inspect
lookup : func(addr .uverse.address) (*v0.entry, bool) Inspect
balanceOf : func(addr .uverse.address) int64 Inspect
gnot : func(u int64) string Inspect
pad6 : func(n int64) string Inspect
permille : func(p int64) string Inspect
duration : func(sec int64) string Inspect
isAddr : func(s string) bool Inspect
now : func() int64 Inspect
chainHeight : func() int64 Inspect