Snowman Merkle Airdrop

First Flight #42
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

[L-5] No checks for amount value in `Snow::buySnow()` can allow for 0 amount purchases

[L-5] No checks for amount value in Snow::buySnow() can allow for 0 amount purchases

Description

  • In the Snow::buySnow() function, the amount variable determines the amount of Snow tokens to buy

  • There are no checks for checking if the amount is a valid value

function buySnow(uint256 amount) external payable canFarmSnow {
if (msg.value == (s_buyFee * amount)) {
_mint(msg.sender, amount);

Risk

Likelihood:

  • Whenever buySnow() is called with 0 amount

Impact:

  • Invalid event emitted

Proof of Concept

Add the following test case to the test suite

function testCanBuySnowWithZeroAmount() public {
vm.prank(victory);
snow.buySnow(0);
}

Recommended Mitigation

Add this check at the beginning of buySnow() to revert if amount is 0

+ assert(amount != 0);
Updates

Lead Judging Commences

yeahchibyke Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.