Skip to content

Commit

Permalink
need aggslippage check
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilz committed Sep 19, 2024
1 parent 0128be2 commit 6ca09e4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sdks/universal-router-sdk/src/entities/actions/uniswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,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)
addV4Swap(planner, swap, this.trade.tradeType, this.options, this.payerIsUser, routerMustCustody, performAggregatedSlippageCheck)
break
case Protocol.MIXED:
addMixedSwap(planner, swap, this.trade.tradeType, this.options, this.payerIsUser, routerMustCustody)
Expand Down Expand Up @@ -248,7 +248,8 @@ function addV4Swap<Tnput extends Currency, TOutput extends Currency>(
tradeType: TradeType,
options: SwapOptions,
payerIsUser: boolean,
routerMustCustody: boolean
routerMustCustody: boolean,
performAggregatedSlippageCheck: boolean
): void {
const trade = V4Trade.createUncheckedTrade({
route: route as RouteV4<TInput, TOutput>,
Expand All @@ -257,7 +258,8 @@ function addV4Swap<Tnput extends Currency, TOutput extends Currency>(
tradeType,
})

const v4Calldata = new V4Planner().addTrade(trade, routerMustCustody ? 0 : options.slippageTolerance).finalize()
const slippageToleranceOnSwap = performAggregatedSlippageCheck ? undefined : options.slippageTolerance
const v4Calldata = new V4Planner().addTrade(trade, slippageToleranceOnSwap).finalize()
planner.addCommand(CommandType.V4_SWAP, [v4Calldata])
}

Expand Down

0 comments on commit 6ca09e4

Please sign in to comment.