Description:Description\
LM_PC_Staking_v1::_distributeRewards doesn't need to call _earned because it's already called in _update, which is executed every time before _distributeRewards.
Attack Scenario\
_earned is called inside _distributeRewards. However, _update is always called before _distributeRewards to update the user rewards, which already includes a call to _earned. This makes uint amount = _earned(recipient, rewardValue) unnecessary.
It can be replaced with a simple rewards[recipient] assignment, avoiding extra calculations and saving gas.
Github username: @0x3b33 Twitter username: 0x3b33 Submission hash (on-chain): 0x48fb8d98a4276fd7339582a5c13a1a83e44d9a655cc98c7620e41aac43e3c645 Severity: gas saving
Description: Description\ LM_PC_Staking_v1::_distributeRewards doesn't need to call
_earned
because it's already called in_update
, which is executed every time before_distributeRewards
.Attack Scenario\
_earned
is called inside_distributeRewards
. However,_update
is always called before_distributeRewards
to update the user rewards, which already includes a call to_earned
. This makesuint amount = _earned(recipient, rewardValue)
unnecessary.It can be replaced with a simple
rewards[recipient]
assignment, avoiding extra calculations and saving gas.Revised Code File