Skip to content

Commit

Permalink
Actually skip storage changes if already updated in same block
Browse files Browse the repository at this point in the history
  • Loading branch information
alcueca committed Jun 25, 2024
1 parent b9349f3 commit fa16a77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/SimpleRewards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ contract SimpleRewards {
UserRewards memory userRewards_ = accumulatedRewards[user];

// We skip the storage changes if already updated in the same block
if (userRewards_.checkpoint == rewardsPerToken_.lastUpdated) return userRewards_;
if (userRewards_.checkpoint == rewardsPerToken_.accumulated) return userRewards_;

// Calculate and update the new value user reserves.
userRewards_.accumulated += _calculateUserRewards(userStake[user], userRewards_.checkpoint, rewardsPerToken_.accumulated).u128();
Expand Down

0 comments on commit fa16a77

Please sign in to comment.