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

Render

func(path string) string

Render serves three shapes: /r/moul/vesting/v0 the seeded schedules /r/moul/vesting/v0:g1... one address, its declared schedule /r/moul/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
0c3e14…4785: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>

renderAccount

func(addr .uverse.address, s v0.Schedule, src v0.source, label string) string
Open
OID
0c3e14…4785:7
renderAccount details

Inspect func

renderUnknown

func(addr .uverse.address) string
Open
OID
0c3e14…4785:8
renderUnknown details

Inspect func

sourceNote

func(src v0.source) string
Open
OID
0c3e14…4785:9
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
0c3e14…4785:11
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
0c3e14…4785:13
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
0c3e14…4785:14
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
0c3e14…4785:15
civil details

Inspect func

ufmtDate

func(y int64, m int64, d int64) string
Open
OID
0c3e14…4785:16
ufmtDate details

Inspect func

Path

untyped string

Value

"gno.land/r/moul/vesting/v0"

Denom

untyped string

Value

"ugnot"

seeded

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

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.

Open
OID
0c3e14…4785:19
seeded details (len=1)

+1 more Inspect slice

declared

v0.Tree

declared maps an address to the schedule that address declared for itself.

Open
OID
0c3e14…4785:41
declared 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
0c3e14…4785:25
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
0c3e14…4785:26
Declare details

Inspect func

Forget

func()

Forget removes the caller's own declaration.

Open
OID
0c3e14…4785:27
Forget details

Inspect func

Count

func() int

Count returns how many schedules the registry holds.

Open
OID
0c3e14…4785:28
Count 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
0c3e14…4785:29
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
0c3e14…4785:30
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
0c3e14…4785:31
LockedOf details

Inspect func

lookup

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

lookup reads a row. 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
0c3e14…4785:32
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
0c3e14…4785:33
balanceOf details

Inspect func

gnot

func(u int64) string

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

Open
OID
0c3e14…4785:34
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
0c3e14…4785:35
pad6 details

Inspect func

permille

func(p int64) string

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

Open
OID
0c3e14…4785:36
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
0c3e14…4785:37
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
0c3e14…4785:38
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
0c3e14…4785:39
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
renderIndex : func() 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/moul/vesting/v0"
Denom : untyped string ="ugnot"
seeded : []struct{...} (len=1) Inspect
declared : v0.Tree Inspect
entry : type =v0.entry
init.25 : func() Inspect
reset : func() Inspect
Declare : func(original int64, start int64, end int64, delayed bool) Inspect
Forget : func() Inspect
Count : 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