The function checks if to == address(0) twice, which is redundant and can be optimized. The second check occurs after the state has already been updated, potentially leading to inconsistencies if the check fails later.
The code contains two checks for to == address(0)
Redundancy: The code performs the same check twice, which is unnecessary and can make the code harder to read and maintain.
Gas Inefficiency: Duplicate checks consume more gas than needed.
State Inconsistency Risk: Checking to == address(0)
after updating balances (which happens before the second check) could lead to inconsistencies if the check fails after balances are modified.
Manual code review.
Remove the second check for to == address(0) since it is redundant. Perform the check at the beginning of the function before any state is modified. This will improve efficiency and reduce the risk of inconsistencies.
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.