Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_3_a_filetest.gno

0.95 Kb · 43 lines
 1package main
 2
 3import (
 4	"chain"
 5	"testing"
 6
 7	"gno.land/r/nt/commondao/v0"
 8)
 9
10const (
11	owner    = address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
12	user     = address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1
13	newRealm = address("g1vh7krmmzfua5xjmkatvmx09z37w34lsvd2mxa5")
14)
15
16var (
17	daoID     uint64
18	realmAddr = chain.PackageAddress("gno.land/r/test")
19)
20
21func init() {
22	// Invite a user to be able to start creating DAOs
23	testing.SetRealm(testing.NewUserRealm(owner))
24	commondao.Invite(cross, user)
25
26	// Create a new DAO which gives ownership to `test`
27	testing.SetRealm(testing.NewUserRealm(user))
28	testing.SetRealm(testing.NewCodeRealm("gno.land/r/test"))
29	daoID = commondao.New(cross, "Foo").ID()
30}
31
32func main() {
33	testing.SetRealm(testing.NewCodeRealm("gno.land/r/test"))
34
35	commondao.TransferOwnership(cross, daoID, newRealm)
36
37	println(commondao.IsOwner(realmAddr, daoID))
38	println(commondao.IsOwner(newRealm, daoID))
39}
40
41// Output:
42// false
43// true