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

There is no slippage control in `sellProfits` function

Summary

in Fees.sol, the slippage is hard coded to 0

Vulnerability Details

function sellProfits(address _profits) public {
require(_profits != WETH, "not allowed");
uint256 amount = IERC20(_profits).balanceOf(address(this));
ISwapRouter.ExactInputSingleParams memory params = ISwapRouter
.ExactInputSingleParams({
tokenIn: _profits,
tokenOut: WETH,
fee: 3000,
recipient: address(this),
deadline: block.timestamp,
amountIn: amount,
amountOutMinimum: 0,
sqrtPriceLimitX96: 0
});
amount = swapRouter.exactInputSingle(params);
IERC20(WETH).transfer(staking, IERC20(WETH).balanceOf(address(this)));
}
}

Because slippage is hard-coded to 0 in Fees.sol, There is no control over what the max slippage can be. Because of this the owner can get less than anticipated and sometimes even get basically 0 for his swap. This is a direct loss of funds of the fees that is generated by the protocol.

Impact

Protocol loses funds on the fees they have collected.

Tools Used

manual review

Recommendations

set a slippage that is high enough where the tx will never withdraw, but low enough to where you do not lose too much on fees.

Support

FAQs

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