From 265f327239b9bc9ec9fde95b6dbe9af4edacd6c5 Mon Sep 17 00:00:00 2001 From: Eric Zhong Date: Wed, 20 Mar 2024 13:14:43 -0400 Subject: [PATCH] prettier fix --- src/entities/protocols/uniswap.ts | 9 ++++++++- src/utils/routerTradeAdapter.ts | 12 ++++++++++-- test/forge/interop.json | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/entities/protocols/uniswap.ts b/src/entities/protocols/uniswap.ts index 946f01a2..f31a20ec 100644 --- a/src/entities/protocols/uniswap.ts +++ b/src/entities/protocols/uniswap.ts @@ -54,7 +54,7 @@ export class UniswapTrade implements Command { } encode(planner: RoutePlanner, _config: TradeConfig): void { - if(this.options.payerIsUser === undefined) { + if (this.options.payerIsUser === undefined) { // default to user as payer Object.assign(this.options, { payerIsUser: true }) } @@ -177,6 +177,13 @@ function addV2Swap( tradeType ) + console.log( + 'ur-sdk', + options.slippageTolerance.toFixed(), + options.slippageTolerance.isPercent, + options.slippageTolerance + ) + if (tradeType == TradeType.EXACT_INPUT) { planner.addCommand(CommandType.V2_SWAP_EXACT_IN, [ // if native, we have to unwrap so keep in the router for now diff --git a/src/utils/routerTradeAdapter.ts b/src/utils/routerTradeAdapter.ts index fd5543a7..935e789b 100644 --- a/src/utils/routerTradeAdapter.ts +++ b/src/utils/routerTradeAdapter.ts @@ -110,10 +110,18 @@ export class RouterTradeAdapter { return { routev3: isOnlyV3 - ? new V3Route((subRoute as V3PoolInRoute[]).map(RouterTradeAdapter.toPool), parsedCurrencyIn, parsedCurrencyOut) + ? new V3Route( + (subRoute as V3PoolInRoute[]).map(RouterTradeAdapter.toPool), + parsedCurrencyIn, + parsedCurrencyOut + ) : null, routev2: isOnlyV2 - ? new V2Route((subRoute as V2PoolInRoute[]).map(RouterTradeAdapter.toPair), parsedCurrencyIn, parsedCurrencyOut) + ? new V2Route( + (subRoute as V2PoolInRoute[]).map(RouterTradeAdapter.toPair), + parsedCurrencyIn, + parsedCurrencyOut + ) : null, mixedRoute: !isOnlyV3 && !isOnlyV2 diff --git a/test/forge/interop.json b/test/forge/interop.json index 0bc773c9..d4c1e555 100644 --- a/test/forge/interop.json +++ b/test/forge/interop.json @@ -247,4 +247,4 @@ "calldata": "0x24856bc30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000030b000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000003eb3459f0ce6ae000b00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f46b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000000000000000000", "value": "1000000000000000000" } -} \ No newline at end of file +}