The transferErcTokens function contains a redundant condition check for to == address(0). This check is performed twice, leading to unnecessary gas consumption.
This check appears twice in the function—once at the beginning and again after retrieving tokenInfo:
ERC20Info memory tokenInfo = nftToErc20Info[nftAddress];
if (to == address(0)) { // <-- Redundant check
revert TokenDivider__CantTransferToAddressZero();
}
The second instance is unnecessary, as the function execution would have already reverted if to was address(0) during the first check.
Keeping redundant conditions makes code harder to maintain
Manuel review
Remove the second occurrence of the condition
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.