loader.gno
1.59 Kb · 40 lines
1// loader.gno initialises the govDAO v3 implementation and tier structure.
2//
3// It intentionally does NOT add any members or set AllowedDAOs. When the
4// allowedDAOs list in the DAO proxy is empty, InAllowedDAOs() returns true
5// for any caller (see r/gov/dao/proxy.gno), which lets a subsequent MsgRun
6// bootstrap the member set and then lock things down.
7//
8// Bootstrap flow (official network genesis or local dev):
9//
10// 1. All packages — including this loader — are deployed via MsgAddPackage.
11// The loader sets up tier entries and the DAO implementation.
12// 2. A MsgRun executes a setup script (e.g. govdao_prop1.gno) which:
13// a. Adds a temporary deployer as T1 member (for supermajority).
14// b. Creates a governance proposal to register validators, votes YES,
15// and executes it.
16// c. Adds the real govDAO members directly via memberstore.Get().
17// d. Removes the temporary deployer.
18// e. Calls dao.UpdateImpl to set AllowedDAOs, locking down access.
19//
20// See misc/deployments/ for concrete genesis generation examples.
21package loader
22
23import (
24 "gno.land/r/gov/dao"
25 "gno.land/r/gov/dao/v3/impl"
26 "gno.land/r/gov/dao/v3/memberstore"
27)
28
29func init() {
30 // Create tier entries in the members tree (required before any SetMember).
31 memberstore.Get().SetTier(memberstore.T1)
32 memberstore.Get().SetTier(memberstore.T2)
33 memberstore.Get().SetTier(memberstore.T3)
34
35 // Set the DAO implementation. AllowedDAOs is intentionally left empty
36 // so that the genesis MsgRun can manipulate the memberstore directly.
37 dao.UpdateImpl(cross, dao.UpdateRequest{
38 DAO: impl.GetInstance(),
39 })
40}