Skip to content

Commit

Permalink
Dust rounding on claimReward
Browse files Browse the repository at this point in the history
  • Loading branch information
wildmolasses authored Apr 10, 2024
1 parent de35d2d commit c8a2d84
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/UniStaker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,9 @@ contract UniStaker is INotifiableRewardReceiver, Multicall, EIP712, Nonces {

uint256 _reward = scaledUnclaimedRewardCheckpoint[_beneficiary] / SCALE_FACTOR;
if (_reward == 0) return;
scaledUnclaimedRewardCheckpoint[_beneficiary] = 0;
// retain sub-wei dust that would be left due to the precision loss
scaledUnclaimedRewardCheckpoint[_beneficiary] =
scaledUnclaimedRewardCheckpoint[_beneficiary] - (_reward * SCALE_FACTOR);
emit RewardClaimed(_beneficiary, _reward);

SafeERC20.safeTransfer(REWARD_TOKEN, _beneficiary, _reward);
Expand Down

0 comments on commit c8a2d84

Please sign in to comment.