The StrategyOp::_swapUnderlyingToAsset function is an internal function invoked by the claimAndSwap function. Currently, _swapUnderlyingToAsset performs a check to verify if the contract has sufficient underlying balance before proceeding with the swap or claim. If the required balance is unavailable, the transaction reverts. This issue could be mitigated if the balance check were performed directly in the claimAndSwap function, preventing unnecessary reverts.
If the claimAndSwap function calls _swapUnderlyingToAsset and the transaction reverts due to insufficient underlying balance, it results in higher gas costs. Performing the balance check earlier, within the claimAndSwap function, would avoid unnecessary execution and reduce gas consumption.
Manual review.
Move the balance check currently in _swapUnderlyingToAsset to the claimAndSwap function. This approach adheres to the Checks-Effects-Interactions (CEI) pattern and minimizes the likelihood of unnecessary reverts, reducing gas costs and improving overall efficiency.
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.