Skip to content

Commit

Permalink
Gas optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-CZ committed Oct 29, 2024
1 parent 30539b9 commit a085fdd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contracts/sfc/SFCLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,12 @@ contract SFCLib is SFCBase {

function _stashRewards(address delegator, uint256 toValidatorID) internal returns (bool) {
uint256 nonStashedReward = _newRewards(delegator, toValidatorID);
if (nonStashedReward == 0) {
return false;
}
stashedRewardsUntilEpoch[delegator][toValidatorID] = _highestPayableEpoch(toValidatorID);
_rewardsStash[delegator][toValidatorID] = _rewardsStash[delegator][toValidatorID] + nonStashedReward;
return nonStashedReward != 0;
return true;
}

function _claimRewards(address delegator, uint256 toValidatorID) internal returns (uint256) {
Expand Down

0 comments on commit a085fdd

Please sign in to comment.