MetaMask / MetaMask/metamask-extension
[Bug]: SL & TP percentages change when changing leverage
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
When opening a position with **Auto Close** enabled, setting **15% Take Profit** and **15% Stop Loss**, and then changing the **leverage**, the SL & TP percentages change unexpectedly. The values should remain fixed at what the user set regardless of leverage adjustments.
### Expected behavior
The Stop Loss and Take Profit percentages set by the user should remain unchanged when the leverage is modified. Only the corresponding price levels should recalculate, not the user-defined percentages.
### Screenshots/Recordings
https://www.loom.com/share/7cf23eab66af4629834094da78ca5917
### Steps to reproduce
1. Open MetaMask Extension
2. Navigate to **Perps** and open a new position
3. Enable **Auto Close**
4. Set **Take Profit to 15%** and **Stop Loss to 15%**
5. Change the **leverage**
6. Observe that the SL & TP percentages change
### Error messages or log output
_No error message displayed._
### Where was this bug found?
Internal release testing
### Version
13.37.0
### Build type
_No response_
### Browser
Chrome
### Operating system
MacOS
### Hardware wallet
_No response_
### Additional context
- Team: Perps
### Severity
_To be filled by internal support / PM_
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 issue in the MetaMask Extension Perps flow using the listed steps, focusing on Auto Close while changing leverage. Trace the position form's Stop Loss and Take Profit handling and verify that the user-entered percentages remain unchanged while only the corresponding price levels recalculate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100