Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_commondao_execute_0_filetest.gno

0.90 Kb ยท 39 lines
 1// PKGPATH: gno.land/r/test
 2package test
 3
 4import (
 5	"time"
 6
 7	"gno.land/p/nt/commondao"
 8)
 9
10const member address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
11
12var (
13	dao      *commondao.CommonDAO
14	proposal *commondao.Proposal
15)
16
17type testPropDef struct{}
18
19func (testPropDef) Title() string                               { return "" }
20func (testPropDef) Body() string                                { return "" }
21func (testPropDef) VotingPeriod() time.Duration                 { return 0 }
22func (testPropDef) Execute(cur realm) error                     { return nil }
23func (testPropDef) Tally(commondao.VotingContext) (bool, error) { return true, nil }
24
25func init() {
26	dao = commondao.New(commondao.WithMember(member))
27	proposal = dao.MustPropose(member, testPropDef{})
28}
29
30func main() {
31	err := dao.Execute(proposal.ID())
32
33	println(err == nil)
34	println(string(proposal.Status()))
35}
36
37// Output:
38// true
39// executed