The Snow::earnSnow function allows users to earn one free snow token per week. However, the current implementation restricts minting to only one user per week due to the use of a global s_earnTimer state variable. After the first user successfully calls earnSnow, the s_earnTimer is updated to the current block.timestamp, causing subsequent calls by other users to revert until one week has passed.
Likelihood: High. The issue occurs whenever multiple users attempt to call earnSnow within the same week.
Impact: High. Users are prevented from earnign their intended free snow token, which could lead to user dissatisfaction and reduced engagement. Additionally, front runners can monitor the Snow::earnSnow event and call the function as soon as the one-week restriction expires, potentially monopolizing token minting.
Add the following test to test/TestSnow.t.sol to confirm that only one user can earn a snow token per week.
To allow each user to earn a free snow token independently, track the timer per user using a mapping. The following diff shows the required changes:
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.