The recoverTokens
function currently lacks a check for the token balance before initiating transfers. The absence of this check results in unnecessary gas consumption when attempting to transfer zero tokens.
The absence of a zero-balance check may lead to unnecessary gas consumption when attempting to transfer tokens, even when the balance is zero. The recommended enhancement improves gas efficiency by ensuring transfers are executed only when the token balance is greater than zero.
Manual review.
To address this issue, it is advised to incorporate the provided code snippet into the recoverTokens
function. This ensures a more gas-efficient execution of token transfers, avoiding unnecessary transaction costs when the token balance is zero.
Additionally, enhance efficiency by replacing the current if condition check in recoverTokens
with the require statement:
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.