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.

vesting/v0 package

Overview

Realm vesting answers one question for a gno.land account: of the coins it holds, how many can actually move right now.

Read this before you trust a number here

A realm CANNOT read an account's vesting schedule. The VM's whole view of an account is banker.GetCoins, which returns the TOTAL balance with the locked part included, and no native exposes std.VestingSchedule. So this realm reads two things from the chain and is told the third:

Example
1balance     read from the chain, banker.GetCoins   always true
2now         read from the chain, block time        always true
3schedule    supplied, see below                    only as good as its source

Every rendered figure says which of the two it rests on. Nothing here is presented as verified when it is not.

Where a schedule comes from

Either the query string, for a one-off calculation that stores nothing, or the registry. Declare writes a schedule for the CALLER'S OWN address and no other, which is the whole trust model: an address can only misdescribe itself, and a wrong entry misleads nobody but its author.

Anyone can read their real schedule in one command and declare it:

Example
1gnokey query auth/accounts/g1youraddress -remote https://rpc.gno.land:443

Why the schedule can be cached at all

Because it can never change. std.SetVesting has exactly one caller in the monorepo, gno.land/pkg/gnoland/app.go, during genesis balance loading, and no message type creates or modifies a schedule. A schedule declared once is correct forever, which is what makes a registry honest rather than stale.

Functions

Count

func Count() int
Ask AI Claude ChatGPT

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

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/vesting/v0.Count()"

Result

Declare

func Declare(cur realm, original, start, end int64, delayed bool)
Ask AI Claude ChatGPT

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.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/vesting/v0" -func "Declare" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/vesting/v0" -func "Declare" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

Forget

func Forget(cur realm)
Ask AI Claude ChatGPT

Forget removes the caller's own declaration.

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/vesting/v0" -func "Forget" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/vesting/v0" -func "Forget" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

LockedOf

func LockedOf(addr address) (locked int64, ok bool)
Ask AI Claude ChatGPT

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/vesting/v0.LockedOf()"

Result

Render

func Render(path string) string
Ask AI Claude ChatGPT

Render serves three shapes:

Example
1/r/moul/vesting/v0                     the seeded schedules
2/r/moul/vesting/v0:g1...               one address, its declared schedule
3/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.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/vesting/v0.Render()"

Result

ScheduleOf

func ScheduleOf(addr address) (original, start, end int64, delayed, ok bool)
Ask AI Claude ChatGPT

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/vesting/v0.ScheduleOf()"

Result

SeededCount

func SeededCount() int
Ask AI Claude ChatGPT

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

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/vesting/v0.SeededCount()"

Result

SpendableOf

func SpendableOf(addr address) (spendable int64, ok bool)
Ask AI Claude ChatGPT

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.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1magld5ptgzaktqcexxq0pgq5lmdf0kz6re8hlv/vesting/v0.SpendableOf()"

Result