github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/r/demo/users/z_4_filetest.gno (about) 1 package main 2 3 // SEND: 2000000000ugnot 4 5 import ( 6 "std" 7 8 "gno.land/p/demo/testutils" 9 "gno.land/r/demo/users" 10 ) 11 12 const admin = std.Address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj") 13 14 func main() { 15 caller := std.GetOrigCaller() // main 16 users.Register("", "gnouser", "my profile") 17 // as admin, grant invites to gnouser 18 std.TestSetOrigCaller(admin) 19 users.GrantInvites(caller.String() + ":1") 20 // switch back to caller 21 std.TestSetOrigCaller(caller) 22 // invite another addr 23 test1 := testutils.TestAddress("test1") 24 test2 := testutils.TestAddress("test2") 25 users.Invite(test1.String()) 26 // switch to test2 (not test1) 27 std.TestSetOrigCaller(test2) 28 std.TestSetOrigSend(std.Coins{{"dontcare", 1}}, nil) 29 users.Register(caller, "satoshi", "my other profile") 30 println("done") 31 } 32 33 // Error: 34 // invalid invitation