GMX has a requirement that the mark price must move by more than 1.5% for a position to be closed in profit, this currently applies only for the first 3 hours after a position is created or increased.
This requirement has been one of the largest pain points for users and can be confusing as it is not a common requirement.
The reason for this requirement was to prevent front-running issues, mainly, because the on-chain price is used when opening and closing a position, there can be a slight delay between when the price of a token changes on other exchanges and when this price is broadcasted on-chain. If there is a difference in exchange prices and the price on GMX, then bots or traders can use that to enter either a long or short position at a more favourable price and increase their chances of profit.
An alternative to the minimum price movement rule would be to enforce a delay between a user’s intention to open a position and when the position is actually opened. For example:
- User sends a transaction to open a long position
- 1 second passes
- The long position is opened with the current token price
This solution was suggested by the community earlier on, but we felt we did not have enough data to be sure that this measure would be sufficient to protect liquidity providers from bots.
After analysing prices and tracking the statistics of other platforms, we feel confident enough to attempt this switch to a time delay flow.
The updated flow would be like the following:
- A user will send their intention to open a position on-chain, either to long or short
- The position will be in a pending state
- There will be two roles: keepers and signers
- Keepers will monitor blockchain logs for the intention to open positions
- If the log signalling to open a position is more than 5 seconds ago, the keeper will make a request to signers
- Signers receive the request from keepers, validates that the position is not older than e.g. 30 seconds, fetches the median price of exchanges, signs the position and the median price, then returns the signature and median price to the keeper
- After a keeper gathers at least 3 signatures, it will include these signatures and the prices then execute the position
- If the position is not older than 30 seconds and the median price provided by the 3 signers is within the acceptable slippage then the position will be confirmed with the entry price as the included median price, otherwise, the collateral will be sent back to the user
- Orders will also have this requirement so that it cannot be used to skip the 1 second delay
The delay will be 1 second at the start but may be adjusted between 1-5 seconds in case we notice any harmful bot activity, we will post an update if the delay is going to be changed.
Keepers and signers will be run by the team and advisors for a start, as we work on improving things, we can make it based on community votes and require explicit staking of GMX tokens to run keepers and signers.
The drawbacks of this are that in times of high volatility, it might be difficult to open a position within the specified slippage, but we believe that 5 seconds should be an acceptable amount of delay and the trade-off to remove the 1.5% rule is worth it.
These changes can be implemented without requiring a migration.