20,000 USDC
View results
Submission Details
Severity: medium
Valid

Hardcoded Fee Tier Selection in Uniswap v3 Swap Operation Potentially Leading to Suboptimal Swap Rate

Summary

Hardcoded Fee Tier Selection in Uniswap v3 Swap Operation Potentially Leading to Suboptimal Swap Rate.

Vulnerability Details

The sellProfits function in the contract uses a hardcoded fee tier of 3000 for Uniswap v3 swap operations. This lack of flexibility in fee tier selection can lead to poor swap rates or failed transactions due to low liquidity or nonexistent pools.

Proof of Concept

Given:

  • There are some _profits tokens in the contract.

When:

  1. The contract attempts to swap _profits tokens for WETH at an optimal rate.

  2. Due to the hardcoded fee tier of 3000, the swap operation may end up using a pool with lower liquidity or even a nonexistent pool.

  3. As a result, the swap may occur at a suboptimal rate or fail entirely.

Impact

This design choice may lead to usage of a low liquidity pool or even a nonexistent pool, resulting in less optimal or failed swaps.

Tools Used

ChatGPT & VS Code

Recommendations

Consider implementing a dynamic fee tier selection mechanism: Instead of hardcoding the fee tier for swap operations, dynamically select the fee tier based on current pool liquidity. This could improve the swap rate significantly, particularly for larger transactions. Careful consideration should be given to balancing the optimality of swap rates against potential increases in complexity and gas costs.

Support

FAQs

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