protocol / nft-website

NFT School: Community education platform for developers in the non-fungible token space.
https://nftschool.dev
MIT License
360 stars 98 forks source link

[PAGE ISSUE] Lazy minting - msg.value is denominated in WEI #218

Open morozj01 opened 2 years ago

morozj01 commented 2 years ago

Noticed a mismatched in the expected unit values between the voucher.minPrice and msg.value -

voucher.minPrice is implied to be in ETH - so values like .5, 1, 10 (generally single or double digit) are assumed to be ok.

msg.value is in WEI so require(msg.value >= voucher.minPrice, "Insufficient funds to redeem"); will more or less always be true.

If you attempt to set voucher.minPrice to a value in WEI then this causes an overflow bug in most cases because 1 ETH in WEI will exceed the MAX_SAFE_INTERGER value in javascript.