MetaMask / MetaMask/metamask-extension
[Bug]: Swap - Autoselected quote with 99% price impact instead of selecting quotes with 0% price impact when swapping mUSD
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
### Describe the bug
Autoselected quote with 99% price impact instead of selecting quotes with 0% price impact.
This leads to loose all the assets in the Swap if proceed.
This seems to happen when Swapping from stable coin mUSD to regular asset (ie ETH)
### Expected behavior
We shouldn't autoselect 99% price impact quotes, if there are others which has almost 0% price impact
### Screenshots/Recordings
https://github.com/user-attachments/assets/bf5fd18f-df44-4e93-9e77-6714daa3a65c
### Steps to reproduce
1. Click Swap
2. Select source token mUSD
3. Select destination token ETH
4. Add any amount
5. See selected quote has very high price impact, whereas other quotes in the list have no price impact
### Error messages or log output
```shell
```
### Where was this bug found?
Internal release testing
### Version
13.34.0
### Build type
None
### Browser
Chrome
### Operating system
MacOS
### Hardware wallet
_No response_
### Additional context
_No response_
### Severity
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Swap flow in Chrome with mUSD as the source token and ETH as the destination, using version 13.34.0, then inspect the quote-selection entry point. Confirm the fix by ensuring the autoselected quote does not have 99% price impact when another available quote is near 0%.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100