-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUsers.py
More file actions
19 lines (17 loc) · 673 Bytes
/
Copy pathUsers.py
File metadata and controls
19 lines (17 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Participant:
def __init__(self, name, stake):
self.name = name
self.stake = stake
self.locked_stake = 0
self.delegate = None
self.eligible_for_delegate = False # Initialize as not eligible
def lock_stake_for_delegate(self, amount):
if self.stake >= amount:
self.locked_stake = amount
if self.locked_stake >= 50:
self.eligible_for_delegate = True # Become eligible for delegate
def vote_for_delegate(self, delegate):
delegate.votes += self.locked_stake
self.stake -= self.locked_stake
self.locked_stake = 0
self.delegate = delegate