Skip to content

Commit

Permalink
refactor(contracts): ensure cancel_stream reverts when empty/claimed
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Sep 6, 2024
1 parent 56b2e7b commit ce90246
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions contracts/StreamManager.vy
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def cancel_stream(

funded_amount: uint256 = self.streams[creator][stream_id].funded_amount
amount_locked: uint256 = funded_amount - self._amount_unlocked(creator, stream_id)
assert amount_locked > 0 # NOTE: reverts if stream doesn't exist, or already cancelled
self.streams[creator][stream_id].funded_amount = funded_amount - amount_locked

token: ERC20 = self.streams[creator][stream_id].token
Expand Down

0 comments on commit ce90246

Please sign in to comment.