Skip to content

Liquidity: use the user's slippage setting for mint, increase and remove - #422

Merged
rroland10 merged 1 commit into
masterfrom
fix/bounty-47-liquidity-slippage
Nov 7, 2026
Merged

rroland10 merged 1 commit into
masterfrom
fix/bounty-47-liquidity-slippage

Conversation

@rroland10

@rroland10 rroland10 commented Nov 7, 2026 •

Copy link
Copy Markdown

Problem

Reported in rroland10/dex223-bug-bounty#47. The add-liquidity hook read slippage from the liquidity transaction settings store and then ignored it: amount0Min / amount1Min for mint, increaseLiquidity and createAndInitializePoolIfNecessary + mint were always built with a module constant new Percent(2, 100). A user who set 0.1% still got 2%. The remove-liquidity hook (decreaseLiquidity) had the same hardcoded 2% and did not read the setting at all.

Change

  • add/hooks/useAddLiquidity.ts: mintAmountsWithSlippage(slippageToPercent(slippage)); slippage added to the memo dependencies; the 2% constant removed.
  • remove/[tokenId]/hooks/useRemoveLiquidity.ts: reads slippage from the same store and uses burnAmountsWithSlippage(slippageToPercent(slippage)).

slippageToPercent is the helper the swap flow already uses (basis-point rounding, no BigInt throw on values like 1.1%). The store already clamps the value to (0, 50] on write and on rehydrate. No UI or layout change.

Verification

  • tsc --noEmit: no errors in the changed files (local run used borrowed node_modules missing the chart deps, so only trading-chart errors appeared; CI installs fresh).
  • eslint (import order fixed) and prettier clean on both files; tests/swapReceipt.test.cjs passes.

Open

  • Default slippage is 0.5%, so mints with the default setting now use tighter minimums than the old 2%. On volatile pairs a user may see more "Price slippage check" reverts and need to raise the setting; that is the intended behavior.

@vercel

vercel Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
dex223-ui-blog Ready Ready Preview Nov 7, 2026 4:20pm UTC
dex223-ui-web Ready Ready Preview Nov 7, 2026 4:20pm UTC

Request Review

This branch was successfully deployed

2 active deployments
Preview – dex223-ui-web — 8d39639f Deployed Nov 7, 2026 by vercel[bot]
Preview – dex223-ui-blog — 8d39639f Deployed Nov 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant