Skip to content

feat: add dynamic high-slippage warning banner with two-tier alert (Closes #111) - #136

Open
waterWang wants to merge 1 commit into
Adamantine-guild:mainfrom
waterWang:feat/high-slippage-warning-banner
Open

feat: add dynamic high-slippage warning banner with two-tier alert (Closes #111)#136
waterWang wants to merge 1 commit into
Adamantine-guild:mainfrom
waterWang:feat/high-slippage-warning-banner

Conversation

@waterWang

Copy link
Copy Markdown
Contributor

Summary

Adds a dynamic high-slippage warning banner to the slippage settings popover, implementing the requirements from issue #111.

Changes

1. Lowered warning threshold

  • Changed SLIPPAGE_WARNING_THRESHOLD from 5 to 2 — users now see a warning when slippage exceeds 2%.

2. Two-tier warning styling

  • Amber/yellow (2-10%): High slippage warning — explains MEV sandwich attack risk and poor execution prices
  • Red (>10%): Extreme slippage — high risk — warns of near-total fund loss

3. Improved warning text

  • 2-10%: "Setting slippage above 2% puts you at risk of sandwich attacks and poor execution prices. Consider a lower value."
  • 10%: "Setting slippage above 10% exposes you to extreme MEV sandwich attacks and near-total loss of funds. Consider a much lower value."

4. Tests

  • Added unit tests for the updated constants and isSlippageRisky function with the new 2% threshold

Acceptance Criteria Fulfilled

  • Warning message appears instantly when slippage > 2%
  • The warning clearly explains the risk of MEV attacks/bad execution prices
  • UI prevents confirming a slippage > 50% (already implemented)

…loses Adamantine-guild#111)

- Lower SLIPPAGE_WARNING_THRESHOLD from 5% to 2% so users are
  warned earlier about sandwich-attack risk
- Add two-tier warning styling:
  - Amber/yellow for 2-10%: 'High slippage warning'
  - Red for >10%: 'Extreme slippage — high risk'
- Improve warning text to explain MEV sandwich attack risks
  and poor execution prices
- Add unit tests for the updated constants and thresholds [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT]
@Lakes41

Lakes41 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

This PR cannot be merged automatically because it has merge conflicts.

Please update the branch with the latest base branch and resolve the conflicts.

After the conflicts are resolved and checks pass, the automation can review it again.

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.

2 participants