In the collectFee()
function, the normal behavior is to transfer any collected fees — both WETH and native ETH — from the contract to the designated s_collector
address.
However, there is no check to ensure that the contract holds a non-zero WETH or ETH balance before attempting these transfers. This can result in failed transactions or wasted gas due to unnecessary external calls, especially when either balance is zero.
Likelihood:
This will occur every time collectFee()
is called while either the WETH or ETH balance is zero.
It can also happen frequently in a farming environment where fee collection is triggered on a regular interval regardless of balance state.
Impact:
Wasted gas due to unnecessary token transfer or ETH call.
Potential for user confusion or reversion in tightly integrated scripts depending on the require
statement.
Scenario: Contract holds 0 ETH, some WETH
Expected: WETH transferred, no error from ETH transfer
Actual: require
fails if ETH call fails, even if WETH succeeded
This ensures external calls are only made when there’s something to transfer, improving efficiency and avoiding unnecessary failures.
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.