20,000 USDC
View results
Submission Details
Severity: medium

use Variable fee instead of fixed fee in sellProfits function

Summary

in the sellProfits function in Fees.soll fee:3000 is hard-coded, it's better to make it Variable, so the user can decide which fee to use.

Vulnerability Details

ISwapRouter.ExactInputSingleParams memory params = ISwapRouter
.ExactInputSingleParams({
tokenIn: _profits,
tokenOut: WETH,
fee: 3000,
recipient: address(this),
deadline: block.timestamp,
amountIn: amount_in,
amountOutMinimum: 0,
sqrtPriceLimitX96: 0

Impact

users are forced to use a fee:3000

Tools Used

manual review

Recommendations

- function sellProfits(address _profits) public {
+ function sellProfits(address _profits, uint24 _fee) public {
require(_profits != WETH, "not allowed");
uint256 amount = IERC20(_profits).balanceOf(address(this));
@@ -31,7 +31,7 @@ contract Fees {
.ExactInputSingleParams({
tokenIn: _profits,
tokenOut: WETH,
- fee: 3000,
+ fee: _fee,

Support

FAQs

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