Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_7_d_filetest.gno

0.85 Kb · 37 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)
13
14var parentID uint64
15
16func init() {
17	// Invite a user to be able to start creating DAOs
18	testing.SetRealm(testing.NewUserRealm(owner))
19	commondao.Invite(cross, user)
20
21	// The origin must be the invited user
22	testing.SetRealm(testing.NewUserRealm(user))
23
24	// Create the root DAO
25	testing.SetRealm(testing.NewCodeRealm("gno.land/r/nt/commondao/v0"))
26	parentDAO := commondao.New(cross, "Parent DAO", commondao.AllowChildren(false)) // Disallow SubDAOs
27	parentID = parentDAO.ID()
28}
29
30func main() {
31	testing.SetRealm(testing.NewCodeRealm("gno.land/r/nt/commondao/v0"))
32
33	commondao.NewSubDAO(cross, "Foo", parentID)
34}
35
36// Error:
37// SubDAO support is not enabled