fix(univ4): Make slither happy

--- don't change below this line ---
ENG-4222 Took 17 minutes

Took 47 seconds


Took 14 seconds
This commit is contained in:
Diana Carvalho
2025-02-14 12:01:29 +00:00
parent 4d0f5cec64
commit 8a8bc697eb
3 changed files with 16 additions and 17 deletions

View File

@@ -450,7 +450,8 @@ contract TychoRouter is
{ {
require(data.length >= 20, "Invalid data length"); require(data.length >= 20, "Invalid data length");
bytes4 selector = bytes4(data[data.length - 4:]); bytes4 selector = bytes4(data[data.length - 4:]);
address executor = address(uint160(bytes20(data[data.length - 24:data.length - 4]))); address executor =
address(uint160(bytes20(data[data.length - 24:data.length - 4])));
bytes memory protocolData = data[:data.length - 24]; bytes memory protocolData = data[:data.length - 24];
if (!executors[executor]) { if (!executors[executor]) {

View File

@@ -75,7 +75,6 @@ contract UniswapV4Executor is IExecutor, V4Router {
params[1] = abi.encode(key.currency0, amountIn); params[1] = abi.encode(key.currency0, amountIn);
params[2] = abi.encode(key.currency1, amountOutMin); params[2] = abi.encode(key.currency1, amountOutMin);
swapData = abi.encode(actions, params); swapData = abi.encode(actions, params);
} else { } else {
PathKey[] memory path = new PathKey[](pools.length); PathKey[] memory path = new PathKey[](pools.length);
for (uint256 i = 0; i < pools.length; i++) { for (uint256 i = 0; i < pools.length; i++) {
@@ -132,11 +131,12 @@ contract UniswapV4Executor is IExecutor, V4Router {
// necessary to convert bytes memory to bytes calldata // necessary to convert bytes memory to bytes calldata
function executeActions(bytes memory unlockData) public { function executeActions(bytes memory unlockData) public {
// slither-disable-next-line unused-return
poolManager.unlock(unlockData); poolManager.unlock(unlockData);
} }
function _decodeData(bytes calldata data) function _decodeData(bytes calldata data)
public internal
pure pure
returns ( returns (
address tokenIn, address tokenIn,
@@ -168,6 +168,7 @@ contract UniswapV4Executor is IExecutor, V4Router {
uint24 fee; uint24 fee;
int24 tickSpacing; int24 tickSpacing;
// slither-disable-next-line assembly
assembly { assembly {
intermediaryToken := mload(add(poolsData, add(offset, 20))) intermediaryToken := mload(add(poolsData, add(offset, 20)))
fee := shr(232, mload(add(poolsData, add(offset, 52)))) fee := shr(232, mload(add(poolsData, add(offset, 52))))
@@ -178,10 +179,7 @@ contract UniswapV4Executor is IExecutor, V4Router {
} }
} }
function _pay(Currency token, address payer, uint256 amount) function _pay(Currency token, address, uint256 amount) internal override {
internal
override
{
IERC20(Currency.unwrap(token)).safeTransfer( IERC20(Currency.unwrap(token)).safeTransfer(
address(poolManager), amount address(poolManager), amount
); );

View File

@@ -141,7 +141,6 @@ contract UniswapV4ExecutorTest is Test, Constants {
uint256 usdeBalanceBeforeSwapExecutor = uint256 usdeBalanceBeforeSwapExecutor =
USDE.balanceOf(address(uniswapV4Exposed)); USDE.balanceOf(address(uniswapV4Exposed));
UniswapV4Executor.UniswapV4Pool[] memory pools = UniswapV4Executor.UniswapV4Pool[] memory pools =
new UniswapV4Executor.UniswapV4Pool[](2); new UniswapV4Executor.UniswapV4Pool[](2);
pools[0] = UniswapV4Executor.UniswapV4Pool({ pools[0] = UniswapV4Executor.UniswapV4Pool({
@@ -171,7 +170,8 @@ contract UniswapV4ExecutorTest is Test, Constants {
USDE.balanceOf(address(uniswapV4Exposed)), USDE.balanceOf(address(uniswapV4Exposed)),
usdeBalanceBeforeSwapExecutor - amountIn usdeBalanceBeforeSwapExecutor - amountIn
); );
assertTrue(IERC20(WBTC_ADDR).balanceOf(address(uniswapV4Exposed)) == amountOut); assertTrue(
IERC20(WBTC_ADDR).balanceOf(address(uniswapV4Exposed)) == amountOut
);
} }
} }