fix(frontend): default slippage protection to 5% (#497) #1030

Merged
PlasticDigits merged 1 commit from fix/497-default-slippage-5pct into main 2026-07-25 04:43:24 +00:00
PlasticDigits commented 2026-07-25 04:23:52 +00:00 (Migrated from gitlab.com)

Summary

  • Raise default retail Slippage protection / route-impact guard from 0.5% to 5% (DEFAULT_SLIPPAGE_TOLERANCE_PERCENT) so normal trade sizes stop tripping insufficient-liquidity warnings (#497).
  • Share Swap + Trade market presets via SLIPPAGE_TOLERANCE_PRESETS_PERCENT (0.5 / 1 / 5) and keep the high-protection warn only for values strictly above 5%.
  • Document invariants in docs/swap-max-spread-ux.md / docs/frontend.md and add agent playbook skills/AGENTS_FRONTEND_DEFAULT_SLIPPAGE.md.

Acceptance criteria (#497)

  • Default protection is 5% for new sessions / unset store state.
  • Insufficient liquidity warning reflects 5% unless user overrides (uses store slippageTolerance).
  • Unit / UI tests updated for the new default (constants test + Swap/Trade pre-sign confirm).

Test plan

  • npm run test:run -- src/utils/__tests__/slippageProtectionCopy.test.ts
  • npm run test:run -- src/pages/SwapPage.test.tsx -t 'shows labeled action, pair, amounts, max spread'
  • npm run test:run -- src/components/trade/__tests__/TradeMarketOrderPanel.submitSnapshot.test.tsx -t 'shows labeled pre-sign confirmation'
  • Manual: fresh / → Settings shows 5% selected; confirm summary swap-confirm-max-spread = 5%
  • Manual: Trade market preset trade-market-slippage-preset-5 active by default

Closes #497

## Summary - Raise default retail **Slippage protection** / route-impact guard from **0.5%** to **5%** (`DEFAULT_SLIPPAGE_TOLERANCE_PERCENT`) so normal trade sizes stop tripping insufficient-liquidity warnings (#497). - Share Swap + Trade market presets via `SLIPPAGE_TOLERANCE_PRESETS_PERCENT` (`0.5 / 1 / 5`) and keep the high-protection warn only for values **strictly above** 5%. - Document invariants in `docs/swap-max-spread-ux.md` / `docs/frontend.md` and add agent playbook `skills/AGENTS_FRONTEND_DEFAULT_SLIPPAGE.md`. ## Acceptance criteria (#497) - [x] Default protection is 5% for new sessions / unset store state. - [x] Insufficient liquidity warning reflects 5% unless user overrides (uses store `slippageTolerance`). - [x] Unit / UI tests updated for the new default (constants test + Swap/Trade pre-sign confirm). ## Test plan - [x] `npm run test:run -- src/utils/__tests__/slippageProtectionCopy.test.ts` - [x] `npm run test:run -- src/pages/SwapPage.test.tsx -t 'shows labeled action, pair, amounts, max spread'` - [x] `npm run test:run -- src/components/trade/__tests__/TradeMarketOrderPanel.submitSnapshot.test.tsx -t 'shows labeled pre-sign confirmation'` - [ ] Manual: fresh `/` → Settings shows **5%** selected; confirm summary `swap-confirm-max-spread` = `5%` - [ ] Manual: Trade market preset `trade-market-slippage-preset-5` active by default Closes #497
ghost1 commented 2026-07-25 04:24:38 +00:00 (Migrated from gitlab.com)

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot) to get automatic reviews on future PRs.
PlasticDigits (Migrated from gitlab.com) merged commit 6c0e51e234 into main 2026-07-25 04:43:24 +00:00
PlasticDigits commented 2026-07-25 04:43:54 +00:00 (Migrated from gitlab.com)

mentioned in commit 6c0e51e234

mentioned in commit 6c0e51e2344bd85977095ea9c20b2df05438e73e
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1030
No description provided.