Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_5_c_filetest.gno

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