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.

render_example_test.gno

2.04 Kb · 46 lines
 1package vesting
 2
 3// ExampleRender pins the index.
 4//
 5// reset() first, deliberately: an Example runs AFTER every Test in the package
 6// and sees the rows they declared, so without it this output depends on test
 7// order. The block time inside a gno test is fixed at 2009-02-13, before the
 8// real mainnet term starts, so the seeded rows render at 0% vested with the
 9// whole grant locked. That is a legitimate point on the curve and a stable one.
10//
11// With no declarations there is no Declared section and no pager, which is the
12// shape the page has on a fresh deploy.
13func ExampleRender() {
14	reset()
15	print(Render(""))
16	// Output:
17	// # Vesting
18	//
19	// How much of an account's balance can actually move right now.
20	//
21	// | account | balance | spendable | locked | vested |
22	// | --- | --- | --- | --- | --- |
23	// | moul `g1manfre…dlf5` | 0.000000 GNOT | 0.000000 GNOT | 0.000000 GNOT | 0.0% |
24	// | investors\-vesting multisig `g1x7tm26…gax3` | 0.000000 GNOT | 0.000000 GNOT | 0.000000 GNOT | 0.0% |
25	//
26	// ## Check another address
27	//
28	// Append it to the path: `/r/nym-moultest123/vesting/v0:g1…`
29	//
30	// | | |
31	// |---|---|
32	// | put your own schedule on file | [Declare](/r/nym-moultest123/vesting/v0$help&func=Declare&delayed=false&end=&original=&start=) |
33	// | take it off again | [Forget](/r/nym-moultest123/vesting/v0$help&func=Forget) |
34	//
35	// ## What is real here, and what is not
36	//
37	// | figure | where it comes from |
38	// |---|---|
39	// | balance | read from the chain every render, `banker.GetCoins` |
40	// | the clock | read from the chain every render, the block time |
41	// | the schedule | **supplied**, because no realm can read one |
42	//
43	// A realm's whole view of an account is its TOTAL balance, locked coins included. `std.VestingSchedule` lives in the auth store and no native reaches it, so the curve has to be told to this realm rather than found.
44	//
45	// That is safe to cache because a schedule can never change: it is set once, at genesis, and no message type creates or modifies one. A schedule declared correctly today is correct forever.
46}