render_example_test.gno
5.67 Kb · 131 lines
1package grant
2
3// ExampleRender pins the board as it is at deploy: one member, no requests,
4// an empty treasury. That IS the shipped state, since nothing is seeded here.
5// For a board mid-flight, with ballots, refused proofs and a paid tranche,
6// see the pinned pages in p/moul/grants/v0's render_test.gno; the markdown is
7// generated by the same Renderer.
8//
9// It calls reset() first: realm globals persist for the whole test binary and
10// examples run after every Test. The treasury BALANCE is not a realm global
11// and reset() cannot clear it, so the tests are written to be balance-neutral
12// (TestApplyApproveProveGetPaid pays out exactly what it funds). A test that
13// issues coins and does not spend them shows up as a diff here, which is the
14// point.
15func ExampleRender() {
16 reset()
17 print(Render(""))
18 // Output:
19 // # moul's grant board
20 //
21 // A small, personal grant board. moul funds it out of his own pocket, and it
22 // exists mainly so the coding agents working on his repos, and the people he
23 // already works with, can ask for money against work they can prove they did: a
24 // request, a milestone, a link to the merged PR, a tranche. It is open to anyone.
25 // Nothing here is privileged to a bot.
26 //
27 // **This is not a faucet and it is not an official grant program.** It is one
28 // person's money, sent by hand, mostly to people he already knows, and it is also
29 // a proof of concept for the library underneath. There is no entitlement, no queue
30 // and no service level: a request can sit here unanswered, or be refused with one
31 // line of reasoning and nothing further. An official programme, where anyone asks
32 // for tokens and a DAO decides, is a separate thing that does not exist yet, and
33 // this page deliberately does not name a path for it: naming one would read as a
34 // commitment nobody has made.
35 //
36 // **One member, and the page says so.** A majority of a one-member board is one
37 // signature, so today this is moul deciding in public rather than a DAO deciding.
38 // What makes it worth reading is the record: every ballot carries its reason,
39 // every proof stays up including the refused ones, and every coin out is on the
40 // ledger. A bigger multi-member program is a separate thing and will live at its
41 // own path.
42 //
43 // **You can ask for someone else.** `ApplyFor` takes the address the money goes
44 // to and a reason for the detour, and prints both on the request. That is not a
45 // convenience: an account with nothing in it cannot pay the gas to ask for its
46 // first coins, so on a board meant to fund empty accounts, someone else filing is
47 // the only path that works. Either address may then submit the proofs, and neither
48 // may vote on the request.
49 //
50 // **For agents.** A gno.land account session scoped to this path lets an agent
51 // `Apply` and `SubmitProof` under its own address, so its track record here is
52 // its own and not its operator's. A session cannot be given a board seat by
53 // scoping alone: voting is membership, and membership is a request the board
54 // decides.
55 //
56 // ## Treasury
57 //
58 // | Field | Value |
59 // |---|---|
60 // | Address | `g1uah596w03ufkslrjfg8erxszvjq3zra6avs37n` |
61 // | Balance | 0 ugnot |
62 // | Promised | 0 ugnot |
63 // | Unpromised | 0 ugnot |
64 // | Donated | 0 ugnot |
65 // | Paid out | 0 ugnot |
66 //
67 // ## Board
68 //
69 // A decision needs a majority of the members eligible to cast a ballot on it,
70 // recomputed every time: the party a decision is about never votes on it, so an
71 // applicant who sits on the board shrinks the room rather than packing it.
72 //
73 // | Member | Joined at height |
74 // |---|---|
75 // | `g1manfred47kzduec920z88wfr64ylksmdcedlf5` | 0 |
76 //
77 // ## Requests
78 //
79 // Nothing has been asked of this board yet. `Apply` is open to anyone.
80 //
81 // ## Where the money went
82 //
83 // [The ledger](/r/moul/grant/v0:ledger) lists every donation in and every tranche
84 // out, with the height, the payee and the milestone it paid for.
85 //
86 // ## Calling it
87 //
88 // ```sh
89 // # put money in
90 // gnokey maketx call -pkgpath gno.land/r/moul/grant/v0 -func Fund -send 5000000ugnot ...
91 // # ask for some
92 // gnokey maketx call -pkgpath gno.land/r/moul/grant/v0 -func Apply \
93 // -args 'Port the thing' -args 'why it matters' -args 'design:100,ship:400' ...
94 // # ask on behalf of someone who cannot pay the gas to ask
95 // gnokey maketx call -pkgpath gno.land/r/moul/grant/v0 -func ApplyFor \
96 // -args g1... -args 'their account is empty' \
97 // -args 'Port the thing' -args 'why it matters' -args 'design:100,ship:400' ...
98 // # decide (members only)
99 // gnokey maketx call -pkgpath gno.land/r/moul/grant/v0 -func Vote -args 1 -args true -args 'reason' ...
100 // # show your work, then get paid for it
101 // gnokey maketx call -pkgpath gno.land/r/moul/grant/v0 -func SubmitProof \
102 // -args 1 -args 0 -args url -args 'https://...' -args 'what it is' ...
103 // gnokey maketx call -pkgpath gno.land/r/moul/grant/v0 -func Review -args 1 -args 0 -args true -args 'looks done' ...
104 // ```
105 //
106 // Built on [p/moul/grants/v0](/p/moul/grants/v0), which holds every rule, every
107 // tally and this page's markdown, and has no idea coins exist.
108}
109
110// ExampleRenderLedger pins the money trail of a board nobody has funded yet.
111func ExampleRenderLedger() {
112 reset()
113 print(Render("ledger"))
114 // Output:
115 // # moul's grant board: the ledger
116 //
117 // Every coin in and every coin out, in the order it happened. Coins sent
118 // straight to `g1uah596w03ufkslrjfg8erxszvjq3zra6avs37n` land in the treasury
119 // without appearing here, which is why `Fund` exists: it is the same transfer
120 // with a name attached.
121 //
122 // ## In
123 //
124 // Nothing donated through `Fund` yet.
125 //
126 // ## Out
127 //
128 // No tranche has been released yet.
129 //
130 // Balance now: 0 ugnot. [Back to the board](/r/moul/grant/v0).
131}