The GMX Unstaking Leech

polarply
2 min readSep 28, 2022

GMX is a decentralized perpetual exchange, an important service for crypto trading.

As part of its platform, GMX allows their native token, GMX, to be staked to receive ETH from a pool consisting of 30% of trading fees generated by the exchange. Currently the default APY is projected at ~18%.

As part of their tokenomics, staked coins accrue bonus APY:
When you stake GMX, you receive Multiplier Points every second at a fixed rate of 100% APR.

That means 1000 GMX staked for one year would earn 1000 Multiplier Points, so within a year it is as if you would stake 2000 GMX.

However, to disincentivize unstaking, users that unstake have their bonus burned.

When a user unstakes they are presented with 3 options: stake again starting with 0 bonus, just hold, or sell their coins. The first option is improbable, and the 2nd option also sounds unlikely. From a naive user’s perspective, why not postpone burning the bonus and stake some more until they really want to sell?
Therefore we can deduce that should a user unstake, it is very probable they will proceed to sell their coins.

I checked the Arbitrum blockchain and analyzed users’ actions after unstaking and found that as burned APY is higher, so is the user’s chance to sell their coins right after:

That is, for a user with burned APY higher than 60%, there’s a >70% chance of selling the coins within 5 minutes of unstaking.

Using this information one could build a probabilistic sandwich bot.. except I found there already is one!

This MeV strategy sandwiches high volume unstaking actions, selling right after they unstake and buying back after they sell.

Using this strategy they’ve generated 55 GMX (2270$) in 45 days.

Example:

A. User 0xd33 unstakes 5,124 GMX ($212,600)
B. 1 seconds later: MeV bot sells 399.00 GMX ($16,550)
C. 8 minutes later: User 0xd33 sells their 5,124 GMX on Uniswap
D. 15 minutes later: MeV bot buys back 400.43 GMX for the same price ($16,550)

This strategy is probabilistically profitable as can be seen by the unstaking probability graph shown above, and is most efficient with large unstakers as they create the largest sandwich opportunity.

While now this problem is minor, should GMX be more widely adopted these attacks may become more common and extract higher value.

--

--