Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_3_b_filetest.gno

0.83 Kb · 36 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	"gno.land/r/nt/commondao/v0"
 7)
 8
 9const (
10	owner    = address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
11	user     = address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1
12	newRealm = address("g1vh7krmmzfua5xjmkatvmx09z37w34lsvd2mxa5")
13)
14
15var daoID uint64
16
17func init() {
18	// Invite a user to be able to start creating DAOs
19	testing.SetRealm(testing.NewUserRealm(owner))
20	commondao.Invite(cross, user)
21
22	// Create a new DAO which gives ownership to `test`
23	testing.SetRealm(testing.NewUserRealm(user))
24	testing.SetRealm(testing.NewCodeRealm("gno.land/r/demo/tests"))
25	daoID = commondao.New(cross, "Foo").ID()
26}
27
28func main() {
29	// Use a caller that is not the owner of the DAO
30	testing.SetRealm(testing.NewUserRealm(user))
31
32	commondao.TransferOwnership(cross, daoID, newRealm)
33}
34
35// Error:
36// unauthorized