Skip to content

Commit

Permalink
Votes can only be undone by the user and management
Browse files Browse the repository at this point in the history
  • Loading branch information
0xkorin committed Jun 7, 2023
1 parent 2103882 commit 0dd2b19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions contracts/Bootstrap.vy
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ def undo_vote(_protocol: address, _account: address = msg.sender) -> uint256:
"""
assert block.timestamp >= self.vote_begin and block.timestamp < self.vote_end # dev: outside vote period
assert self.applications[_protocol] != WHITELISTED
assert _account == msg.sender or msg.sender == self.management
votes: uint256 = self.votes_used_protocol[_account][_protocol]
assert votes > 0
self.voted -= votes
Expand Down
4 changes: 2 additions & 2 deletions tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,10 @@ def test_undo_vote(project, chain, deployer, alice, bob, bootstrap):
bootstrap.vote([protocol], [ONE], sender=alice)

with ape.reverts():
bootstrap.undo_vote(protocol, alice, sender=bob)
bootstrap.undo_vote(protocol, alice, sender=deployer)

bootstrap.undo_whitelist(protocol, sender=deployer)
bootstrap.undo_vote(protocol, alice, sender=bob)
bootstrap.undo_vote(protocol, alice, sender=deployer)
assert bootstrap.voted() == 0
assert bootstrap.votes_used(alice) == 0
assert bootstrap.votes_used_protocol(alice, protocol) == 0
Expand Down

0 comments on commit 0dd2b19

Please sign in to comment.