Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: medium
Invalid

Failed swaps result in permanent loss of protocol fees

In the convertAccumulatedFeesToWeth() function, the contract performs asset swaps using a DEX strategy. If a custom multi-DEX swap path is enabled, it calls _performMultiDexSwap(), otherwise, it selects between single-hop and multi-hop swaps based on whether path is empty. However, there is no validation to check whether the swap actually succeeded before updating the received WETH balance:

ctx.tokensSwapped = dexSwapStrategy.executeSwapExactInputSingle(swapCallData);

If the swap fails due to slippage, liquidity issues, or an incorrect swap path, tokensSwapped may return 0, yet the contract continues processing as if the swap succeeded. This results in receivedWethX18 being set to 0, but the contract still removes the original asset balance from market.receivedFees, effectively burning the asset without receiving WETH in return.

Impact

Failed swaps result in permanent loss of protocol fees, reducing the amount of WETH distributed to LPs and stakeholders, leading to unfair reward allocation and financial loss for the protocol.

Mitigation

Validate that tokensSwapped > 0 before proceeding with WETH distribution and revert the transaction if the swap fails:

require(ctx.tokensSwapped > 0, "Swap failed: No WETH received");
Updates

Lead Judging Commences

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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