Skip to content

Commit

Permalink
Merge pull request #3 from shuklaayush/patch-1
Browse files Browse the repository at this point in the history
Rename variable for consistency
  • Loading branch information
GalloDaSballo authored Jun 3, 2022
2 parents 3fe5f58 + 348a9a0 commit 64a04a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contracts/RewardsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -513,18 +513,18 @@ contract RewardsManager is ReentrancyGuard {
return;
}

uint256 timeInEpochSinceLastAccrue = getUserTimeLeftToAccrue(epochId, vault, user);
uint256 timeLeftToAccrue = getUserTimeLeftToAccrue(epochId, vault, user);

// Optimization: time is 0, end early
if(timeInEpochSinceLastAccrue == 0){
if(timeLeftToAccrue == 0){
// No time can happen if accrue happened on same block or if we're accruing after the end of the epoch
// As such we still update the timestamp for historical purposes
lastUserAccrueTimestamp[epochId][vault][user] = block.timestamp; // This is effectively 5k more gas to know the last accrue time even after it lost relevance
return;
}

// Run the math and update the system
uint256 newPoints = currentBalance * timeInEpochSinceLastAccrue;
uint256 newPoints = timeLeftToAccrue * currentBalance;

// Track user rewards
points[epochId][vault][user] += newPoints;
Expand Down

0 comments on commit 64a04a7

Please sign in to comment.