Skip to content

Commit ab3ce43

Browse files
authored
Create governance.py
1 parent 7a63dd9 commit ab3ce43

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/governance.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Governance:
2+
def __init__(self):
3+
self.proposals = []
4+
self.votes = {}
5+
6+
def propose_change(self, proposal):
7+
self.proposals.append(proposal)
8+
self.votes[proposal] = []
9+
10+
def vote(self, proposal, voter, decision):
11+
if proposal in self.proposals:
12+
self.votes[proposal].append((voter, decision))
13+
14+
def tally_votes(self, proposal):
15+
if proposal in self.votes:
16+
return sum(1 for _, decision in self.votes[proposal] if decision)
17+
return 0

0 commit comments

Comments
 (0)