Function sellErc20 reverts with error TokenDivider__InsuficientBalance when NFT address is invalid. This is a misleading error. It doesnt tell user what actually is wrong with the input.
Function sellErc20 doesnt have a check if the nftAddress is invalid. There is a check if nftAddress is address(0). But if user enters an invalid non-zero address, TokenDivider__InsuficientBalance is thrown which is not a valid error message for the input. Balance is sufficient but address is incorrect.
Following is POC to replicate the issue. Paste Below code in the unit test - TokenDividerTest.t.sol and run the test.
Error message is misleading. Bad user experience. User may try again with different amount not knowing that its actually the address which is wrong. Thus wasting gas and time.
Foundry
Add a validation if nftAddress exists in the mapping nftToErc20Info and is mapped to valid ERC20 Address.Throw an error like - InputNFTAddressDoesntExist. This will be a better user experience
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.