Skip to content

Conversation

@matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Jan 20, 2026

Explanation

  • What is the current state of things and why does it need to change?
    Previously, the TransactionPayController used a single, global slippage value configured via the slippage feature flag or a static default. This lacked the granularity to set different slippage tolerances for specific tokens or chains, which may be necessary due to varying liquidity or volatility.

  • What is the solution your changes offer and how does it work?
    This PR introduces a new slippageTokens feature flag, allowing slippage values to be defined per chain ID and token address. A new getSlippage utility function has been added to feature-flags that retrieves the most specific slippage value:

    1. Token-specific slippage (from slippageTokens)
    2. General slippage (from the slippage feature flag)
    3. A static default (0.005)

    The relay-quotes strategy has been updated to use this new getSlippage utility.

  • Are there any changes whose purpose might not obvious to those unfamiliar with the domain?
    The lookup for both chain ID and token address within the slippageTokens feature flag and the getSlippage utility is case-insensitive to ensure flexibility in configuration.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Open in Cursor Open in Web


Note

Adds configurable, token-specific slippage to Transaction Pay.

  • New slippageTokens feature flag and getSlippage(messenger, chainId, tokenAddress) utility with case-insensitive lookups and fallback to general slippage then DEFAULT_SLIPPAGE
  • Relay strategy (relay-quotes.ts) now derives slippageTolerance from getSlippage instead of global flag
  • Expanded tests for feature flags and Relay quotes to cover token-specific slippage behavior
  • Updated CHANGELOG.md to document the new flag

Written by Cursor Bugbot for commit b510cfa. This will update automatically on new commits. Configure here.

… token-specific slippage

- Add slippageTokens type to FeatureFlagsRaw (keyed by chain ID then token)
- Add getSlippage util function with case-insensitive lookup
- Fallback chain: token-specific -> slippage flag -> DEFAULT_SLIPPAGE
- Update relay-quotes to use getSlippage with source chain and token
- Add comprehensive tests for getSlippage function

Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
@cursor
Copy link

cursor bot commented Jan 20, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

cursoragent and others added 4 commits January 20, 2026 11:21
Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
Co-authored-by: matthew.walsh <matthew.walsh@consensys.net>
@matthewwalsh0 matthewwalsh0 changed the title Slippage tokens feature flag feat(transaction-pay-controller): slippage tokens feature flag Jan 21, 2026
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review January 21, 2026 11:44
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners January 21, 2026 11:44
@matthewwalsh0 matthewwalsh0 added this pull request to the merge queue Jan 21, 2026
Merged via the queue into main with commit 76c22de Jan 21, 2026
300 checks passed
@matthewwalsh0 matthewwalsh0 deleted the cursor/slippage-tokens-feature-flag-7579 branch January 21, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants