Skip to content

Commit

Permalink
refactor: refactored getPendingRewards function
Browse files Browse the repository at this point in the history
  • Loading branch information
The-3D committed Feb 28, 2022
1 parent eeb78d7 commit 6e94a69
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions contracts/rewards/RewardsDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ abstract contract RewardsDistributor is IRewardsDistributor {
if (userAssetBalances[i].userBalance == 0) {
continue;
}
unclaimedAmounts[r] += _getUnrealizedRewardsFromStake(
unclaimedAmounts[r] += _getPendingRewards(
user,
rewardsList[r],
userAssetBalances[i]
Expand Down Expand Up @@ -406,21 +406,21 @@ abstract contract RewardsDistributor is IRewardsDistributor {
continue;
}
unclaimedRewards +=
_getUnrealizedRewardsFromStake(user, reward, userAssetBalances[i]) +
_getPendingRewards(user, reward, userAssetBalances[i]) +
_assets[userAssetBalances[i].asset].rewards[reward].usersData[user].accrued;
}

return unclaimedRewards;
}

/**
* @dev Return the unrealized amount of one reward from a user over a list of distribution
* @dev Calculates the pending (not yet accrued) rewards since the last user action
* @param user The address of the user
* @param reward The address of the reward token
* @param userAssetBalance struct with the user balance and total supply of the incentivized asset
* @return The unrealized rewards for the user until the moment
* @return The pending rewards for the user since the last user action
**/
function _getUnrealizedRewardsFromStake(
function _getPendingRewards(
address user,
address reward,
RewardsDataTypes.UserAssetBalance memory userAssetBalance
Expand Down

0 comments on commit 6e94a69

Please sign in to comment.