The code omits a crucial step of ensuring that the swapRouter
contract has enough allowance to spend the _profits
tokens before calling swapRouter.exactInputSingle(params)
.
The function sellProfits
is designed to swap _profits
tokens for WETH
using the Uniswap v3 router.
Lacks a necessary approval step to grant the swapRouter
enough allowance to spend the _profits
tokens. Without this approval, the exactInputSingle
call will fail.
The absence of the ERC20 approval step can result in transaction failures. If the contract does not have a sufficient allowance, the exactInputSingle
call will fail, leading to a failed transaction.
Manual review
Set unlimited allowance in the constructor
. Consider granting unlimited allowance for the swap router in the constructor itself. This can be done once and avoids the need to approve the allowance repeatedly. Example:
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.