daocond.gno
0.68 Kb ยท 29 lines
1package daocond
2
3// We made conditions stateless to avoid complexity of handling events like (member added, member removed, role assigned, role removed, etc.)
4// This model should work pretty good for small DAOs with few voters.
5// In future, we should probably add a stateful model for large DAOs with many voters.
6
7type Condition interface {
8 Eval(ballot Ballot) bool
9 Signal(ballot Ballot) float64
10
11 Render() string
12 RenderWithVotes(ballot Ballot) string
13}
14
15type Ballot interface {
16 Vote(voter string, vote Vote)
17 Get(voter string) Vote
18 Total() int
19
20 Iterate(fn func(voter string, vote Vote) bool)
21}
22
23type Vote string
24
25const (
26 VoteYes = "yes"
27 VoteNo = "no"
28 VoteAbstain = "abstain"
29)