The withdraw() function performs token transfers without checking whether the contract has a non-zero balance of each token. This leads to unnecessary gas consumption when the contract’s balance is zero for a specific token.
In the current implementation, the contract calls the safeTransfer function for each token (WETH, WBTC, USDC) regardless of whether the contract holds a balance of the token.
This leads to unnecessary gas costs when the balance of a token is zero.
Unnecessary gas consumption due to attempting token transfers even when the contract’s balance is zero.
Increased transaction costs for the host.
Manual code review
To optimize gas usage, check the token balance before calling the safeTransfer function. This will ensure that transfers are only executed when the contract has a non-zero balance of the token.
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.