From 680324d57c30a09edb254e3e41e912414f6b490a Mon Sep 17 00:00:00 2001 From: Emily Williams Date: Tue, 8 Oct 2024 16:58:46 -0400 Subject: [PATCH] fix(universal-router-sdk): Supports Mixed Routes with V4 (#145) --- sdks/universal-router-sdk/package.json | 2 +- .../src/entities/actions/uniswap.ts | 109 +++++++++------ .../src/utils/pathCurrency.ts | 28 ++++ .../src/utils/routerTradeAdapter.ts | 1 + .../test/forge/SwapERC20CallParameters.t.sol | 132 +++++++++++++++++- .../test/forge/interop.json | 52 +++++-- .../test/forge/utils/DeployRouter.sol | 5 +- .../test/uniswapTrades.test.ts | 102 +++++++++++--- yarn.lock | 14 +- 9 files changed, 359 insertions(+), 86 deletions(-) create mode 100644 sdks/universal-router-sdk/src/utils/pathCurrency.ts diff --git a/sdks/universal-router-sdk/package.json b/sdks/universal-router-sdk/package.json index 236c94d96..272769b39 100644 --- a/sdks/universal-router-sdk/package.json +++ b/sdks/universal-router-sdk/package.json @@ -31,7 +31,7 @@ "dependencies": { "@openzeppelin/contracts": "4.7.0", "@uniswap/permit2-sdk": "^1.3.0", - "@uniswap/router-sdk": "^1.14.0", + "@uniswap/router-sdk": "^1.14.2", "@uniswap/sdk-core": "^5.8.0", "@uniswap/universal-router": "2.0.0-beta.1", "@uniswap/v2-core": "^1.0.1", diff --git a/sdks/universal-router-sdk/src/entities/actions/uniswap.ts b/sdks/universal-router-sdk/src/entities/actions/uniswap.ts index 8ca7e4159..62e60a427 100644 --- a/sdks/universal-router-sdk/src/entities/actions/uniswap.ts +++ b/sdks/universal-router-sdk/src/entities/actions/uniswap.ts @@ -1,7 +1,14 @@ import { RoutePlanner, CommandType } from '../../utils/routerCommands' import { Trade as V2Trade, Pair } from '@uniswap/v2-sdk' import { Trade as V3Trade, Pool as V3Pool, encodeRouteToPath } from '@uniswap/v3-sdk' -import { Trade as V4Trade, V4Planner } from '@uniswap/v4-sdk' +import { + Route as V4Route, + Trade as V4Trade, + Pool as V4Pool, + V4Planner, + encodeRouteToPath as encodeV4RouteToPath, + Actions, +} from '@uniswap/v4-sdk' import { Trade as RouterTrade, MixedRouteTrade, @@ -18,6 +25,7 @@ import { partitionMixedRouteByProtocol, } from '@uniswap/router-sdk' import { Permit2Permit } from '../../utils/inputTokens' +import { getPathCurrency } from '../../utils/pathCurrency' import { Currency, TradeType, CurrencyAmount, Percent } from '@uniswap/sdk-core' import { Command, RouterActionType, TradeConfig } from '../Command' import { SENDER_AS_RECIPIENT, ROUTER_AS_RECIPIENT, CONTRACT_BALANCE, ETH_ADDRESS } from '../../utils/constants' @@ -118,15 +126,7 @@ export class UniswapTrade implements Command { addV3Swap(planner, swap, this.trade.tradeType, this.options, this.payerIsUser, routerMustCustody) break case Protocol.V4: - addV4Swap( - planner, - swap, - this.trade.tradeType, - this.options, - this.payerIsUser, - routerMustCustody, - performAggregatedSlippageCheck - ) + addV4Swap(planner, swap, this.trade.tradeType, this.options, this.payerIsUser, routerMustCustody) break case Protocol.MIXED: addMixedSwap(planner, swap, this.trade.tradeType, this.options, this.payerIsUser, routerMustCustody) @@ -279,8 +279,7 @@ function addV4Swap( tradeType: TradeType, options: SwapOptions, payerIsUser: boolean, - routerMustCustody: boolean, - performAggregatedSlippageCheck: boolean + routerMustCustody: boolean ): void { const trade = V4Trade.createUncheckedTrade({ route: route as RouteV4, @@ -288,7 +287,8 @@ function addV4Swap( outputAmount, tradeType, }) - const slippageToleranceOnSwap = performAggregatedSlippageCheck ? undefined : options.slippageTolerance + const slippageToleranceOnSwap = + routerMustCustody && tradeType == TradeType.EXACT_INPUT ? undefined : options.slippageTolerance const inputWethFromRouter = inputAmount.currency.isNative && !route.input.isNative if (inputWethFromRouter && !payerIsUser) throw new Error('Inconsistent payer') @@ -312,12 +312,16 @@ function addMixedSwap( payerIsUser: boolean, routerMustCustody: boolean ): void { - const { route, inputAmount, outputAmount } = swap - const tradeRecipient = routerMustCustody ? ROUTER_AS_RECIPIENT : options.recipient + const route = swap.route as MixedRoute + const inputAmount = swap.inputAmount + const outputAmount = swap.outputAmount + const tradeRecipient = routerMustCustody ? ROUTER_AS_RECIPIENT : options.recipient ?? SENDER_AS_RECIPIENT - // single hop, so it can be reduced to plain v2 or v3 swap logic + // single hop, so it can be reduced to plain swap logic for one protocol version if (route.pools.length === 1) { - if (route.pools[0] instanceof V3Pool) { + if (route.pools[0] instanceof V4Pool) { + return addV4Swap(planner, swap, tradeType, options, payerIsUser, routerMustCustody) + } else if (route.pools[0] instanceof V3Pool) { return addV3Swap(planner, swap, tradeType, options, payerIsUser, routerMustCustody) } else if (route.pools[0] instanceof Pair) { return addV2Swap(planner, swap, tradeType, options, payerIsUser, routerMustCustody) @@ -345,49 +349,74 @@ function addMixedSwap( return i === sections.length - 1 } - let outputToken - let inputToken = route.input.wrapped + let inputToken = route.pathInput for (let i = 0; i < sections.length; i++) { const section = sections[i] - /// Now, we get output of this section - outputToken = getOutputOfPools(section, inputToken) + const routePool = section[0] + const outputToken = getOutputOfPools(section, inputToken) + const subRoute = new MixedRoute(new MixedRouteSDK([...section], inputToken, outputToken)) - const newRouteOriginal = new MixedRouteSDK( - [...section], - section[0].token0.equals(inputToken) ? section[0].token0 : section[0].token1, - outputToken - ) - const newRoute = new MixedRoute(newRouteOriginal) + let nextInputToken + let swapRecipient - /// Previous output is now input - inputToken = outputToken.wrapped + if (isLastSectionInRoute(i)) { + nextInputToken = outputToken + swapRecipient = tradeRecipient + } else { + const nextPool = sections[i + 1][0] + nextInputToken = getPathCurrency(outputToken, nextPool) - const mixedRouteIsAllV3 = (route: MixedRouteSDK) => { - return route.pools.every((pool) => pool instanceof V3Pool) + const v2PoolIsSwapRecipient = nextPool instanceof Pair && outputToken.equals(nextInputToken) + swapRecipient = v2PoolIsSwapRecipient ? (nextPool as Pair).liquidityToken.address : ROUTER_AS_RECIPIENT } - if (mixedRouteIsAllV3(newRoute)) { - const path: string = encodeMixedRouteToPath(newRoute) + if (routePool instanceof V4Pool) { + const v4Planner = new V4Planner() + const v4SubRoute = new V4Route(section as V4Pool[], subRoute.input, subRoute.output) + + v4Planner.addSettle(inputToken, payerIsUser && i === 0, (i == 0 ? amountIn : CONTRACT_BALANCE) as BigNumber) + v4Planner.addAction(Actions.SWAP_EXACT_IN, [ + { + currencyIn: inputToken.isNative ? ETH_ADDRESS : inputToken.address, + path: encodeV4RouteToPath(v4SubRoute), + amountIn: 0, // denotes open delta, amount set in v4Planner.addSettle() + amountOutMinimum: !isLastSectionInRoute(i) ? 0 : amountOut, + }, + ]) + v4Planner.addTake(outputToken, swapRecipient) + planner.addCommand(CommandType.V4_SWAP, [v4Planner.finalize()]) + } else if (routePool instanceof V3Pool) { planner.addCommand(CommandType.V3_SWAP_EXACT_IN, [ - // if not last section: send tokens directly to the first v2 pair of the next section - // note: because of the partitioning function we can be sure that the next section is v2 - isLastSectionInRoute(i) ? tradeRecipient : (sections[i + 1][0] as Pair).liquidityToken.address, + swapRecipient, // recipient i == 0 ? amountIn : CONTRACT_BALANCE, // amountIn !isLastSectionInRoute(i) ? 0 : amountOut, // amountOut - path, // path + encodeMixedRouteToPath(subRoute), // path payerIsUser && i === 0, // payerIsUser ]) - } else { + } else if (routePool instanceof Pair) { planner.addCommand(CommandType.V2_SWAP_EXACT_IN, [ - isLastSectionInRoute(i) ? tradeRecipient : ROUTER_AS_RECIPIENT, // recipient + swapRecipient, // recipient i === 0 ? amountIn : CONTRACT_BALANCE, // amountIn !isLastSectionInRoute(i) ? 0 : amountOut, // amountOutMin - newRoute.path.map((token) => token.wrapped.address), // path + subRoute.path.map((token) => token.wrapped.address), // path payerIsUser && i === 0, ]) + } else { + throw new Error('Unexpected Pool Type') } + + // perform a token transition (wrap/unwrap if necessary) + if (!isLastSectionInRoute(i)) { + if (outputToken.isNative && !nextInputToken.isNative) { + planner.addCommand(CommandType.WRAP_ETH, [ROUTER_AS_RECIPIENT, CONTRACT_BALANCE]) + } else if (!outputToken.isNative && nextInputToken.isNative) { + planner.addCommand(CommandType.UNWRAP_WETH, [ROUTER_AS_RECIPIENT, 0]) + } + } + + inputToken = nextInputToken } } diff --git a/sdks/universal-router-sdk/src/utils/pathCurrency.ts b/sdks/universal-router-sdk/src/utils/pathCurrency.ts new file mode 100644 index 000000000..e7852b998 --- /dev/null +++ b/sdks/universal-router-sdk/src/utils/pathCurrency.ts @@ -0,0 +1,28 @@ +import { Currency, Token } from '@uniswap/sdk-core' +import { Pool as V4Pool } from '@uniswap/v4-sdk' +import { TPool } from '@uniswap/router-sdk/dist/utils/TPool' + +export function getPathCurrency(currency: Currency, pool: TPool): Currency { + // return currency if the currency matches a currency of the pool + if (pool.involvesToken(currency as Token)) { + return currency + + // return if currency.wrapped if pool involves wrapped currency + } else if (pool.involvesToken(currency.wrapped as Token)) { + return currency.wrapped + + // return native currency if pool involves native version of wrapped currency (only applies to V4) + } else if (pool instanceof V4Pool) { + if (pool.token0.wrapped.equals(currency)) { + return pool.token0 + } else if (pool.token1.wrapped.equals(currency)) { + return pool.token1 + } + + // otherwise the token is invalid + } else { + throw new Error(`Expected currency ${currency.symbol} to be either ${pool.token0.symbol} or ${pool.token1.symbol}`) + } + + return currency // this line needed for typescript to compile +} diff --git a/sdks/universal-router-sdk/src/utils/routerTradeAdapter.ts b/sdks/universal-router-sdk/src/utils/routerTradeAdapter.ts index 0bd128edf..56b303edd 100644 --- a/sdks/universal-router-sdk/src/utils/routerTradeAdapter.ts +++ b/sdks/universal-router-sdk/src/utils/routerTradeAdapter.ts @@ -18,6 +18,7 @@ export type TokenInRoute = { export enum PoolType { V2Pool = 'v2-pool', V3Pool = 'v3-pool', + V4Pool = 'v4-pool', } export type V2Reserve = { diff --git a/sdks/universal-router-sdk/test/forge/SwapERC20CallParameters.t.sol b/sdks/universal-router-sdk/test/forge/SwapERC20CallParameters.t.sol index a77aa2b2c..33f85bcfe 100644 --- a/sdks/universal-router-sdk/test/forge/SwapERC20CallParameters.t.sol +++ b/sdks/universal-router-sdk/test/forge/SwapERC20CallParameters.t.sol @@ -546,9 +546,51 @@ contract SwapERC20CallParametersTest is Test, Interop, DeployRouter { assertGt(USDC.balanceOf(RECIPIENT), 2000 * ONE_USDC); } - // v4-sdk 1.6.3 allows this - // function testV4ExactInputEthWithWrap() public { - // MethodParameters memory params = readFixture(json, "._UNISWAP_V4_1_ETH_FOR_USDC_WITH_WRAP"); + function testV4ExactInputEthWithWrap() public { + MethodParameters memory params = readFixture(json, "._UNISWAP_V4_1_ETH_FOR_USDC_WITH_WRAP"); + assertEq(from.balance, BALANCE); + assertEq(USDC.balanceOf(RECIPIENT), 0); + assertEq(params.value, 1e18); + + (bool success,) = address(router).call{value: params.value}(params.data); + require(success, "call failed"); + + assertLe(from.balance, BALANCE - params.value); + assertGt(USDC.balanceOf(RECIPIENT), 2000 * ONE_USDC); + } + + // TODO: Logic for giving WETH fee with an ETH output + // function testV4ExactInputDAIForETHwithWEthFee() public { + // MethodParameters memory params = readFixture(json, "._UNISWAP_V4_USDC_FOR_1_ETH_2_HOP_WITH_WETH_FEE"); + // deal(address(USDC), from, BALANCE); + // USDC.approve(address(permit2), BALANCE); + // permit2.approve(address(USDC), address(router), uint160(BALANCE), uint48(block.timestamp + 1000)); + // + // assertEq(USDC.balanceOf(from), BALANCE); + // uint256 startingRecipientBalance = RECIPIENT.balance; + // uint256 startingFeeRecipientBalance = FEE_RECIPIENT.balance; + // assertEq(WETH.balanceOf(FEE_RECIPIENT), 0); + // + // (bool success,) = address(router).call{value: params.value}(params.data); + // require(success, "call failed"); + // assertLe(USDC.balanceOf(from), BALANCE - 1000 ether); + // + // uint256 recipientOutETH = RECIPIENT.balance - startingRecipientBalance; + // uint256 feeRecipientOutETH = FEE_RECIPIENT.balance - startingFeeRecipientBalance; + // uint256 feeRecipientOutWETH = WETH.balanceOf(FEE_RECIPIENT); + // + // uint256 totalOut = recipientOutETH + feeRecipientOutWETH; + // uint256 expectedFee = totalOut * 500 / 10000; + // + // // Recipient should get ETH, and fee recipient should get WETH (and no ETH) + // assertEq(feeRecipientOutWETH, expectedFee); + // assertEq(feeRecipientOutETH, 0); + // assertEq(recipientOutETH, totalOut - expectedFee); + // assertGt(totalOut, 0.1 ether); + // + // // Nothing left in the router! + // assertEq(WETH.balanceOf(address(router)), 0); + // assertEq(address(router).balance, 0); // } function testV4ExactInWithFee() public { @@ -714,4 +756,88 @@ contract SwapERC20CallParametersTest is Test, Interop, DeployRouter { assertEq(USDC.balanceOf(address(router)), 0); assertEq(address(router).balance, 0); } + + function testMixedV3ToV4UnwrapWETH() public { + MethodParameters memory params = readFixture(json, "._UNISWAP_MIXED_USDC_DAI_UNWRAP_WETH_V3_TO_V4"); + + uint256 usdcAmount = 1000000000; + deal(address(USDC), from, usdcAmount); + USDC.approve(address(permit2), usdcAmount); + permit2.approve(address(USDC), address(router), uint160(usdcAmount), uint48(block.timestamp + 1000)); + + assertEq(USDC.balanceOf(from), usdcAmount); + assertEq(DAI.balanceOf(RECIPIENT), 0); + + (bool success,) = address(router).call{value: params.value}(params.data); + require(success, "call failed"); + + assertLe(from.balance, BALANCE - params.value); + assertEq(USDC.balanceOf(from), 0); + assertEq(DAI.balanceOf(address(router)), 0); + assertGt(DAI.balanceOf(RECIPIENT), 0); + assertEq(address(router).balance, 0); + } + + function testMixedV2ToV4UnwrapWETH() public { + MethodParameters memory params = readFixture(json, "._UNISWAP_MIXED_USDC_DAI_UNWRAP_WETH_V2_TO_V4"); + + uint256 usdcAmount = 1000000000; + deal(address(USDC), from, usdcAmount); + USDC.approve(address(permit2), usdcAmount); + permit2.approve(address(USDC), address(router), uint160(usdcAmount), uint48(block.timestamp + 1000)); + + assertEq(USDC.balanceOf(from), usdcAmount); + assertEq(DAI.balanceOf(RECIPIENT), 0); + + (bool success,) = address(router).call{value: params.value}(params.data); + require(success, "call failed"); + + assertLe(from.balance, BALANCE - params.value); + assertEq(USDC.balanceOf(from), 0); + assertEq(DAI.balanceOf(address(router)), 0); + assertGt(DAI.balanceOf(RECIPIENT), 0); + assertEq(address(router).balance, 0); + } + + function testMixedV4ToV3WrapETH() public { + MethodParameters memory params = readFixture(json, "._UNISWAP_MIXED_DAI_USDC_WRAP_ETH_V4_TO_V3"); + + uint256 daiAmount = 1000 ether; + deal(address(DAI), from, daiAmount); + DAI.approve(address(permit2), daiAmount); + permit2.approve(address(DAI), address(router), uint160(daiAmount), uint48(block.timestamp + 1000)); + + assertEq(DAI.balanceOf(from), daiAmount); + assertEq(USDC.balanceOf(RECIPIENT), 0); + + (bool success,) = address(router).call{value: params.value}(params.data); + require(success, "call failed"); + + assertLe(from.balance, BALANCE - params.value); + assertEq(DAI.balanceOf(from), 0); + assertEq(USDC.balanceOf(address(router)), 0); + assertGt(USDC.balanceOf(RECIPIENT), 0); + assertEq(address(router).balance, 0); + } + + function testMixedV4ToV2WrapETH() public { + MethodParameters memory params = readFixture(json, "._UNISWAP_MIXED_DAI_USDC_WRAP_ETH_V4_TO_V2"); + + uint256 daiAmount = 1000 ether; + deal(address(DAI), from, daiAmount); + DAI.approve(address(permit2), daiAmount); + permit2.approve(address(DAI), address(router), uint160(daiAmount), uint48(block.timestamp + 1000)); + + assertEq(DAI.balanceOf(from), daiAmount); + assertEq(USDC.balanceOf(RECIPIENT), 0); + + (bool success,) = address(router).call{value: params.value}(params.data); + require(success, "call failed"); + + assertLe(from.balance, BALANCE - params.value); + assertEq(DAI.balanceOf(from), 0); + assertEq(USDC.balanceOf(address(router)), 0); + assertGt(USDC.balanceOf(RECIPIENT), 0); + assertEq(address(router).balance, 0); + } } diff --git a/sdks/universal-router-sdk/test/forge/interop.json b/sdks/universal-router-sdk/test/forge/interop.json index 8a6e61dcd..6ea484d31 100644 --- a/sdks/universal-router-sdk/test/forge/interop.json +++ b/sdks/universal-router-sdk/test/forge/interop.json @@ -116,11 +116,11 @@ "value": "1000000000000000000" }, "_UNISWAP_V4_1_ETH_FOR_USDC_WITH_FEE": { - "calldata": "0x24856bc3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003100604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003050912000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000c940c1a716d6c2000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000c940c1a716d6c20", + "calldata": "0x24856bc3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003100604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003050912000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000c940c1a716d6c20", "value": "1000000000000000000" }, "_UNISWAP_V4_1_ETH_FOR_USDC_WITH_FLAT_FEE": { - "calldata": "0x24856bc3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003100504000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003050912000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000d2d62035241defd00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0000000000000000000000000000000000000000000000000000000002faf0800000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000d2d62035241defd", + "calldata": "0x24856bc3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003100504000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003050912000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0000000000000000000000000000000000000000000000000000000002faf0800000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000d2d62035241defd", "value": "1000000000000000000" }, "_UNISWAP_V4_1000_USDC_FOR_ETH": { @@ -135,14 +135,6 @@ "calldata": "0x24856bc300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000030709120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000ea8d710c6670fe50000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001000000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000000000000000000", "value": "0" }, - "_UNISWAP_MIXED_1_ETH_FOR_DAI": { - "calldata": "0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000030b000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000ae461ca67b15dc8dc81ce7615e0320da1a9ab8d50000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e6e6bec160b0fe3f600000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006b175474e89094c44da98b954eedeac495271d0f", - "value": "1000000000000000000" - }, - "_UNISWAP_MIXED_1_ETH_FOR_DAI_V2_FIRST": { - "calldata": "0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000030b080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000100000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ea18c846eabcb202d00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f46b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000", - "value": "1000000000000000000" - }, "_UNISWAP_MIXED_1_ETH_FOR_DAI_V2_ONLY": { "calldata": "0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020b080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000003e5cc69901a0222c0200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006b175474e89094c44da98b954eedeac495271d0f", "value": "1000000000000000000" @@ -151,10 +143,6 @@ "calldata": "0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000003eb3459f0ce6ae000b00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f46b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000000000000000000000", "value": "1000000000000000000" }, - "_UNISWAP_MIXED_DAI_FOR_ETH": { - "calldata": "0x24856bc300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000308000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000003635c9adc5dea00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000acc47d3615931ec", - "value": "0" - }, "_UNISWAP_SPLIT_TWO_ROUTES_ETH_TO_USDC": { "calldata": "0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000050b08000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000004600000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000029a2241af62c0000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000000000000000000000ceebdd6e", "value": "3000000000000000000" @@ -170,5 +158,41 @@ "MIGRATE_WITHOUT_PERMIT": { "calldata": "0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002121300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000002a4ac9650d80000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a40c49ccbe00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084fc6f786500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000048d1c09771bb87b6a44e1294769e1dfd69858400000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002442966c68000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000524dd46508f0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000050209091919000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000000000000000000000000000000000000000000000", "value": "0" + }, + "_UNISWAP_MIXED_1_ETH_FOR_DAI": { + "calldata": "0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000030b000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000ae461ca67b15dc8dc81ce7615e0320da1a9ab8d50000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e6e6bec160b0fe3f600000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006b175474e89094c44da98b954eedeac495271d0f", + "value": "1000000000000000000" + }, + "_UNISWAP_MIXED_1_ETH_FOR_DAI_V2_FIRST": { + "calldata": "0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000030b080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000100000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ea18c846eabcb202d00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f46b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000", + "value": "1000000000000000000" + }, + "_UNISWAP_MIXED_DAI_FOR_ETH": { + "calldata": "0x24856bc300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000308000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000003635c9adc5dea00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000acc47d3615931ec", + "value": "0" + }, + "_UNISWAP_MIXED_USDC_DAI_UNWRAP_WETH_V3_TO_V4": { + "calldata": "0x24856bc3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003000c10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000309051200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ac7ed2380c87f8e000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000000000000000000", + "value": "0" + }, + "_UNISWAP_MIXED_USDC_DAI_UNWRAP_WETH_V2_TO_V4": { + "calldata": "0x24856bc3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003080c10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000309051200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000acad8379663ef8c000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000000000000000000", + "value": "0" + }, + "_UNISWAP_MIXED_DAI_USDC_WRAP_ETH_V4_TO_V3": { + "calldata": "0x24856bc3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003100b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000309051200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000000600000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000003635c9adc5dea00000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010bb9be311e00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000", + "value": "0" + }, + "_UNISWAP_MIXED_DAI_USDC_WRAP_ETH_V4_TO_V2": { + "calldata": "0x24856bc3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003100b08000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000309051200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000000600000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000003635c9adc5dea00000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001049ea901be00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "value": "0" + }, + "_UNISWAP_V4_1_ETH_FOR_USDC_WITH_WRAP": { + "calldata": "0x24856bc300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003050912000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000d2d62035241defd00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000000000000000000", + "value": "1000000000000000000" + }, + "_UNISWAP_V4_USDC_FOR_1_ETH_2_HOP_WITH_WETH_FEE": { + "calldata": "0x24856bc3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003100604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000030709120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000e9bb2d80e8435e5000000000000000000000000000000000000000000000000102a78813767ff57000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "value": "0" } } diff --git a/sdks/universal-router-sdk/test/forge/utils/DeployRouter.sol b/sdks/universal-router-sdk/test/forge/utils/DeployRouter.sol index 0d0e20aa9..6bd33c726 100644 --- a/sdks/universal-router-sdk/test/forge/utils/DeployRouter.sol +++ b/sdks/universal-router-sdk/test/forge/utils/DeployRouter.sol @@ -98,6 +98,7 @@ contract DeployRouter is Test { abi.encode( [ PoolKey(eth, usdc, 3000, 60, IHooks(address(0))), + PoolKey(eth, dai, 3000, 60, IHooks(address(0))), PoolKey(dai, usdc, 3000, 60, IHooks(address(0))), PoolKey(usdc, weth, 3000, 60, IHooks(address(0))) ] @@ -106,13 +107,13 @@ contract DeployRouter is Test { } function unlockCallback(bytes calldata data) external returns (bytes memory) { - PoolKey[3] memory poolKeys = abi.decode(data, (PoolKey[3])); + PoolKey[4] memory poolKeys = abi.decode(data, (PoolKey[4])); for (uint256 i = 0; i < poolKeys.length; i++) { PoolKey memory poolKey = poolKeys[i]; poolManager.initialize(poolKey, 79228162514264337593543950336, bytes("")); - (BalanceDelta delta, BalanceDelta feesAccrued) = poolManager.modifyLiquidity( + (BalanceDelta delta,) = poolManager.modifyLiquidity( poolKey, IPoolManager.ModifyLiquidityParams({ tickLower: -60, diff --git a/sdks/universal-router-sdk/test/uniswapTrades.test.ts b/sdks/universal-router-sdk/test/uniswapTrades.test.ts index 6f68a3dbc..5a928d257 100644 --- a/sdks/universal-router-sdk/test/uniswapTrades.test.ts +++ b/sdks/universal-router-sdk/test/uniswapTrades.test.ts @@ -63,6 +63,8 @@ describe('Uniswap', () => { let WETH_USDC_V3: V3Pool let WETH_USDC_V3_LOW_FEE: V3Pool let USDC_DAI_V3: V3Pool + + let ETH_DAI_V4: V4Pool let ETH_USDC_V4: V4Pool let WETH_USDC_V4: V4Pool let USDC_DAI_V4: V4Pool @@ -122,6 +124,18 @@ describe('Uniswap', () => { 0, tickProviderMock ) + + ETH_DAI_V4 = new V4Pool( + DAI, + ETHER, + 3_000, + tickSpacing, + ZERO_ADDRESS, + encodeSqrtRatioX96(1, 1), + liquidity, + 0, + tickProviderMock + ) }) describe('v2', () => { @@ -553,19 +567,18 @@ describe('Uniswap', () => { expect(hexToDecimalString(methodParameters.value)).to.eq(inputEther) }) - // this test needs v4-sdk 1.6.3 to merge - // it('encodes a single exactInput ETH->USDC swap, via WETH', async () => { - // const inputEther = utils.parseEther('1').toString() - // const trade = await V4Trade.fromRoute( - // new V4Route([WETH_USDC_V4], ETHER, USDC), - // CurrencyAmount.fromRawAmount(ETHER, inputEther), - // TradeType.EXACT_INPUT - // ) - // const opts = swapOptions({}) - // const methodParameters = SwapRouter.swapCallParameters(buildTrade([trade]), opts) - // registerFixture('_UNISWAP_V4_1_ETH_FOR_USDC_WITH_WRAP', methodParameters) - // expect(hexToDecimalString(methodParameters.value)).to.eq(inputEther) - // }) + it('encodes a single exactInput ETH->USDC swap, via WETH', async () => { + const inputEther = utils.parseEther('1').toString() + const trade = await V4Trade.fromRoute( + new V4Route([WETH_USDC_V4], ETHER, USDC), + CurrencyAmount.fromRawAmount(ETHER, inputEther), + TradeType.EXACT_INPUT + ) + const opts = swapOptions({}) + const methodParameters = SwapRouter.swapCallParameters(buildTrade([trade]), opts) + registerFixture('_UNISWAP_V4_1_ETH_FOR_USDC_WITH_WRAP', methodParameters) + expect(hexToDecimalString(methodParameters.value)).to.eq(inputEther) + }) it('encodes a single exactInput ETH->USDC swap, with a fee', async () => { const inputEther = utils.parseEther('1').toString() @@ -634,16 +647,14 @@ describe('Uniswap', () => { expect(hexToDecimalString(methodParameters.value)).to.equal('0') }) - it.skip('encodes an exactOutput DAI->USDC->ETH swap, with WETH fee', async () => { - // "exact output" of 1ETH. We must adjust for a 5% fee - // v4-sdk 1.6.3 needed + it('encodes an exactOutput DAI->USDC->ETH swap, with WETH fee', async () => { const outputEther = utils.parseEther('1') const adjustedOutputEther = outputEther .mul(10000) .div(10000 - 500) .toString() const trade = await V4Trade.fromRoute( - new V4Route([USDC_DAI_V4, WETH_USDC_V4], DAI, ETHER), + new V4Route([USDC_DAI_V4, ETH_DAI_V4], USDC, ETHER), CurrencyAmount.fromRawAmount(ETHER, adjustedOutputEther), TradeType.EXACT_OUTPUT ) @@ -651,8 +662,8 @@ describe('Uniswap', () => { const opts = swapOptions({ fee: feeOptions }) buildTrade([trade]) const methodParameters = SwapRouter.swapCallParameters(buildTrade([trade]), opts) - // registerFixture('_UNISWAP_V4_DAI_FOR_1_ETH_2_HOP_WITH_WETH_FEE', methodParameters) - // expect(hexToDecimalString(methodParameters.value)).to.equal('0') + registerFixture('_UNISWAP_V4_USDC_FOR_1_ETH_2_HOP_WITH_WETH_FEE', methodParameters) + expect(hexToDecimalString(methodParameters.value)).to.equal('0') }) }) @@ -721,6 +732,59 @@ describe('Uniswap', () => { registerFixture('_UNISWAP_MIXED_DAI_FOR_ETH', methodParameters) expect(hexToDecimalString(methodParameters.value)).to.eq('0') }) + + it('encodes a mixed exactInput v3USDC-WETH->v4ETH->DAI', async () => { + const inputUSDC = utils.parseUnits('1000', 6).toString() + const trade = await MixedRouteTrade.fromRoute( + new MixedRouteSDK([WETH_USDC_V3, ETH_DAI_V4], USDC, DAI), + CurrencyAmount.fromRawAmount(USDC, inputUSDC), + TradeType.EXACT_INPUT + ) + const opts = swapOptions({}) + const methodParameters = SwapRouter.swapCallParameters(buildTrade([trade]), opts) + registerFixture('_UNISWAP_MIXED_USDC_DAI_UNWRAP_WETH_V3_TO_V4', methodParameters) + expect(hexToDecimalString(methodParameters.value)).to.eq('0') + }) + + it('encodes a mixed exactInput v2USDC-WETH->v4ETH->DAI', async () => { + const inputUSDC = utils.parseUnits('1000', 6).toString() + const trade = await MixedRouteTrade.fromRoute( + new MixedRouteSDK([WETH_USDC_V2, ETH_DAI_V4], USDC, DAI), + CurrencyAmount.fromRawAmount(USDC, inputUSDC), + TradeType.EXACT_INPUT + ) + + const opts = swapOptions({ slippageTolerance: new Percent(5, 100) }) + const methodParameters = SwapRouter.swapCallParameters(buildTrade([trade]), opts) + registerFixture('_UNISWAP_MIXED_USDC_DAI_UNWRAP_WETH_V2_TO_V4', methodParameters) + expect(hexToDecimalString(methodParameters.value)).to.eq('0') + }) + + it('encodes a mixed exactInput v4DAI->ETH->V3WETH->USDC', async () => { + const inputDAI = utils.parseEther('1000').toString() + const trade = await MixedRouteTrade.fromRoute( + new MixedRouteSDK([ETH_DAI_V4, WETH_USDC_V3], DAI, USDC), + CurrencyAmount.fromRawAmount(DAI, inputDAI), + TradeType.EXACT_INPUT + ) + const opts = swapOptions({}) + const methodParameters = SwapRouter.swapCallParameters(buildTrade([trade]), opts) + registerFixture('_UNISWAP_MIXED_DAI_USDC_WRAP_ETH_V4_TO_V3', methodParameters) + expect(hexToDecimalString(methodParameters.value)).to.eq('0') + }) + + it('encodes a mixed exactInput v4DAI->ETH->V2WETH->USDC', async () => { + const inputDAI = utils.parseEther('1000').toString() + const trade = await MixedRouteTrade.fromRoute( + new MixedRouteSDK([ETH_DAI_V4, WETH_USDC_V2], DAI, USDC), + CurrencyAmount.fromRawAmount(DAI, inputDAI), + TradeType.EXACT_INPUT + ) + const opts = swapOptions({}) + const methodParameters = SwapRouter.swapCallParameters(buildTrade([trade]), opts) + registerFixture('_UNISWAP_MIXED_DAI_USDC_WRAP_ETH_V4_TO_V2', methodParameters) + expect(hexToDecimalString(methodParameters.value)).to.eq('0') + }) }) describe('multi-route', async () => { diff --git a/yarn.lock b/yarn.lock index c0dac7831..9b1d61507 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4609,17 +4609,17 @@ __metadata: languageName: unknown linkType: soft -"@uniswap/router-sdk@npm:^1.14.0": - version: 1.14.0 - resolution: "@uniswap/router-sdk@npm:1.14.0" +"@uniswap/router-sdk@npm:^1.14.2": + version: 1.14.2 + resolution: "@uniswap/router-sdk@npm:1.14.2" dependencies: "@ethersproject/abi": ^5.5.0 "@uniswap/sdk-core": ^5.8.0 "@uniswap/swap-router-contracts": ^1.3.0 "@uniswap/v2-sdk": ^4.6.0 "@uniswap/v3-sdk": ^3.17.0 - "@uniswap/v4-sdk": ^1.6.0 - checksum: 42da8cc814dee8d15685d78fe7c19348598166817d6bd0b1355c1b196489dfb88b51d0d59da5511538d845909ab47c520b76e53d4867545ac2633ece96d33b67 + "@uniswap/v4-sdk": ^1.9.0 + checksum: 2e4ff16421c02c40462c2082df2eb293724258b31dc9c8b4164880fc80f77de2357c1a38a2241f4c50f8d1fc6de36a244067d444f2507806d266818f82f93215 languageName: node linkType: hard @@ -4730,7 +4730,7 @@ __metadata: "@types/node": ^18.7.16 "@types/node-fetch": ^2.6.2 "@uniswap/permit2-sdk": ^1.3.0 - "@uniswap/router-sdk": ^1.14.0 + "@uniswap/router-sdk": ^1.14.2 "@uniswap/sdk-core": ^5.8.0 "@uniswap/universal-router": 2.0.0-beta.1 "@uniswap/v2-core": ^1.0.1 @@ -4890,7 +4890,7 @@ __metadata: languageName: node linkType: hard -"@uniswap/v4-sdk@npm:^1.10.0, @uniswap/v4-sdk@npm:^1.6.0, @uniswap/v4-sdk@npm:^1.9.0": +"@uniswap/v4-sdk@npm:^1.10.0, @uniswap/v4-sdk@npm:^1.9.0": version: 1.10.0 resolution: "@uniswap/v4-sdk@npm:1.10.0" dependencies: