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

@@ -60,10 +60,10 @@ contract TychoRouterSequentialSwapTest is TychoRouterTestSetup {
false,
false,
ALICE,
permitSingle,
signature,
true,
WETH_DAI_POOL,
permitSingle,
signature,
pleEncode(swaps)
);
@@ -177,10 +177,10 @@ contract TychoRouterSequentialSwapTest is TychoRouterTestSetup {
false,
false,
ALICE,
permitSingle,
signature,
true,
WETH_DAI_POOL,
permitSingle,
signature,
pleEncode(swaps)
);
vm.stopPrank();
@@ -208,14 +208,14 @@ contract TychoRouterSequentialSwapTest is TychoRouterTestSetup {
swaps[0] = encodeSequentialSwap(
address(usv2Executor),
encodeUniswapV2Swap(
WETH_ADDR, WETH_DAI_POOL, tychoRouterAddr, false, true
WETH_ADDR, WETH_DAI_POOL, DAI_USDC_POOL, false, true
)
);
// DAI -> USDC
swaps[1] = encodeSequentialSwap(
address(usv2Executor),
encodeUniswapV2Swap(DAI_ADDR, DAI_USDC_POOL, ALICE, true, true)
encodeUniswapV2Swap(DAI_ADDR, DAI_USDC_POOL, ALICE, true, false)
);
uint256 amountOut = tychoRouter.sequentialSwapPermit2{value: amountIn}(
@@ -226,10 +226,10 @@ contract TychoRouterSequentialSwapTest is TychoRouterTestSetup {
true,
false,
ALICE,
false,
address(0),
emptyPermitSingle,
"",
true,
tychoRouterAddr,
pleEncode(swaps)
);
uint256 expectedAmount = 2005810530;
@@ -280,10 +280,10 @@ contract TychoRouterSequentialSwapTest is TychoRouterTestSetup {
false,
true,
ALICE,
permitSingle,
signature,
true,
DAI_USDC_POOL,
permitSingle,
signature,
pleEncode(swaps)
);