Skip to content

Commit

Permalink
adjustments to reflect uniswap default slippage tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
krisbitney committed Jan 5, 2024
1 parent e24a890 commit 2fb34b3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/app/src/hooks/useSwapRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function useSwapRoute(
currencyIn: string,
decimalAmountIn: number,
duration: number,
slippageTolerance: Percent = new Percent(3, 100)
slippageTolerance: Percent = new Percent(50, 10_000)
): {
path?: string;
quote?: Decimal;
Expand Down Expand Up @@ -83,8 +83,9 @@ export function useSwapRoute(
const path = encodeRouteToPath(route.route[0].route as V3Route, false);
const quote = new Decimal(route.quote.toFixed(18));
// TODO: use commented out values when https://github.com/Uniswap/sdk-core/issues/20 is resolved by https://github.com/Uniswap/sdk-core/pull/69
const rawMinimumAmountOut = route.quoteGasAdjusted?.numerator.toString(); // route.trade.minimumAmountOut(slippageTolerance).numerator.toString();
const priceImpact = new Decimal(0.05); // new Decimal(route.trade.priceImpact.toFixed(4));
const rawMinimumAmountOut =
route.quoteGasAndPortionAdjusted?.numerator.toString() ?? route.quoteGasAdjusted.numerator.toString(); // route.trade.minimumAmountOut(slippageTolerance).numerator.toString();
const priceImpact = new Decimal(0.005); // new Decimal(route.trade.priceImpact.toFixed(4));
return { path, quote, rawMinimumAmountOut, priceImpact, status: SwapRouteState.READY };
}
}

0 comments on commit 2fb34b3

Please sign in to comment.