init.gno
0.97 Kb ยท 37 lines
1package init
2
3import (
4 "std"
5
6 "gno.land/r/gov/dao"
7 "gno.land/r/gov/dao/v3/impl"
8 "gno.land/r/gov/dao/v3/memberstore"
9)
10
11func Init() {
12 // This is needed because state is saved between unit tests,
13 // and we want to avoid having real members used on tests
14 memberstore.Get().DeleteAll()
15 dao.UpdateImpl(cross, dao.UpdateRequest{
16 DAO: impl.NewGovDAO(),
17 AllowedDAOs: []string{"gno.land/r/gov/dao/v3/impl"},
18 })
19}
20
21func InitWithUsers(addrs ...std.Address) {
22 // This is needed because state is saved between unit tests,
23 // and we want to avoid having real members used on tests
24 memberstore.Get().DeleteAll()
25 memberstore.Get().SetTier(memberstore.T1)
26 for _, a := range addrs {
27 if !a.IsValid() {
28 panic("invalid address: " + a.String())
29 }
30 memberstore.Get().SetMember(memberstore.T1, a, &memberstore.Member{InvitationPoints: 3})
31 }
32
33 dao.UpdateImpl(cross, dao.UpdateRequest{
34 DAO: impl.NewGovDAO(),
35 AllowedDAOs: []string{"gno.land/r/gov/dao/v3/impl"},
36 })
37}