Normal behavior: collectFee() is intended to transfer all accumulated WETH fees from the Snow contract to the collector address.
The issue: i_weth.transfer(s_collector, collection) uses the raw IERC20.transfer() function whose return value is not checked. Some ERC20 tokens (notably non-standard implementations) return false on failure instead of reverting. If the WETH transfer fails silently, the function continues to send native ETH to the collector, giving the false impression that fees were collected when WETH remains stuck in the contract.
Likelihood:
If WETH contract is upgraded or replaced with a non-standard implementation, transfer() may return false.
The collector calls this function to withdraw fees and silent failure means lost revenue.
Impact:
WETH fees are silently lost and collector receives ETH but not WETH
No error is raised and collector has no indication the WETH transfer failed
The following Foundry test demonstrates that collectFee() silently succeeds
even when the WETH transfer fails. A mock WETH token that returns false on
transfer is used to simulate the failure. The function completes without
reverting, the collector receives ETH but not WETH, and the contract
balance check shows WETH is still stuck in the contract with no error raised.
The fix replaces the raw IERC20.transfer() call with SafeERC20.safeTransfer()
which is already imported and used correctly elsewhere in Snow.sol. SafeERC20
wraps the transfer call and reverts if the return value is false or if the
token does not return a value at all. This brings collectFee() into
consistency with buySnow() which already uses i_weth.safeTransferFrom()
correctly. No new imports are required, SafeERC20 is already in scope.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.