1package govdao
2
3import (
4 "std"
5
6 pproposal "gno.land/p/gov/proposal"
7)
8
9const daoPkgPath = "gno.land/r/gov/dao"
10
11const (
12 errNoChangesProposed = "no set changes proposed"
13 errNotGovDAO = "caller not govdao executor"
14)
15
16func NewPropExecutor(changesFn func() []std.Address) pproposal.Executor {
17 if changesFn == nil {
18 panic(errNoChangesProposed)
19 }
20
21 callback := func() error {
22 // Make sure the GovDAO executor runs the valset changes
23 assertGovDAOCaller()
24
25 for _, addr := range changesFn() {
26 members = append(members, addr)
27 }
28
29 return nil
30 }
31
32 return pproposal.NewExecutor(callback)
33}
34
35// assertGovDAOCaller verifies the caller is the GovDAO executor
36func assertGovDAOCaller() {
37 if std.CurrentRealm().PkgPath() != daoPkgPath {
38 panic(errNotGovDAO)
39 }
40}
memberset.gno
0.76 Kb ยท 40 lines