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 source realm

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

Readme View source

r/moul/vesting

How much of a gno.land account's balance can actually move right now.

Read this before trusting a number here

A realm cannot read an account's vesting schedule. banker.GetCoins returns the total balance with the locked part included, and no native exposes std.VestingSchedule. So the page reads two things from the chain and is told the third:

figure source trust
balance banker.GetCoins, every render always true
the clock the block time, every render always true
the schedule supplied, see below only as good as its source

Every rendered figure says which of the two it rests on. Nothing is presented as verified when it is not. That honesty is the feature: a page that quietly guessed the locked amount would be worse than no page.

Where a schedule comes from

The URL, for a one-off that stores nothing:

/r/moul/vesting/v0:g1youraddress?o=106560000000&s=1789225200&e=1852383600

o original vesting in ugnot, s start, e end, both unix seconds, &d=1 for a delayed schedule. Read your real one off the chain:

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

Or the registry. Declare writes a schedule for the caller's own address and no other. That is the whole trust model: an address can only misdescribe itself, and a wrong entry misleads nobody but its author. Forget takes it off again.

Why a cached schedule is honest rather than stale

Because a schedule 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 one. A schedule declared correctly today is correct forever.

Routes

/r/moul/vesting/v0 every schedule on file
…:g1… one address
…:g1…?o=&s=&e= one address, with a schedule you supply

Notes

The seeded schedules are source constants, not registry rows. This 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. A seeded address is refused by Declare for the same reason: a redeploy would silently revert whatever it set.

The arithmetic is p/moul/vesting, which mirrors what the chain enforces, down to the rounding direction.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/r/moul/vesting/v0 dependency graph

⚠️ Disclaimer: provided as-is, without warranty; not security-audited. Full disclaimer: DISCLAIMER.

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.

Constants 1

const Path, Link, Denom

1const (
2	// Path is this realm's package path.
3	Path = "gno.land/r/moul/vesting/v0"
4	// Link is Path as a gnoweb route.
5	Link = "/r/moul/vesting/v0"
6	// Denom is the only coin this realm reports on.
7	Denom = "ugnot"
8)
source

Functions 7

func Count

Action
1func Count() int
source

Count returns how many schedules the registry holds.

func Declare

crossing Action
1func Declare(cur realm, original, start, end int64, delayed bool)
source

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.

func Forget

crossing Action
1func Forget(cur realm)
source

Forget removes the caller's own declaration.

func LockedOf

Action
1func LockedOf(addr address) (locked int64, ok bool)
source

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

func Render

1func Render(path string) string
source

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.

func ScheduleOf

Action
1func ScheduleOf(addr address) (original, start, end int64, delayed, ok bool)
source

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

func SpendableOf

Action
1func SpendableOf(addr address) (spendable int64, ok bool)
source

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.

Imports 12

Source Files 6