Skip to content

Commit

Permalink
Merge pull request #105 from curvefi/fix/gauge-v3-claim-rewards
Browse files Browse the repository at this point in the history
Fix/gauge v3 claim rewards
  • Loading branch information
iamdefinitelyahuman authored Jun 9, 2021
2 parents 2a90657 + 406a120 commit bed289d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 7 additions & 7 deletions contracts/gauges/LiquidityGaugeV3.vy
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,16 @@ def _checkpoint_rewards( _user: address, _total_supply: uint256, _claim: bool, _

integral: uint256 = reward_integrals[i]
integral_for: uint256 = self.reward_integral_for[token][_user]
if integral_for < integral or _total_supply == 0:
new_claimable: uint256 = 0
if integral_for < integral:
self.reward_integral_for[token][_user] = integral
claim_data: uint256 = self.claim_data[_user][token]

new_claimable: uint256 = user_balance * (integral - integral_for) / 10**18
new_claimable = user_balance * (integral - integral_for) / 10**18

claim_data: uint256 = self.claim_data[_user][token]
total_claimable: uint256 = shift(claim_data, -128) + new_claimable
if total_claimable > 0:
total_claimed: uint256 = claim_data % 2**128
total_claimable: uint256 = shift(claim_data, -128) + new_claimable

if _claim and total_claimable > 0:
if _claim:
response: Bytes[32] = raw_call(
token,
concat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def test_transfer_does_not_trigger_claim_for_receiver(alice, bob, chain, gauge_v
gauge_v3.transfer(alice, amount, {"from": bob})

for acct in (alice, bob):
gauge_v3.claim_rewards({"from": acct})
assert coin_reward.balanceOf(acct) == 0


Expand Down

0 comments on commit bed289d

Please sign in to comment.