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

Hardcoded uniswap V3 router address

Summary

Using hardcoded addresses is generally considered bad practice and should be avoided whenever possible.

Vulnerability Details

/// uniswap v3 router
ISwapRouter public constant swapRouter =
ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564);

Impact

Hardcoding address makes the contract less flexible. If the address needs to be changed for any reason you would have to redeploy the contract. It also unables deployment to multiple chains on which the desired address might differ.

Tools Used

Manual Analysis, VScode

Recommendations

Implement swapRouter as immutable state variable and initialize it's value in constructor.

address public immutable WETH;
address public immutable staking;
/// uniswap v3 router
ISwapRouter public immutable swapRouter;
constructor(address _weth, address _staking, address _swapRouter) {
WETH = _weth;
staking = _staking;
swapRouter = ISwapRouter(_swapRouter);
}

Support

FAQs

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