Description
The buySnow function in the Snow contract contains a logic that calculates the required payment based on the s_buyFee and the amount of tokens to be purchased. However, the current implementation only accepts integer values for the amount, which can lead to issues when users attempt to buy fractional amounts of tokens. This limitation can result in failed transactions or unexpected behavior when users try to purchase non-integer quantities of Snow tokens.
Impact
Users may be unable to purchase fractional amounts of Snow tokens, leading to a poor user experience and potential loss of sales.
Proof of Concepts
and this leads to logical errors that cannot accept this Operation
Recommended mitigation
I recommend updating the buySnow function to handle fractional amounts correctly
by also updating the s_buyFee calculation to accommodate decimal values by setting precision using a scaling factor (e.g., multiplying by 10^18) to ensure accurate calculations for fractional token purchases.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.