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