fix: Make all tests pass!

Delete TokenTransfer.sol
Make slither happy

Bugfixes:
- Executors
  - Ekubo:
    - Fix the POOL_DATA_OFFSET value and remove sender from callback data
    - Use SafeERC20
  - Maverick and Univ2: Use safeTransfer and not safeTransferFrom
  - Univ3: update expected data length
  - Univ4: update the selectors (the signature changed)
- Router:
  - For split swap we don't need to pass the tokenInReceiver, it should always be the router address
  - For single and sequential: change order of the parameters (to be before the permit2 specific objects)
- Encoders:
  - Update selector signatures
  - For split swap pass the transfer_from (we might not need to if the token in is ETH)

Took 2 hours 51 minutes
This commit is contained in:
Diana Carvalho
2025-05-15 13:11:34 +01:00
parent 27dfde3118
commit ee687038c5
20 changed files with 126 additions and 197 deletions

View File

@@ -43,10 +43,10 @@ contract TychoRouterTestProtocolIntegration is TychoRouterTestSetup {
false,
false,
ALICE,
permitSingle,
signature,
false,
address(0),
permitSingle,
signature,
swap
);
@@ -58,7 +58,7 @@ contract TychoRouterTestProtocolIntegration is TychoRouterTestSetup {
// This test has two uniswap v4 hops that will be executed inside of the V4 pool manager
// USDE -> USDT -> WBTC
uint256 amountIn = 100 ether;
deal(USDE_ADDR, tychoRouterAddr, amountIn);
deal(USDE_ADDR, ALICE, amountIn);
UniswapV4Executor.UniswapV4Pool[] memory pools =
new UniswapV4Executor.UniswapV4Pool[](2);
@@ -77,7 +77,7 @@ contract TychoRouterTestProtocolIntegration is TychoRouterTestSetup {
USDE_ADDR,
WBTC_ADDR,
true,
true, // permit2 transferFrom to protocol
true, // transferFrom to protocol
false, // transfer to protocol
ALICE,
pools
@@ -86,6 +86,8 @@ contract TychoRouterTestProtocolIntegration is TychoRouterTestSetup {
bytes memory swap =
encodeSingleSwap(address(usv4Executor), protocolData);
vm.startPrank(ALICE);
IERC20(USDE_ADDR).approve(tychoRouterAddr, amountIn);
tychoRouter.singleSwap(
amountIn,
USDE_ADDR,
@@ -289,10 +291,10 @@ contract TychoRouterTestProtocolIntegration is TychoRouterTestSetup {
false,
false,
ALICE,
permitSingle,
signature,
false,
address(0),
permitSingle,
signature,
swap
);