Merge pull request #63 from propeller-heads/router/dc/ENG-4226-misc-audit-remarks

fix: Miscellaneous audit remarks
This commit is contained in:
dianacarvalho1
2025-02-12 09:51:39 +00:00
committed by GitHub

View File

@@ -9,6 +9,7 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@permit2/src/interfaces/IAllowanceTransfer.sol";
import "@uniswap/v3-updated/CallbackValidationV2.sol";
import "./ExecutionDispatcher.sol";
@@ -65,23 +66,18 @@ contract TychoRouter is
address private immutable _usv3Factory;
constructor(address _permit2, address weth, address usv3Factory) {
if (
_permit2 == address(0) || weth == address(0)
|| usv3Factory == address(0)
) {
revert TychoRouter__AddressZero();
}
permit2 = IAllowanceTransfer(_permit2);
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_weth = IWETH(weth);
if (usv3Factory == address(0)) {
revert TychoRouter__AddressZero();
}
_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.
* This function enables multi-step swaps, optional ETH wrapping/unwrapping, and validates the output amount
@@ -161,8 +157,7 @@ contract TychoRouter is
_unwrapETH(amountOut);
}
if (tokenOut == address(0)) {
// slither-disable-next-line arbitrary-send-eth
payable(receiver).transfer(amountOut);
Address.sendValue(payable(receiver), amountOut);
} else {
IERC20(tokenOut).safeTransfer(receiver, amountOut);
}
@@ -257,6 +252,13 @@ contract TychoRouter is
_pause();
}
/**
* @dev Unpauses the contract
*/
function unpause() external onlyRole(UNPAUSER_ROLE) {
_unpause();
}
/**
* @dev Allows granting roles to multiple accounts in a single call.
*/