Part 2

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

Suboptimal Token Swaps Due to Lack of DEX Aggregation

Summary

The current implementation uses individual DEX adapters (UniswapV2, UniswapV3, and Curve) for token swaps without any DEX aggregation layer. This leads to suboptimal swap rates as each swap is restricted to a single DEX's liquidity pool, rather than finding the best possible rate across multiple DEXes.

Vulnerability Details

The system implements three separate DEX adapters:

  • UniswapV2Adapter.sol

  • UniswapV3Adapter.sol

  • CurveAdapter.sol

Each adapter is designed to interact with its respective DEX protocol:

  • The executeSwapExactInput function in each adapter only executes swaps through its specific DEX

  • There is no mechanism to compare rates across different DEXes

  • Swaps are executed directly through a single DEX's router without considering better rates that might be available elsewhere
    For example, in UniswapV3Adapter.sol:

function executeSwapExactInput(SwapExactInputPayload calldata swapPayload) external returns (uint256 amountOut) {
// ...
IUniswapV3RouterInterface swapRouter = IUniswapV3RouterInterface(uniswapV3SwapStrategyRouter);
// ... executes swap only through UniswapV3
}

Impact

  • Users receive suboptimal swap rates as trades are not routed through the most efficient paths

  • Missed opportunities for better pricing through split routes across multiple DEXes

  • Higher slippage on larger trades due to being restricted to single DEX liquidity pools

Tools Used

  • Manual code review

Recommendations

  • Integrate a DEX aggregator like 1inch or 0x Protocol

Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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