feat(transaction-pay-controller): slippage tokens feature flag #7673
+260
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
What is the current state of things and why does it need to change?
Previously, the
TransactionPayControllerused a single, global slippage value configured via theslippagefeature 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
slippageTokensfeature flag, allowing slippage values to be defined per chain ID and token address. A newgetSlippageutility function has been added tofeature-flagsthat retrieves the most specific slippage value:slippageTokens)slippagefeature flag)The
relay-quotesstrategy has been updated to use this newgetSlippageutility.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
slippageTokensfeature flag and thegetSlippageutility is case-insensitive to ensure flexibility in configuration.References
Checklist
Note
Adds configurable, token-specific slippage to Transaction Pay.
slippageTokensfeature flag andgetSlippage(messenger, chainId, tokenAddress)utility with case-insensitive lookups and fallback to generalslippagethenDEFAULT_SLIPPAGErelay-quotes.ts) now derivesslippageTolerancefromgetSlippageinstead of global flagCHANGELOG.mdto document the new flagWritten by Cursor Bugbot for commit b510cfa. This will update automatically on new commits. Configure here.