Skip to content

Commit

Permalink
fix: remove reetrancy lock in withdraw_fast
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Apr 22, 2024
1 parent 89a3d6b commit 60e1f44
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions contracts/dao/veANGLE.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @version 0.3.0
# @version 0.2.16
"""
@title Voting Escrow
@author Angle Protocol
Expand Down Expand Up @@ -184,7 +184,6 @@ def set_emergency_withdrawal():
self.emergency_withdrawal = True

@external
@nonreentrant('lock')
def withdraw_fast():
"""
@notice withdraw all tokens when in emergency states
Expand Down Expand Up @@ -571,18 +570,18 @@ def _find_user_timestamp_epoch(addr: address, ts: uint256) -> uint256:
@param ts Epoch time to find
@return User epoch number
"""
min_value: uint256 = 0
max_value: uint256 = self.user_point_epoch[addr]
minimum_value: uint256 = 0
maximum_value: uint256 = self.user_point_epoch[addr]

for i in range(128): # Will be always enough for 128-bit numbers
if min_value >= max_value:
if minimum_value >= maximum_value:
break
mid: uint256 = (min_value + max_value + 1) / 2
mid: uint256 = (minimum_value + maximum_value + 1) / 2
if self.user_point_history[addr][mid].ts <= ts:
min_value = mid
minimum_value = mid
else:
max_value = mid - 1
return min_value
maximum_value = mid - 1
return minimum_value

@external
@view
Expand Down

0 comments on commit 60e1f44

Please sign in to comment.