options.gno
4.40 Kb · 155 lines
1package commondao
2
3// TODO: List default DAO options somewhere to make devs aware of them
4var defaultOptions = Options{
5 AllowRender: true,
6 AllowChildren: true,
7 AllowVoting: true,
8 AllowExecution: true,
9}
10
11// Option configures DAO options within CommonDAO realm.
12type Option func(*Options)
13
14// Options configures DAO behavior within CommonDAO realm.
15// These options are only valid for the CommonDAO ream, dApps that
16// own a DAO can implement these features by themselves.
17type Options struct {
18 // AllowListing adds the DAO to the public list of realm DAOs.
19 AllowListing bool
20
21 // AllowRender enables support for rendering the DAO within the CommonDAO realm.
22 AllowRender bool
23
24 // AllowChildren enables hierarchical DAOs by allowing the creation of SubDAOs.
25 AllowChildren bool
26
27 // AllowVoting enables proposal voting support.
28 AllowVoting bool
29
30 // AllowExecution enables proposal execution support.
31 AllowExecution bool
32
33 // AllowMembersUpdate allows creating a proposal to update DAO members.
34 AllowMembersUpdate bool
35
36 // AllowTextProposals allows text-only, non-executable proposals.
37 AllowTextProposals bool
38
39 // AllowSubDAOProposals allows creating SubDAOs though proposals.
40 AllowSubDAOProposals bool
41
42 // AllowDissolutionProposals allows dissolving DAOs though proposals.
43 AllowDissolutionProposals bool
44}
45
46// SetAllowListing toggles DAO public listing support.
47func (o *Options) SetAllowListing(allow bool) {
48 o.AllowListing = allow
49}
50
51// SetAllowRender toggles DAO render support within the CommonDAO realm.
52func (o *Options) SetAllowRender(allow bool) {
53 o.AllowRender = allow
54}
55
56// SetAllowChildren toggles DAO support for SubDAOs.
57// Enabling child DAOs is necessary for hierarchical tree based DAOs.
58func (o *Options) SetAllowChildren(allow bool) {
59 o.AllowChildren = allow
60}
61
62// SetAllowVoting toggles proposal voting support though the CommonDAO realm.
63func (o *Options) SetAllowVoting(allow bool) {
64 o.AllowVoting = allow
65}
66
67// SetAllowExecution toggles proposal execution support though the CommonDAO realm.
68func (o *Options) SetAllowExecution(allow bool) {
69 o.AllowExecution = allow
70}
71
72// SetAllowMembersUpdate toggles support for DAO members update proposals.
73// This type of proposal allows adding or removing DAO members.
74func (o *Options) SetAllowMembersUpdate(allow bool) {
75 o.AllowMembersUpdate = allow
76}
77
78// SetAllowTextProposals toggles support generic text proposals.
79func (o *Options) SetAllowTextProposals(allow bool) {
80 o.AllowTextProposals = allow
81}
82
83// SetAllowSubDAOPorposals toggles support for SubDAO creation proposals.
84// SubDAOs can only be created when DAO children support is enabled.
85func (o *Options) SetAllowSubDAOPorposals(allow bool) {
86 o.AllowSubDAOProposals = allow
87}
88
89// SetAllowDissolutionProposals toggles support for DAO dissolution proposals.
90func (o *Options) SetAllowDissolutionProposals(allow bool) {
91 o.AllowDissolutionProposals = allow
92}
93
94// AllowListing configures DAO listing within CommonDAO realm.
95func AllowListing(allow bool) Option {
96 return func(o *Options) {
97 o.AllowListing = allow
98 }
99}
100
101// AllowRender configures DAO, proposals and votes rendering within CommonDAO.
102func AllowRender(allow bool) Option {
103 return func(o *Options) {
104 o.AllowRender = allow
105 }
106}
107
108// AllowChildren configures DAO support for SubDAOs.
109func AllowChildren(allow bool) Option {
110 return func(o *Options) {
111 o.AllowChildren = allow
112 }
113}
114
115// AllowVoting configures DAO support for voting through CommonDAO realm.
116func AllowVoting(allow bool) Option {
117 return func(o *Options) {
118 o.AllowVoting = allow
119 }
120}
121
122// AllowExecution configures DAO support for executing proposals through CommonDAO realm.
123func AllowExecution(allow bool) Option {
124 return func(o *Options) {
125 o.AllowExecution = allow
126 }
127}
128
129// AllowMembersUpdate configures support for DAO members update proposals.
130func AllowMembersUpdate(allow bool) Option {
131 return func(o *Options) {
132 o.AllowMembersUpdate = allow
133 }
134}
135
136// AllowTextProposals configures support generic text proposals.
137func AllowTextProposals(allow bool) Option {
138 return func(o *Options) {
139 o.AllowTextProposals = allow
140 }
141}
142
143// AllowSubDAOPorposals configures support for SubDAO creation proposals.
144func AllowSubDAOPorposals(allow bool) Option {
145 return func(o *Options) {
146 o.AllowSubDAOProposals = allow
147 }
148}
149
150// AllowDissolutionProposals configures support for DAO dissolution proposals.
151func AllowDissolutionProposals(allow bool) Option {
152 return func(o *Options) {
153 o.AllowDissolutionProposals = allow
154 }
155}