DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: low
Invalid

Lack of Fallback Mechanism if Swaps Fail

Description

If the swap operation in _swapUnderlyingToAsset fails (e.g., due to insufficient liquidity or router issues), the contract does not have a fallback mechanism to handle such failures gracefully.

// No error handling if swap fails
IVeloRouter(router).swapExactTokensForTokens(
_amount,
minOut,
_path,
address(this),
block.timestamp
);

Impact

  • Transaction Reversions: Swap failures lead to transaction reverts, consuming gas and potentially delaying strategy operations.

  • Operational Delays: Continued failures can prevent the strategy from executing its intended function, affecting performance.

Recommendation

  • Implement Error Handling for Swaps: Use try-catch blocks to handle exceptions during swaps and implement fallback logic.

    try IVeloRouter(router).swapExactTokensForTokens(
    _amount,
    minOut,
    _path,
    address(this),
    block.timestamp
    ) {
    // Swap succeeded
    } catch {
    // Handle swap failure
    emit SwapFailed(_amount, minOut, _path);
    // Implement fallback mechanism, e.g., alternative swap, hold tokens, alert keeper
    }
Updates

Appeal created

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.