When user claims reward from the claim receipt, the contract will check if the user has unclaimed reward. However, the contract will also check if the user has claimed reward before. This double check is unnecessary and can be removed to save gas.
The vulnerability stems from the double check in the code. The line if (ud.unclaimedRewards == 0) revert NothingToClaim();
is meant to check if the user has unclaimed reward. However, this check is also performed in the line if (rewardAmount == 0) return (0, 0);
. This double check is unnecessary and can be removed to save gas.
Waste of gas
Manual Review
Consider removing the unnecessary double check if (rewardAmount == 0) return (0, 0);
.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.