https://github.com/Cyfrin/2024-09-mystery-box/blob/main/src/MysteryBox.sol#L76
https://github.com/Cyfrin/2024-09-mystery-box/blob/main/src/MysteryBox.sol#L100
In the MysteryBox::transferReward
and MysteryBox::claimSingleReward
functions, the line delete rewardsOwned[msg.sender][_index];
doesn't actually remove the reward at the given index; instead, it resets the reward to default values (a reward with an empty name and a value of 0). If a user has multiple rewards and claims the first one, they might expect the remaining rewards to shift to the beginning of the array.
Users may be confused when the rewards don’t automatically shift after one is claimed or transferred.
Implement a delete function that shifts elements and uses pop
(after the shift) to remove the reward from the array.
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.