Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

render_example_test.gno

1.78 Kb · 42 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 row renders at 0% vested with the
 9// whole grant locked. That is a legitimate point on the curve and a stable one.
10func ExampleRender() {
11	reset()
12	print(Render(""))
13	// Output:
14	// # Vesting
15	//
16	// How much of an account's balance can actually move right now.
17	//
18	// | account | balance | spendable | locked | vested |
19	// | --- | --- | --- | --- | --- |
20	// | moul `g1manfre…dlf5` | 0.000000 GNOT | 0.000000 GNOT | 0.000000 GNOT | 0.0% |
21	//
22	// ## Check another address
23	//
24	// Append it to the path: `/r/moul/vesting/v0:g1…`
25	//
26	// | | |
27	// |---|---|
28	// | put your own schedule on file | [Declare](/r/moul/vesting/v0$help&func=Declare&delayed=false&end=&original=&start=) |
29	// | take it off again | [Forget](/r/moul/vesting/v0$help&func=Forget) |
30	//
31	// ## What is real here, and what is not
32	//
33	// | figure | where it comes from |
34	// |---|---|
35	// | balance | read from the chain every render, `banker.GetCoins` |
36	// | the clock | read from the chain every render, the block time |
37	// | the schedule | **supplied**, because no realm can read one |
38	//
39	// 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.
40	//
41	// 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.
42}