Merge pull request #63 from propeller-heads/router/dc/ENG-4226-misc-audit-remarks
fix: Miscellaneous audit remarks
This commit is contained in:
@@ -9,6 +9,7 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|||||||
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
||||||
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
|
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
|
||||||
import "@openzeppelin/contracts/utils/Pausable.sol";
|
import "@openzeppelin/contracts/utils/Pausable.sol";
|
||||||
|
import "@openzeppelin/contracts/utils/Address.sol";
|
||||||
import "@permit2/src/interfaces/IAllowanceTransfer.sol";
|
import "@permit2/src/interfaces/IAllowanceTransfer.sol";
|
||||||
import "@uniswap/v3-updated/CallbackValidationV2.sol";
|
import "@uniswap/v3-updated/CallbackValidationV2.sol";
|
||||||
import "./ExecutionDispatcher.sol";
|
import "./ExecutionDispatcher.sol";
|
||||||
@@ -65,23 +66,18 @@ contract TychoRouter is
|
|||||||
address private immutable _usv3Factory;
|
address private immutable _usv3Factory;
|
||||||
|
|
||||||
constructor(address _permit2, address weth, address usv3Factory) {
|
constructor(address _permit2, address weth, address usv3Factory) {
|
||||||
|
if (
|
||||||
|
_permit2 == address(0) || weth == address(0)
|
||||||
|
|| usv3Factory == address(0)
|
||||||
|
) {
|
||||||
|
revert TychoRouter__AddressZero();
|
||||||
|
}
|
||||||
permit2 = IAllowanceTransfer(_permit2);
|
permit2 = IAllowanceTransfer(_permit2);
|
||||||
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
||||||
_weth = IWETH(weth);
|
_weth = IWETH(weth);
|
||||||
|
|
||||||
if (usv3Factory == address(0)) {
|
|
||||||
revert TychoRouter__AddressZero();
|
|
||||||
}
|
|
||||||
_usv3Factory = usv3Factory;
|
_usv3Factory = usv3Factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Unpauses the contract
|
|
||||||
*/
|
|
||||||
function unpause() external onlyRole(UNPAUSER_ROLE) {
|
|
||||||
_unpause();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Executes a swap operation based on a predefined swap graph, supporting internal token amount splits.
|
* @notice Executes a swap operation based on a predefined swap graph, supporting internal token amount splits.
|
||||||
* This function enables multi-step swaps, optional ETH wrapping/unwrapping, and validates the output amount
|
* This function enables multi-step swaps, optional ETH wrapping/unwrapping, and validates the output amount
|
||||||
@@ -161,8 +157,7 @@ contract TychoRouter is
|
|||||||
_unwrapETH(amountOut);
|
_unwrapETH(amountOut);
|
||||||
}
|
}
|
||||||
if (tokenOut == address(0)) {
|
if (tokenOut == address(0)) {
|
||||||
// slither-disable-next-line arbitrary-send-eth
|
Address.sendValue(payable(receiver), amountOut);
|
||||||
payable(receiver).transfer(amountOut);
|
|
||||||
} else {
|
} else {
|
||||||
IERC20(tokenOut).safeTransfer(receiver, amountOut);
|
IERC20(tokenOut).safeTransfer(receiver, amountOut);
|
||||||
}
|
}
|
||||||
@@ -257,6 +252,13 @@ contract TychoRouter is
|
|||||||
_pause();
|
_pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Unpauses the contract
|
||||||
|
*/
|
||||||
|
function unpause() external onlyRole(UNPAUSER_ROLE) {
|
||||||
|
_unpause();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Allows granting roles to multiple accounts in a single call.
|
* @dev Allows granting roles to multiple accounts in a single call.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user