Skip to content

Commit 64cb913

Browse files
authored
Merge pull request #338 from invariant-labs/staging
update Prod
2 parents b2291a7 + 5762bc3 commit 64cb913

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/components/Swap/Swap.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ export const Swap: React.FC<ISwap> = ({
748748

749749
onSwap(
750750
simulateResult.poolKey,
751-
BigInt((+slippTolerance * Number(PERCENTAGE_DENOMINATOR)) / 100),
751+
BigInt(Math.round((+slippTolerance * Number(PERCENTAGE_DENOMINATOR)) / 100)),
752752
simulateResult.targetSqrtPrice,
753753
tokenFrom,
754754
tokenTo,
@@ -777,7 +777,7 @@ export const Swap: React.FC<ISwap> = ({
777777

778778
onSwap(
779779
simulateResult.poolKey,
780-
BigInt((+slippTolerance * Number(PERCENTAGE_DENOMINATOR)) / 100),
780+
BigInt(Math.round((+slippTolerance * Number(PERCENTAGE_DENOMINATOR)) / 100)),
781781
simulateResult.targetSqrtPrice,
782782
tokenFrom,
783783
tokenTo,

src/store/sagas/swap.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ export function* handleGetSimulateResult(action: PayloadAction<Simulate>) {
303303
byAmountIn,
304304
xToY ? MIN_SQRT_PRICE : MAX_SQRT_PRICE
305305
)
306-
console.log(result)
306+
307307
if (result.maxSwapStepsReached || result.globalInsufficientLiquidity) {
308308
if (
309309
byAmountIn
@@ -312,7 +312,6 @@ export function* handleGetSimulateResult(action: PayloadAction<Simulate>) {
312312
) {
313313
insufficientLiquidityAmountOut = byAmountIn ? result.amountOut : result.amountIn
314314
fee = pool.poolKey.feeTier.fee
315-
priceImpact = 1
316315
errors.push(SwapError.MaxSwapStepsReached)
317316
}
318317

@@ -351,7 +350,7 @@ export function* handleGetSimulateResult(action: PayloadAction<Simulate>) {
351350
actions.setSimulateResult({
352351
poolKey: swapPossible ? poolKey : null,
353352
amountOut: validatedAmountOut,
354-
priceImpact,
353+
priceImpact: swapPossible ? priceImpact : 1,
355354
targetSqrtPrice,
356355
fee,
357356
errors

0 commit comments

Comments
 (0)