Skip to content

Commit

Permalink
chore: gas optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
romanagureev committed Aug 30, 2024
1 parent bdfc3f9 commit c9a08fa
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions contracts/implementations/ChildGauge.vy
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,12 @@ def recover_remaining_reward(_reward_id: uint256, _receiver: address=msg.sender)
"""
self._checkpoint_rewards(empty(address), self.totalSupply, False, empty(address))

reward_data: RewardData = self.reward_data[_reward_id]
assert msg.sender == reward_data.distributor
assert reward_data.remaining_time == 0, "Distribution in progress"
assert msg.sender == self.reward_data[_reward_id].distributor
assert self.reward_data[_reward_id].remaining_time == 0, "Distribution in progress"

remaining_amount: uint256 = self.reward_data[_reward_id].remaining_amount
self.reward_data[_reward_id].remaining_amount = 0
assert reward_data.token.transfer(_receiver, reward_data.remaining_amount, default_return_value=True)
assert self.reward_data[_reward_id].token.transfer(_receiver, remaining_amount, default_return_value=True)


@external
Expand Down Expand Up @@ -739,9 +739,8 @@ def lock_reward(_reward_id: uint256):
"""
self._checkpoint_rewards(empty(address), self.totalSupply, False, empty(address))

reward_data: RewardData = self.reward_data[_reward_id]
assert msg.sender == reward_data.distributor
assert reward_data.remaining_time > 0, "Nothing to lock"
assert msg.sender == self.reward_data[_reward_id].distributor
assert self.reward_data[_reward_id].remaining_time > 0, "Nothing to lock"

self.reward_data[_reward_id].locked = True

Expand Down

0 comments on commit c9a08fa

Please sign in to comment.