nft-website icon indicating copy to clipboard operation
nft-website copied to clipboard

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

Open morozj01 opened this issue 2 years ago • 0 comments

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.

morozj01 avatar Mar 13 '22 18:03 morozj01