1package main
2
3import (
4 "std"
5
6 "gno.land/p/demo/testutils"
7 "gno.land/r/gnoland/faucet"
8)
9
10// mints coints to current realm
11func init() {
12 facuetaddr := std.DerivePkgAddr("gno.land/r/gnoland/faucet")
13 std.TestIssueCoins(facuetaddr, std.Coins{{"ugnot", 200000000}})
14}
15
16// assert render with 2 controllers and 2 transfers
17func main() {
18 var (
19 adminaddr = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5")
20 controlleraddr1 = testutils.TestAddress("controller1")
21 controlleraddr2 = testutils.TestAddress("controller2")
22 testaddr1 = testutils.TestAddress("test1")
23 testaddr2 = testutils.TestAddress("test2")
24 )
25 std.TestSetOrigCaller(adminaddr)
26 err := faucet.AdminAddController(controlleraddr1)
27 if err != "" {
28 panic(err)
29 }
30 err = faucet.AdminAddController(controlleraddr2)
31 if err != "" {
32 panic(err)
33 }
34 std.TestSetOrigCaller(controlleraddr1)
35 err = faucet.Transfer(testaddr1, 1000000)
36 if err != "" {
37 panic(err)
38 }
39 std.TestSetOrigCaller(controlleraddr2)
40 err = faucet.Transfer(testaddr1, 2000000)
41 if err != "" {
42 panic(err)
43 }
44 println(faucet.Render(""))
45}
46
47// Output:
48// # Community Faucet.
49//
50// Status: active.
51// Balance: 197000000ugnot.
52// Total transfers: 3000000ugnot (in 2 times).
53//
54// Package address: g1ttrq7mp4zy6dssnmgyyktnn4hcj3ys8xhju0n7
55//
56// Admin: g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5
57//
58// Controllers:
59//
60// g1vdhkuarjdakxcetjx9047h6lta047h6lsdacav g1vdhkuarjdakxcetjxf047h6lta047h6lnrev3v
61//
62// Per request limit: 350000000ugnot
z3_filetest.gno
1.46 Kb ยท 62 lines