-
Notifications
You must be signed in to change notification settings - Fork 5.2k
feat: adds deeply liquid stablecoin slippage value of 0.5 #31744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
✨ Files requiring CODEOWNER review ✨🔄 @MetaMask/swaps-engineers
|
return false; | ||
} | ||
const lowerAddressToCheck = addressToCheck.toLowerCase(); | ||
for (const addrInSet of addressSet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking comment: Set
has O(1) lookups with set.has(...)
, if we're just iterating through it instead (O(n)), could just use a simple array.
Doesn't really matter because the list is so small though.
Builds ready [4ac9dae]
UI Startup Metrics (1212 ± 59 ms)
|
Description
Purpose:
To automatically apply a lower default slippage (0.5%) when fetching swap quotes for stablecoin pairs (like USDC/USDT), while using the user's custom setting for other pairs. This improves the swap experience for stablecoins and avoids unnecessary API calls with incorrect slippage.
Changes Made:
--- Check the from and to token addresses against the StablecoinsByChainId map for the current network using a case-insensitive comparison.
--- Determine the correct slippage (Slippage.stable or the user's maxSlippage) before dispatching the quote fetch action.
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/MMS-2169
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist