Skip to content

Commit

Permalink
Merge pull request #338 from invariant-labs/staging
Browse files Browse the repository at this point in the history
update Prod
  • Loading branch information
p6te authored Oct 3, 2024
2 parents b2291a7 + 5762bc3 commit 64cb913
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/Swap/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ export const Swap: React.FC<ISwap> = ({

onSwap(
simulateResult.poolKey,
BigInt((+slippTolerance * Number(PERCENTAGE_DENOMINATOR)) / 100),
BigInt(Math.round((+slippTolerance * Number(PERCENTAGE_DENOMINATOR)) / 100)),
simulateResult.targetSqrtPrice,
tokenFrom,
tokenTo,
Expand Down Expand Up @@ -777,7 +777,7 @@ export const Swap: React.FC<ISwap> = ({

onSwap(
simulateResult.poolKey,
BigInt((+slippTolerance * Number(PERCENTAGE_DENOMINATOR)) / 100),
BigInt(Math.round((+slippTolerance * Number(PERCENTAGE_DENOMINATOR)) / 100)),
simulateResult.targetSqrtPrice,
tokenFrom,
tokenTo,
Expand Down
5 changes: 2 additions & 3 deletions src/store/sagas/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export function* handleGetSimulateResult(action: PayloadAction<Simulate>) {
byAmountIn,
xToY ? MIN_SQRT_PRICE : MAX_SQRT_PRICE
)
console.log(result)

if (result.maxSwapStepsReached || result.globalInsufficientLiquidity) {
if (
byAmountIn
Expand All @@ -312,7 +312,6 @@ export function* handleGetSimulateResult(action: PayloadAction<Simulate>) {
) {
insufficientLiquidityAmountOut = byAmountIn ? result.amountOut : result.amountIn
fee = pool.poolKey.feeTier.fee
priceImpact = 1
errors.push(SwapError.MaxSwapStepsReached)
}

Expand Down Expand Up @@ -351,7 +350,7 @@ export function* handleGetSimulateResult(action: PayloadAction<Simulate>) {
actions.setSimulateResult({
poolKey: swapPossible ? poolKey : null,
amountOut: validatedAmountOut,
priceImpact,
priceImpact: swapPossible ? priceImpact : 1,
targetSqrtPrice,
fee,
errors
Expand Down

0 comments on commit 64cb913

Please sign in to comment.