Overview

GMX is a decentralized perpetual and spot exchange protocol currently on Arbitrum and Avalanche. It became popular for its unique GLP liquidity pool index, as well as for providing investors with ‘real yield’ from protocol revenue in the form of ETH and AVAX rewards.  It stands out for allowing traders to trade up to 50x leverage with zero impact on token prices and almost no slippage. This is possible thanks to its GLP, a tokenized liquidity pool with multiple assets in it.

As a decentralized and permissionless trading platform, users don’t need a username or password to open/close trades or provide liquidity. The protocol uses an aggregate price feed supported by a decentralized oracle infrastructure powered by Chainlink.

GMX originally started off as Gambit on Binance Smart Chain, before pivoting to the GMX dApp used today.  The protocol has a very engaged community which has created an NFT collection and many tools based on GMX.  There is a referral link feature, where users can earn commissions for referring others to the platform. GMX is a part of the growing DeFi derivatives sector.  They have numerous partnerships and are planning on expanding the number of chains they are deployed on, which is currently just Avalanche and Arbitrum.

The anonymous GMX team has managed to become one of the leading protocols when it comes to revenue generation, even surpassing giants like Aave, Curve, and even Bitcoin.

Its innovative trading system allows traders to rent out liquidity from the assets in the liquidity pool in such a way that liquidity providers do not suffer from impermanent loss while earning 70% of protocol fees. Because of this model, perpetuals on GMX work differently than what some traders might be used to on CEXs or even other DEXs, like Perpetual and DYDX. Since the liquidity is being rented out from the liquidity pool, traders who are going long are renting out the upside on the assets they are trading, and traders who are going short are renting out the upside on the stablecoins held by the pool. Because of that, short traders are paid in stables, and long traders are paid in the asset they are going long on. This liquidity pool is made out of multiple assets, so liquidity providers can mint or burn GLP based on whether they are depositing or withdrawing assets from the pool.

By holding GLP, you own a share of the multi-asset pool. Based on whether the assets you deposit or withdraw are balancing or imbalancing the liquidity pool, you will be charged more or less fees. GLP holders act as a counterparty to traders. When GMX traders make a profit, GLP holders make a loss, and vice versa.  Because of this reason, GLP holders are also referred to as the House or the casino, since more traders lose money on average than they earn.

When positions are opened or closed, the protocol charges a fee, on top of an additional borrow fee that is paid to the traders’ counterparty, the GLP holders. In fact, all fees generated by the exchange are distributed to GLP and GMX holders. 70% of fees go to GLP holders and are paid in ETH or AVAX based on whether the user is using GMX on the Arbitrum or Avalanche chain.  30% of fees go to GMX stakers, which are also rewarded with Escrowed GMX tokens, and multiplier points in addition to ETH and AVAX.

https%3A%2F%2Fsubstack post media.s3.amazonaws.com%2Fpublic%2Fimages%2F9c77a1bd 56dd 471c bb00

 

Why the Protocol was Created

GMX launched in September 2021 as a perpetual futures DEX where users could trade up to 50x leverage with close to 0% slippage without KYC or geographic restrictions. 

The protocol started as XVIX in November 2020 and then upgraded to Gambit on the Binance Smart Chain in March 2021. GMX was launched in September 2021 on Arbitrum and has been adding features such as smaller trading spreads, new assets added to the GLP pool, integrations with DEX aggregators such as 1inch and Paraswap, deployments on other chains like Avalanche, fee discounts, and more.

Roadmap

The Roadmap is focused on increasing trading volume and revenue from fees by:

  • Launching on new chains
  • More tradable assets
  • Better UI/UX by integrating Trading View charts
  • Derivatives instruments, specifically synthetics.

Being chain agnostic, the GMX wants to deploy on more chains to become the default multi-chain spot and perpetuals DEX.

Team

The team members are anonymous:

  • Developers: xdev_10, gdev8317, xhiroz, vipineth
    • Xhiroz manages a team of front-end developers (@midasdev on Github) and a designer.
    • Vipin is also a contributor to the user interface (GMX terminal) and statistics page.
    • Gdev implemented limit orders and contributed to the statistics page
  • Designer: xhiroz
  • Marketing and business development: Coinflipcanada, puroscohiba, bagggdad
  • Community managers: y4cards, supersonicsines

There is no official role information other than the information compiled from Discord, Medium articles, Github or Twitter.

DeFi Subsector

GMX belongs to the derivatives sector, more specifically the perpetual futures and spot trading categories. 

There is also a significant transition from CEXs to DEXs, with the top 10 DEXs increasing their quarterly volume by 441.92% from Q1 2021 to Q4 2021. For perpetual markets, the market share has increased from almost 0% to close to 3%, with DYDX still covering more than 2% of the entire perpetual exchange volume in Q4 2021. This volume is expected to increase with the adoption of L2s and the scaling solutions of alternative L1s.

GMX stands out for its composability and for having become one of the most used and built upon money legos. More than 28 projects are building on top of GMX as of Q1 2023 across a variety of categories: vaults, lending, options, social trading, and others.

  • Vaults:  Jones DAO, Rage Trade, Abracadabra, Plutus, GMD, Redacted, Vovo, Umami, Mugen, Beefy, Neutra, Olive, Yield Kak.
  • Lending: Vesta, Tender.fi, Rodeo, Sentiment, Delta Prime, Moremoney, Yeti.
  • Social trading: STFX, Perpy, Puppet.
  • Options: Dopex, Lyra.
  • Others: Mux, Demex.

Industry Overview and Potential Adoption

Mainstream adoption of GMX would turn the protocol into the go-to solution for on-chain spot and perpetuals trading. GMX revenue would be enough to attract both liquidity providers and traders. The innovation of the GMX would allow it to gain attention from both retail and institutional investors.

GMX Breakdown Perpetuals Trading

If more people using CEXs started using DEXs instead, this would help GMX. GMX could also gain more users and market share by improving UX, having a lower gas cost, and using blockchain scaling solutions.

GMX Breakdown CEX vs DEX

Currently, the market leader on decentralized perpetual exchanges is DYDX with more than $700B in volume since its launch. DYDX was launched on Starkware and is planning a future release on Cosmos. The approach of DYDX with a central limit order book allows for more complex order types by taking the tradeoff of more centralization from off-chain technology. Other competitors and forks with a similar model are Gains Network, Mycelium, Metavault Trade

GMX is different from its competitors because of its revenue sharing. GMX rewards are distributed to both liquidity providers and stakers, while other platforms like DYDX reward traders with no lockup, which leads to trading revenues per epoch netting out against trading emissions. If GMX could grow to a level where revenue is enough to sustain business operations without the need for token emissions that are used as incentives. Many people like that GMX distributes a lot of its revenue in “real yield”: in ETH or AVAX depending on whether you are using GMX on Arbitrum or Avalanche chain.

During 2022, GMX has been among the protocols that have generated more revenue from fees, even surpassing DeFi protocols like Curve, Compound, Aave, or Layer 1s like Bitcoin.

GMX Breakdown Fees

Chains

GMX is currently on Arbitrum and Avalanche and plans to deploy on other chains in the future.  In the past, the GMX team expressed some interest in redeploying on Binance Smart Chain (BSC), where the project was originally deployed, though it is unclear if there is still any interest in this.

Get a 10% discount on all trading fees at GMX by using our referral code. Click here https://app.gmx.io/ to start trading.

For Users

Target users

GMX target users are traders who want leverage and close to zero slippage trading. This is possible due to the Oracle Pricing Model used by GMX. Since there is no AMM, the GLP pool uses dynamic aggregated oracle price feeds provided by Chainlink to determine the market price of an asset. The way this works is by taking the median price of Binance, Coinbase, and Bitfinex.

Users who believe in a multichain world would benefit from GMX being on as many chains as possible.

Trading

V1

GMX Trading logic is handled by the Vault contract, which stores deposits and handles the main trading functions. 

  • Funds are deposited into the Vault by minting GLP tokens. 
    • For instance, if the price of GLP is $15, a user can mint 1 GLP by depositing $15 in USDC.
  • Funds are withdrawn from the Vault by burning GLP. 
    • For instance, if the price of GLP is $15, a user can burn 1 GLP to redeem $15 in USDC.
  • The Vault’s swap functionality enables the swapping of the tokens held in the vault. 
    • For example, if the price of ETH is $3,000 a user can swap 1 ETH for $3,000 USDC.
Opening a Position

When users open a position or deposit collateral:

  1. A snapshot of the USD price of the collateral is taken. 
  2. Traders deposit collateral into the protocol. 
  3. A snapshot of the USD value of the collateral is taken

The collateral value of such trade will not change even if the price of the token being traded changes, for example:

  • 0.1 ETH deposited as collateral at a price of $1,500 would be the equivalent of $150 and will not change even if the price of ETH changes. The amount of profit or loss will be proportional to the position size. With 5x leverage, $150 would be used to buy $750 worth of ETH.

Long ETH Example 766x1024 1

Going Long and Going Short

There are 2 trading sides, but unlike traditional margin trading platforms where users borrow assets to go short and borrow stablecoins to go long, users on GMX do the opposite: users borrow assets to go long and borrow stablecoins to go short. This means that GLP holders are renting out their exposure to traders. If traders make a profit, GLP holders incur a loss, and vice-versa.  This occurs because GLP token holders are holding a token that represents a multi-asset liquidity pool.  

  • Long position:
    • Profits when the token price goes up.
    • Loses when the token price goes down.
    • Prices are paid in the asset you are longing (e.g. if you are longing ETH you get your profits in ETH).
    • The collateral of long positions is the token being longed (e.g. ETH  is the collateral for ETH longs, WBTC is the collateral for WBTC longs…).
    • Considering the example above:
    • If the price of ETH increases by 10%, the position would be at a $75 profit.
    • If the price of ETH decreases by 10%, the position would be at a $75 loss.
  • Short position:
    • Profits when the token price goes down.
    • Losses when the token price goes up.
    • Prices are paid out in the stablecoin you used to open the position (e.g. USDC or USDT).
    • The collateral of short positions is any of the supported stablecoins (USDC, USDT, DAI, FRAX).
    • Considering the example above:
    • If the price of ETH decreases by 10%, the position would be at a $75 profit.
    • If the price of ETH increases by 10%, the position would be at a $75 loss.
Liquidations

A position can be liquidated by keepers if the losses of the trade reduce the collateral to the point where (position size / remaining collateral) is more than the max allowed leverage.

  • Partial liquidations. Users are given a liquidation price (the price at which the loss amount is very close to the collateral amount) when they deposit collateral to open positions. 
    • The liquidation price is calculated as the price at which the (collateral – losses – borrow fee) is less than 1% of the trader’s position size. 
    • Once this price level is crossed in the opposite direction, the position is automatically closed. 
    • The concept of partial liquidations is introduced to explain why the liquidation price can change over time. This is because of the presence of the borrowing fee. Because of that, if there is any collateral remaining after deducting losses and fees, then the corresponding amount would be returned to the trader’s account.

V2

As V2 is funded by the GMX Market pool mechanism, there are some differences when it comes to trading compared to V1.

Opening a Position

Selecting a Pool

Multiple pools may be available for your selected market, for example, there may be an ETH-USDC and ETH-USDT pool. You can select which pool you’d like to trade in depending on which collateral you prefer to be backing your positions.

Selecting a Collateral

Multiple types of collateral may be available for your selected market, for example, in the ETH-USDC market, you can choose whether your position’s collateral is stored as ETH or USDC. Examples of how this could be used:

  • Long ETH with ETH as collateral: You would have be long ETH from your long position as well as from your ETH collateral. It is possible to e.g. open a 0.1 ETH long position for a small amount of ETH while using 1 ETH as collateral for a total of 1.1 ETH exposure.
  • Long ETH with USDC as collateral: You would be long ETH only from your long position. This could be useful if switching frequently between longing and shorting.
  • Short ETH with ETH as collateral: This could be useful for delta neutral strategies to earn funding fees. For example, if funding is such that longs pay shorts, then a 1 ETH short position could be opened with 1 ETH as collateral.
  • Short ETH with USDC as collateral: This could be useful if switching frequently between longing and shorting.
  • Note that if opening a long position with a non-stablecoin as collateral, your liquidation price may change as the price of your collateral changes.
Market Types and ADL (Auto-Deleveraging)

There are 2 types of markets possible in V2.

  • Fully backed markets
    • An example of a fully back market would be an $ETH perp market backed by ETH-USDC where the open interest is limited to be less than the total amount of $ETH and $USDC tokens in the pool.
    • For example, if there is 1000 $ETH and 1 million $USDC in the pool and the max long open interest is limited to 900 $ETH and the max short open interest is limited to be 900k $USDC, then all profits can always be fully backed regardless of the price of $ETH.
  • Synthetic markets
    • An example of a synthetic market would be a $DOGE perp market backed by ETH-USDC. While the max long open interest could be limited to a fraction of the amount of $ETH tokens, it may be possible for the profits of long positions to exceed the worth of the tokens in the pool.
    • For example, if there is 1000 $ETH and 1 million $USDC in the pool and the max long $DOGE open interest is limited to 300 $ETH, but the price of $DOGE increases 10x while the price of ETH increases only by 2x, in this case the pending profits would exceed the worth of the ETH in the pool.
    • To avoid this scenario, ADL  may take place. When the pending profits exceed the market’s configured threshold, profitable positions may be partially or fully closed. This helps to ensure that markets are always solvent and all profits at the time of closing can be fully paid.

 

Things to Keep in Mind When Trading

  • There is no price impact for trades. Since the protocol itself acts as the counterparty via GLP providing liquidity, there is only a small spread for entering and exiting trades, which makes GMX great for executing large trades. 

GMX Breakdown

  • Long positions are opened at a higher price and closed at a lower price.
  • Short positions are opened at a lower price and closed at a higher price.
  • There can be slippage due to price movements when the trade transaction is submitted and when it is confirmed on the blockchain. On GMX, slippage is the difference between the expected price of the trade and the execution price.
  • When depositing collateral for opening a long position, there is a 0.3% swap fee. This is charged due to the conversion of the asset to its USD value. This prevents deposits from being used as a zero-fee swap. This is not applicable to short positions. Withdrawing collateral from longs or shorts does not have this fee either.
  • GMX supports trigger orders such as stop-loss and take-profit orders. If a position is closed manually after a trigger order has been set, the associated trigger orders will remain open. If the user does not want the order to be active when a future position is opened, the user must manually cancel the limit order (stop-loss or take-profit).
  • Limit orders are not guaranteed to go through. This can occur when:
    • The mark price (an aggregate of exchange prices) does not reach the specified price.
    • The specified price was reached but not for enough time for the limit order to be executed.
    • No keeper picked up the order for execution.

Trading Strategies

Traders can swap assets on spot trading, or trade perpetual futures with leverage without the need for KYC. They can also enjoy zero price impact trades on market order execution, and enjoy trading without temporary wicks that might trigger liquidations. 

Traders have access to a maximum of 50x leverage. 

  • When entering a long on an asset, say ETH, traders rent out the upside in that asset from the GLP pool.
  • When entering a short on an asset, traders rent out the upside of the stablecoins versus that asset from the GLP pool.

However, none of this liquidity is actually rented out from the pool. When the position is closed:

  • If the trader wins, profits are paid from the GLP pool in the form of the token being longed.
  • If the trader loses, losses are deducted from the trader’s collateral and paid into the pool.

Hence, the GLP holders profit when traders lose, and lose when traders win.

How Trading Works on The Backend

  • The PriceFeed contract accepts submissions from the price feed keeper. This keeper calculates prices using the median price of tokens on Binance, Coinbase, and Bitfinex. There are 2 types of keepers:
    • Price feed keeper: submits prices routinely for swaps
    • Position keeper: submits prices when executing a position.
  • The trading vault uses the price from the keeper as long as it is within the configured percentage of the corresponding Chainlink price
    • If the price exceeds this threshold, then a spread would be created between the bounded price and the Chainlink price. This spread is based on the historical max deviation of the Chainlink price from the median price of reference exchanges. This action is performed by watcher nodes that send a transaction to enforce the spread between the keeper price and the Chainlink price.
    • Prices from keepers have an expiry of five minutes. If the last price has been submitted more than five minutes ago, the Chainlink price is used instead.
  • Initially, GMX introduced a minimum price movement rule that the market price must move by more than 1.5% for a trade to be closed in profit. This was meant to prevent front-running. Later in March 2022, a 2 part transaction process was introduced to limit arbitrage bots from taking advantage of lagged oracle price feeds. This solution aims to solve the ‘cold start’ problem in on-chain perpetuals trading.

1. User sends the transaction with request details (e.g. deposit/withdraw/swap/increase/decrease position…)

2. Keepers listen for the transactions and include the price for the request. After that, the transaction is sent to execute the request.

  • GMX uses the GLP pool as a counterparty to traders.  This combined with their oracle pricing system also represents an innovation for bot LPs, as they are not impacted by impermanent loss. Traders don’t suffer from temporary wicks thanks to the use of an aggregated oracle pricing model that pulls price feeds from Binance, Coinbase, and Bitfinex.

GMX Breakdown Counterparty

When liquidity providers deposit assets in a liquidity pool of an AMM (Automated Market Maker), they must deposit assets based on a given ratio quoted by the AMM (e.g. 50% of assets in USDC and 50% in ETH). This ratio between the assets in the pool determines the price, usually by a constant product formula (x*y = k).

GMX Breakdown Constant Product

While this formula allows for the market to function, it can lead to impermanent losses for liquidity providers. Impermanent loss occurs when the AMM adjusts the ratio of the assets in the pool (to ensure they remain at a constant ratio in terms of value), and the liquidity provider loses out on gain from a deposited asset that outperforms the other. In other words, the liquidity provider would have made more gains if he/she had held the original assets instead of providing them as liquidity for traders. 

Synthetics

General Overview

Market

GMX synthetic markets are created with a long collateral token, a short collateral token, and an index token:

  • ETH-USD market with ETH as long collateral, stablecoin as short collateral, and ETH as index token.
  • BTC-USD market with WBTC as long collateral, stablecoin as short collateral, and BTC as index token.
  • SOL-USD market with SOL as long collateral, stablecoin as short collateral, and SOL as index asset.

Liquidity providers can deposit either the long or short collateral token to mint liquidity tokens:

  • The long collateral tokens are used to back long positions
  • The short collateral tokens are used to back short positions
  • Liquidity providers take on the profits and losses of traders for the market they provide liquidity for

Synthetic markets on GMX will be isolated and its contracts could allow for new assets to be listed. Since these trading pools are backed by pair-specific liquidity providers, GLP is not involved in their design. 

Features

Users could:

  • Deposit and withdraw liquidity.
  • Make spot swaps.
  • Leverage perpetual futures.
  • Make market orders, limit orders, stop-loss, and take-profit orders.
Oracle System

2 steps are required for execution and also helps avoid frontrunning issues:

  • The user sends the transaction with request details (e.g. deposit/withdraw/swap/increase/decrease position…)
  • Keepers listen to the transactions and include the price for the request. After that, the transaction is sent to execute the request

Prices are provided by an off-chain oracle system:

  • Oracle keepers check the latest blocks
  • When there is a new block, oracle keepers fetch the latest prices from the reference exchanges
  • Oracle keepers sign the median price for each token together with the block hash
  • Oracle keepers send the data and signatures to archive nodes
  • Archive nodes make the transaction data available for anyone to query.
Fees and Pricing

Funding fees and price impact keep longs/shorts in balance while reducing the risk of manipulation

  • When there is an imbalance in long/short positions, the larger side pays a funding fee to the smaller side.
  • Borrowing fees: to avoid users opening equal long/short positions and unnecessarily taking up capacity for other traders.
  • Synthetic contracts simulate a price impact similar to if a trader opened the trade in a dex aggregator of the reference CEXs, which are Binance, Coinbase, and Bitfinex.
    • There is a negative price impact if an action reduces the balance of the underlying collateral assets.
    • There is a positive price impact if an action improves the balance of the underlying collateral assets.

Negative funding rates mean that shorts pay a fee to longs, and positive funding rates mean that longs pay a fee to shorts. 

If the index price of the asset is higher than the spot price of the asset, funding will be positive (to arbitrage back to the real price by incentivizing shorts and penalizing longs), and if the price is lower than the spot price, funding will negative to penalize shorts and incentivize longs.

Get a 10% discount on all trading fees at GMX by using our referral code. Click here https://app.gmx.io/ to start trading.

Keepers

There are 3 kinds of keepers and nodes:

  • Oracle keepers: check for the latest finalized blocks, pull prices from exchanges, sign the information, and publish the data to Archive nodes
  • Archive nodes: receive the signatures of the Oracle keepers and allow for querying the information
  • Order keepers: check for deposits and withdrawals of liquidity requests and order requests, and bundle the signed Oracle prices with the request for execution.
Structure

There are a few main types of contracts:

  • Bank contracts that hold funds
  • Data storage which stores data – The majority of data is stored using the DataStore contract.
  • *storeUtils utils to serialize, store, and retrieve data for structs – *storeUtils contracts store struct data using the DataStore, this allows new keys to be added to structs.
  • Logic contracts which do not hold funds and do not have internal state
  • *eventUtils utils to emit events – *eventUtils contracts emit events using the event emitter, the events are generalized to allow new key-values to be added to events without requiring an update of ABIs.

The contracts are separated into these types to allow for gradual upgradeability.

EnumberableSets are used to allow order lists and position lists to be easily queried by interfaces or keepers, this is used over indexers as there may be a lag for indexers to sync the latest block. Having the lists stored directly in the contract also helps to ensure that accurate data can be retrieved and verified when needed.

Technical Overview

Exchange Contracts
  • Router: Approve token spending using this contract
  • ExchangeRouter: Create requests for deposits, withdrawals, orders, and tokens are transferred using the Router
  • /exchange contracts: Execute user requests
Markets

Markets are created using “MarketFactory.createMarket”, this creates a “MarketToken” and stores a “Market.Props” struct in the “MarketStore”.

The “MarketToken” is used to keep track of liquidity providers’ share of the market pool and to store the tokens for each market.

At any point in time, the price of a “MarketToken” is “(worth of market pool) / MarketToken.totalSupply()”, the function “MarketUtils.getMarketTokenPrice” can be used to retrieve this value.

The worth of the market pool is the sum of

  • The worth of all tokens deposited into the pool
  • Total pending PnL of all open positions
  • Total pending borrow fees of all open positions
Deposits

Deposits add long/short tokens to the market’s pool and mint “MarketTokens” to the depositor.

Requests for deposits are created by calling “ExchangeRouter.createDeposit”, specifying:

  • The market to deposit into
  • Amount of long tokens to deposit
  • Amount of short tokens to deposit

Deposit requests are executed using “epositHandler.executeDeposit” if the deposit was created at block n, it should be executed with the oracle prices at block n.

The amount of MarketTokens to be minted, before fees and price impact, is calculated as “(worth of tokens deposited) / (worth of market pool) * MarketToken.totalSupply()”.

Withdrawals

Withdrawals burn “MarketTokens” in exchange for the long/short tokens of a market’s pool.

Requests for withdrawals are created by calling “ExchangeRouter.createWithdrawal”, specifying:

  • The market to withdraw from
  • The number of market tokens to burn for long tokens
  • The number of market tokens to burn for short tokens

Withdrawal requests are executed using “WithdrawalHandler.executeWithdrawal”, if the withdrawal was created at block n, it should be executed with the oracle prices at block n.

The amount of long or short tokens to be redeemed, before fees and price impact, is calculated as “(worth of market tokens) / (long/short token price)”.

Market Swaps

Long and short tokens of a market can be swapped for each other.

For example, if the ETH / USD market has WETH as the long token and USDC as the short token, WETH can be sent to the market to be swapped for USDC and USDC can be sent to the market to be swapped for WETH.

Swap order requests are created by calling “ExchangeRouter.createOrder”, specifying:

  • The initial collateral token
  • The array of markets to swap through
  • The minimum expected output amount

The swap output amount, before fees and price impact, “(amount of tokens in) * (token in price) / (token out price)”.

Market swap order requests are executed using “OrderHandler.executeOrder”, if the order was created at block n, it should be executed with the Oracle prices at block n.

Limit Swaps

Passive swap orders that should be executed when the output amount matches the minimum output amount specified by the user.

Limit swap order requests are executed using OrderHandler.executeOrder, if the order was created at block n, it should be executed with Oracle prices after block n.

Market Increase

Open or increase a long/short perp position.

Market increase order requests are created by calling ExchangeRouter.createOrder, specifying:

  • The initial collateral token
  • The array of markets to swap through to get the actual collateral token
  • The amount to increase the position by
  • It is a long or short position

Market increase order requests are executed using OrderHandler.executeOrder, if the order was created at block n, it should be executed with the oracle prices at block n.

Limit Increase

Passive increase position orders that should be executed when the index token price matches the acceptable price specified by the user.

Long position example: if the current index token price is $5000, a limit increase order can be created with an acceptable price of $4990, the order can be executed when the index token price is <= $4990.

Short position example: if the current index token price is $5000, a limit increase order can be created with an acceptable price of $5010, the order can be executed when the index token price is >= $5010.

Limit increase order requests are executed using OrderHandler.executeOrder, if the order was created at block n, it should be executed with the Oracle prices after block n.

Market Decrease

Close or decrease a long/short perp position.

Market decrease order requests are created by calling ExchangeRouter.createOrder, specifying:

  • The initial collateral token
  • The array of markets to swap through for the actual output token
  • The amount to decrease the position by

Market decrease order requests are executed using OrderHandler.executeOrder, if the order was created at block n, it should be executed with the oracle prices at block n.

Limit Decrease

Passive decrease position orders that should be executed when the index token price matches the acceptable price specified by the user.

Long position example: if the current index token price is $5000, a limit decrease order can be created with an acceptable price of $5010, the order can be executed when the index token price is >= $5010.

Short position example: if the current index token price is $5000, a limit decrease order can be created with the acceptable price of $4990, the order can be executed when the index token price is <= $4990.

Limit decrease order requests are executed using OrderHandler.executeOrder, if the order was created at block n, it should be executed with the Oracle prices after block n.

Stop-Loss Decrease

Passive decrease position orders should be executed when the index token price crosses the acceptable price specified by the user.

Long position example: if the current index token price is $5000, a stop-loss decrease order can be created with an acceptable price of $4990, the order can be executed when the index token price is <= $4990.

Short position example: if the current index token price is $5000, a stop-loss decrease order can be created with the acceptable price of $5010, the order can be executed when the index token price is >= $5010.

Stop-loss decrease order requests are executed using OrderHandler.executeOrder, If the order was created at block n, it should be executed with the oracle prices after block n.

Order Pricing

For the limit swap, limit increase, limit decrease, and stop-loss decrease orders, the order can be executed at an acceptable price if it is within the range of the validated Oracle prices.

For example, if the current index token price is $5000 and a user creates a limit long decrease order with an acceptable price of $5010, the order can be executed with the index token price as $5010 if Oracle prices $5008 and $5012 are validated, the blocks of the oracle prices must be after the order was updated and must be in ascending order.

Order Prices

Oracle prices are signed as a value together with a precision, this allows prices to be compacted as uint32 values.

The signed prices represent the price of one unit of the token using a value with 30 decimals of precision.

Representing the prices in this way allows for conversions between token amounts and fiat values to be simplified, e.g. to calculate the fiat value of a given number of tokens the calculation would just be: token amount * oracle price, to calculate the token amount for a fiat value it would be: fiat value/oracle price.

The trade-off of this simplicity in the calculation is that tokens with a small USD price and a lot of decimals may have precision issues it is also possible that a token’s price changes significantly and results in requiring higher precision.

Decimal Multiplier

The formula to calculate what the decimal multiplier value should be set to:

Decimals: 30 – (token decimals) – (number of decimals desired for precision)

  • ETH: 30 – 18 – 4 => 8
  • BTC: 30 – 8 – 2 => 20
  • USDC: 30 – 6 – 6 => 18
  • DG: 30 – 18 – 11 => 1
Funding Fees

Funding fees incentivize the balancing of long and short positions, the side with the larger open interest pays a funding fee to the side with the smaller open interest.

Funding fees for the larger side are calculated as (funding factor per second) * (open interest imbalance) ^ (funding exponent factor) / (total open interest).

For example, if the funding factor per second is 1 / 50,000, the funding exponent factor is 1, the long open interest is $150,000 and the short open interest is $50,000 then the funding fee per second for longs would be (1 / 50,000) * 100,000 / 200,000 => 0.00001 => 0.001%.

The funding fee per second for shorts would be -0.00001 * 150,000 / 50,000 => 0.00003 => -0.003%.

It is also possible to set a stableFundingFactor, this would result in the specified funding factor being used instead of the dynamic funding factor.

Borrowing Fees

There is a borrowing fee paid to liquidity providers, this helps prevent users from opening both long and short positions to take up pool capacity without paying any fees.

Borrowing fees are calculated as borrowing factor * (open interest in usd + pending pnl) ^ (borrowing exponent factor) / (pool usd) for longs and borrowing factor * (open interest in usd) ^ (borrowing exponent factor) / (pool usd) for shorts.

For example, if the borrowing factor per second is 1 / 50,000, the borrowing exponent factor is 1, the long open interest is $150,000 with +$50,000 pending PnL, and the pool has $250,000 worth of tokens, the borrowing fee per second for longs would be (1 / 50,000) * (150,000 + 50,000) / 250,000 => 0.000016 => 0.0016%.

There is also an option to set a skipBorrowingFeeForSmallerSide flag, this would result in the borrowing fee for the smaller side being set to zero. For example, if there are more longs than shorts and skipBorrowingFeeForSmallerSide is true, then the borrowing fee for shorts would be zero.

Price Impact

The code for price impact can be found in the /pricing contracts.

Price impact is calculated as:

  • (initial USD difference) ^ (price impact exponent) * (price impact factor) – (next USD difference) ^ (price impact exponent) * (price impact factor)

For swaps, the imbalance is calculated as the difference in the worth of the long tokens and short tokens.

For position actions (increase/decrease position), the imbalance is calculated as the difference in the long and short open interest.

price impact exponents and price impact factors are configured per market and can differ for spot and position actions.

Note that this calculation is the price impact for a user’s trade not the price impact on the pool. For example, a user’s trade may have a 0.25% price impact, the next trade for a very small amount may have a 0.5% price impact.

The purpose of the price impact is to:

  • Incentivise the balance of tokens in pools
  • Incentivise balance of longs / shorts
  • Reduce the risk of price manipulation

Since the contracts use an oracle price which would be an average or median price of multiple reference exchanges. Without a price impact, it may be profitable to manipulate the prices on reference exchanges while executing orders on the contracts.

This risk will also be present if the positive and negative price impact values are similar, for that reason the positive price impact should be set to a low value in times of volatility or irregular price movements.

For the price impact on position increases/decreases, if negative price impact is deducted as collateral from the position, this could lead to the position having different leverage from what the user intended, so instead of deducting collateral, the position’s entry/exit price is adjusted based on the price impact.

If the index token is different from both the long and short token of the market, then it is possible that the pool value becomes significantly affected by the position impact pool, if the position impact pool is very large and the index token has a large price increase. An option to gradually reduce the size of the position impact pool may be added if this becomes an issue.

Price impact is also tracked using a virtual inventory value for positions and swaps, this tracks the imbalance of tokens across similar markets, e.g. ETH/USDC, ETH/USDT.

In case of a large price movement, it is possible that a large amount of positions are decreased or liquidated on one side causing a significant imbalance between long and short open interest, this could lead to very high price impact values. To mitigate this, a max position impact factor value can be configured. If the current price impact exceeds the max negative price impact, then any excess collateral deducted beyond the max negative price impact would be held within the contract, if there was no price manipulation detected, this collateral can be released to the user. When the negative price impact is capped, it may be profitable to open and immediately close positions, since the positive price impact may now be more than the capped negative price impact. To avoid this, the max positive price impact should be configured to be below the max negative price impact.

Fees

There are configurable swap fees and position fees per market.

Execution fees are also estimated and accounted for on creation of deposit, withdrawal, and order requests so that keepers can execute transactions at a close to net zero cost.

Reserve Amounts

If a market has stablecoins as the short collateral token it should be able to fully pay short profits if the max short open interest does not exceed the amount of stablecoins in the pool.

If a market has a long collateral token that is different from the index token, the long profits may not be fully paid out if the price increase of the index token exceeds the price increase of the long collateral token.

Markets have a reserve factor that allows open interest to be capped to a percentage of the pool size, this reduces the impact of profits of short positions and reduces the risk that long positions cannot be fully paid out.

Parameters
  • minCollateralFactor: This determines the minimum allowed ratio of (position collateral) / (position size)
  • maxPoolAmount: The maximum amount of tokens that can be deposited into a market
  • maxOpenInterest: The maximum open interest that can be opened for a market
  • reserveFactor: This determines the maximum allowed ratio of (worth of tokens reserved for positions) / (tokens in the pool)
  • maxPnlFactor: The maximum ratio of (PnL / worth of tokens in the pool)
  • positionFeeFactor: This determines the percentage amount of fees to be deducted for position increase / decrease actions, the fee amount is based on the change in position size
  • positionImpactFactor: This is the “price impact factor” for positions described in the “Price Impact” section
  • maxPositionImpactFactor: This is the “max price impact” for positions described in the “Price Impact” section
  • positionImpactExponentFactor: This is the “price impact exponent” value for position actions, described in the “Price Impact” section
  • swapFeeFactor: This determines the percentage amount of fees to be deducted for swaps, the fee amount is based on the swap amount
  • swapImpactFactor: This is the “price impact factor” described in the “Price Impact” section
  • swapImpactExponentFactor: This is the “price impact exponent” value for deposits and swaps, described in the “Price Impact” section above
  • fundingFactor: This is the “funding factor per second” value described in the “Funding Fees” section
  • borrowingFactorForLongs: This is the “borrowing factor” for long positions described in the “Borrowing Fees” section
  • borrowingFactorForShorts: This is the “borrowing factor” for short positions described in the “Borrowing Fees” section
  • borrowingExponentFactorForLongs: This is the “borrowing exponent factor” for long positions described in the “Borrowing Fees” section
  • borrowingExponentFactorForShorts: This is the “borrowing exponent factor” for long positions described in the “Borrowing Fees” section
Roles

Roles are managed in the RoleStore, the RoleAdmin has access to grant and revoke any role.

The RoleAdmin will be the deployer initially, but this should be removed after roles have been setup.

After the initial setup:

  • Only the Timelock contract should have the RoleAdmin role

  • New roles can be granted by timelock admins with a time delay

  • System values should only be set using the Config contract

  • No EOA should have a Controller role

  • Config keepers and timelock admins could potentially disrupt regular operation through the disabling of features, incorrect setting of values, whitelisting malicious tokens, abusing the positive price impact value, etc

  • It is expected that the timelock multisig should revoke the permissions of malicious or compromised accounts

  • Order keepers and frozen order keepers could potentially extract value through transaction ordering, delayed transaction execution, ADL execution, etc, this will be partially mitigated with a keeper network

  • Oracle signers are expected to accurately report the price of tokens

For Investors

Investing Strategies

Liquidity providers suffer no impermanent loss and enjoy a high APR in ETH/AVAX based on the amount of trading volume. Also, liquidity providers are eligible to profit from traders’ losses. 

Liquidity providers deposit assets in the pool to mint GLP. This liquidity represents an index of assets used for swaps and leverage trading. The token price of GLP is the value of the total worth of assets in the index including the unrealized profits and losses of open positions divided by the supply of GLP.

The composition of GLP is different on each chain. The fees for minting/burning GLP depend on if the index assets are underweight/overweight in the index pool. For example, if ETH is underweight, the fees for minting GLP by depositing ETH will be lower to incentivize more ETH deposits. The token weights in the pool are adjusted to help hedge the holders of GLP against the open positions of traders.

GMX Breakdown Traders Chart

Business Model

GMX aims for value accrual to its governance token GMX while giving staking yield in ETH or AVAX instead of just using their native GMX token as a reward. As per cryptofees.info, GMX is one of the most profitable protocols, given the upside and product differentiation from other perpetual trading exchanges. Low slippage trades and abundant liquidity attract traders, which also incentivizes more liquidity providers who will generate revenue from traders’ profits/losses, resulting in a flywheel effect. The value accrual for GMX is significant since 30% of the platform fees are distributed to GMX stakers. This also rewards long-term GMX holders, reducing selling pressure of the token on the market due to the 1 year vesting period of esGMX (escrowed GMX).

Similarly, value accrues to GLP holders by entitling them to a share of the GLP liquidity pool, which also means that at any given time GLP holders are taking the other side of the longs and shorts currently open. Regardless of the profits/losses of traders, GLP holders are rewarded with 70% of platform fees. Because of this, holding GLP is like holding an index of the assets and stablecoins in the pool, which is usually dominated by ETH, WBTC, and stablecoins as well as other assets like UNI or LINK.

Revenue Streams

GMX gets its revenue from trading volumes. When this revenue is high enough to incentivize users to provide more liquidity, the protocol can reach a level where it can self-sustain itself even in a downtrend market. During 2022, the product has stood out from its competitors and proven that the LP’s APR and TVL metrics are not negatively affected by less esGMX rewards. This shows that the yield provided to LPs is high enough to incentivize liquidity in the GLP pool.

The protocol generates revenue by charging fees when users open or close positions and charging borrow fees which are deducted every hour a leveraged position is open. This revenue is split into the following allocations:

  • V1
    • 70% is distributed to GLP holders
    • 30% is distributed to a pool that goes to GMX stakers across all chains.
  •  V2
    • 10% is distributed to the GMX Treasury.
    • 63% is distributed to liquidity providers in each specific liquidity pool.
    • 27% is distributed to a pool that goes to GMX stakers across all chains.

To continue incentivizing liquidity while maintaining protocol sustainability, the GMX DAO passed a proposal to update esGMX emissions. Rewards to staked tokens are distributed every second. The rate of rewards is evaluated and can be changed by the DAO.

Rewards are distributed as follows:

  • When users stake GMX, they earn ETH/AVAX, esGMX, and Multiplier Points.
  • When users stake Escrowed GMX (esGMX), they earn ETH/AVAX, esGMX, and Multiplier Points.
  • When users stake Multiplier Points they can boost the rewards from ETH/AVAX APRs.
  • When GLP is minted after users provide liquidity, GLP is automatically staked and earns ETH, AVAX, and esGMX.

Most protocol revenue comes from margin trading (~75%), with some coming from spot trading (~15%), 5% from dynamic fees minting and burning GLP, and the remaining from liquidations.

Get a 10% discount on all trading fees at GMX by using our referral code. Click here https://app.gmx.io/ to start trading.

Tokenomics

GMX

GMX is the governance token for the GMX protocol. 

  • The expected max supply is 13.25M GMX tokens. Minting beyond the max supply of 13.25M is controlled by a 28-day timelock. This option will only be considered if more product launches need GMX token rewards as incentives. A governance vote is required before these changes are conducted.
  • Circulating supply will vary depending on the number of vested tokens and the number of tokens used for marketing.
  • Protocol owned by the protocol under the same multi-sig signers as the XVIX and Gambit migration:
  • GMX tokens can be bridged:
    • Between Avalanche and Arbitrum using Synapse
    • Between Ethereum mainnet and Arbitrum 
    • Bridging from Ethereum is performed as per GMX’s user guide
    • There is no need to bridge GMX tokens from Arbitrum to Ethereum since all GMX functions can be performed on Arbitrum.
    • Bridging from Ethereum to Arbitrum takes a few minutes, but bridging from Arbitrum to Ethereum has a 7-day waiting period during which you will not be able to access the bridged tokens.

GMX Breakdown Investors Chart

Staking GMX

Users can stake GMX to earn rewards from 3 sources:

  • Escrowed GMX (esGMX) 
  • Multiplier points
  • ETH / AVAX rewards from converting 30% of swap fees from leveraged trading activity. These rewards are distributed after deducting referral rewards and network costs for keepers (~1% of total fees)
    • ETH rewards for users staking on Arbitrum
    • AVAX rewards for users staking on Avalanche

There are two options to access these rewards:

  1. Compounding will stake your pending Multiplier Points and Escrowed GMX rewards, which will increase the amount of rewards you receive. If you compound or stake Escrowed GMX tokens, you can unstake them for vesting at any time later on.
  2. Claiming will transfer any pending Escrowed GMX rewards and ETH/AVAX rewards to your wallet

GMX Breakdown Pool Tokens

Floor Price Funds

There is a floor price fund for the GMX token priced in ETH and GLP.  These reserves can grow in 2 ways:

  • Protocol-owned liquidity is provided by the protocol as GMX/ETH liquidity. Fees from this trading pair are converted into GLP and deposited into the floor price fund.
  • Funds from Olympus bonds:
    • 50% of funds go to the floor price fund
    • 50% of funds for marketing

The floor price fund:

  • Ensures that there is available liquidity in GLP
  • Provides stable income in ETH rewards for users who stake GMX
  • Buys back and burn GMX when (Floor Price Fund) / (Total Supply of GMX) is less than the market price of GMX

Currently, the floor price fund is held in multiple contracts that will gradually consolidate into a single contract:

Token Emissions

Token emissions seek to grow the network of users interacting with the protocol. This demand for using the protocol would generate organic revenue to sustain protocol operations while sufficiently incentivizing even more users to provide liquidity. 

Token Distribution

GMX Breakdown GMX Distribution

  • GMX Distribution:
    • 6M GMX from the XVIX and Gambit migration.
    • 2M GMX paired with ETH for liquidity on Uniswap. GMX liquidity is added on Uniswap as the price of GMX increases.
    • 2M GMX reserved for Escrowed GMX vesting rewards.
    • 2M GMX tokens for management of the floor price fund.
    • 1M tokens for marketing, partnerships, and community developers.
    • 250,000 GMX tokens linearly vested to contributors over 2 years.

It is unlikely that all tokens will be circulating at the same time, due to the tokens reserved for the price floor funds not being meant to hit the markets to avoid diluting the value of current token holders. Besides, esGMX emissions can only become liquid after a 365 days vesting period after which the underlying principle GMX or GLP can be claimed.

The emissions of esGMX ended in March 2023, as per the governance vote.

Escrowed GMX (esGMX)

Escrowed GMX is meant to be a non-transferrable token that can be used in one of 2 ways:

  • Staked for rewards, similar to GMX tokens:
    • Each staked Escrowed GMX earns the same amount in Escrowed GMX and ETH/AVAX rewards as a regular GMX token.
  • Vested over one year to become actual GMX tokens:
    • In order to convert Escrowed GMX to regular GMX tokens, the tokens must go through a process of Vesting. When the vesting process starts, the average amount of GMX or GLP tokens that were originally used to earn the esGMX rewards will be reserved. This means that the actual ratio of tokens that will be reserved for vesting to your account will depend on the average staked amount and the rewards your account has earned. 
    • Example: if you staked 1,000 GMX and earned 100 esGMX tokens, then to vest 100 esGMX tokens, 1,000 GMX tokens will be reserved. Similarly, to vest 50esGMX, 500 GMX tokens will be reserved.
    • The tokens that are reserved for vesting can’t be unstaked or sold. They can be withdrawn, but partial withdrawals are not allowed, which means that the user would have to withdraw and unreserve all tokens as well as pause vesting. All esGMX tokens already vested into GMX will remain as GMX tokens.
    • When esGMX tokens are unstaked and deposited for vesting, the tokens will stop earning rewards for the user.
    • Once the vesting period starts, the esGMX tokens will be converted into GMX tokens every second such that the vesting process is complete after 365 days. esGMX tokens that have been converted to GMX tokens can be claimed at any time.
    • If a user has pending esGMX rewards and sells GMX or GLP tokens, the user would need to re-buy GMX or GLP tokens in order to vest these esGMX rewards.
    • Users can deposit into the vesting vault even while there is already an existing vesting in progress.

Despite being meant to not be transferable, users can perform a full account transfer of esGMX tokens. A full account transfer sends all GMX, esGMX, GLP tokens, and multiplier tokens to a new account. This functionality is only supported if the receiver address has not staked GMX or GLP tokens before. These transfers are the only way to transfer and cannot return back to the sending account. 

The emissions of esGMX ended in March 2023, as per the governance vote.

Multiplier points

GMX uses multiplier points as a mechanism to reward long-term holders without token inflation. When users stake GMX, they receive Multiplier Points from the protocol at a fixed 100%APR. For example, 1,000 GMX tokens that are staked would earn a total of 1,000 Multiplier Points. 

  • Multiplier Points can be staked to earn rewards from fees, such that each multiplier point will boost ETH/AVAX rewards at the same rate as regular GMX tokens.
  • When GMX or Escrowed GMX tokens are unstaked, the proportional amount of Multiplier Points is burnt. For example, if 1,000 GMX are staked and earn the user 500 Multiplier Points, then unstaking 500 GMX tokens will burn 250 Multiplier Points (500 / 1,000 * 500 = 250). The burn will be applied to both staked and unstaked Multiplier Points.
  • The “Boost Percentage” shown on the Earn page refers to the user’s boost amount from Multiplier Points. Example:
    • User has $10,000 worth of GMX and esGMX
    • ETH APR is 10%
    • User rewards would be $1,000 annualized
    • If the user has an amount of Multiplier Points that is equivalent to 20% of the total amount of GMX and esGMX, the “Boost Percentage” is 20%
    • In this scenario, a 20% “Boost Percentage” means that the user will get a 20% boost on its annualized rewards. Since the annualized rewards are $1,000 the user would earn an additional boost of $200 on ETH rewards from its Multiplier Points.
    • Calculation: Boost Percentage = 100 * (Staked Multiplier Points) / (Staked GMX + Staked esGMX)
  • MPs are capped at 200% for an active fee boost.
    • This was decided via a snapshot on June 27, 2023. 
    • Any earned MP’s beyond the cap percentage would remain but be ‘inactive’, not boosting your fee rewards.
    • You could buy additional GMX with that wallet, stake them, and those existing MPs would directly become ‘active’: boosting your fee rewards (up to the cap percentage).

GLP 

The GLP token is the tokenized representation of GMX V1’s liquidity pool.

The GLP token consists of an index of assets used for trading. Its price is determined by the value of all tokens within the pool and factoring in the profits and losses of all current open positions.

  • GLP can be minted using any asset included in the index
  • GLP can be burnt to redeem any asset from the index.
  • GLP tokens are automatically staked and will start earning esGMX and ETH/AVAX rewards. In other words, when GLP is bought it is automatically staked and when it is sold it is automatically unstaked. StakedGLP behaves like an ERC20 token. Users can approve and transfer GLP tokens to any wallet. When transferring, GLP will be unstaked from the user making the transfer and then staked for the receiving wallet. The receiving wallet would then start earning rewards.
  • There is a minimum holding time of 15 minutes after minting. After that, users can redeem their GLP tokens. This 15-minute cooldown also applies before staked GLP can be transferred.
  • GLP represents shares of an index of assets. Because of that, liquidity providers might be holding assets at undesired ratios.

The price of GLP minting and redemptions is calculated based on: (the total worth of assets in the index including profits/losses of open positions) / (GLP supply).

GLP holders earn Escrowed GMX rewards and 70% of platform fees are distributed in ETH for Arbitrum users or AVAX for Avalanche users. The fees are distributed after deducting referral rewards and the network costs of keepers (~1% of the total fees). GLP is specific to the network where it is minted and cannot be transferred across networks, since the price and rewards will be different.

Since GLP holders deposit liquidity for leverage trading, they will make a profit when leverage traders make a loss and vice versa:

  • When leverage traders are at a loss in aggregate, GLP holders will make a profit.
  • When leverage traders are in profit in aggregate, GLP holders will make a loss.

Fees for minting GLP vary based on the assets of which the pool has more or less of. The fees for minting will be lower for tokens that the pool has less of (to incentivize deposits in that asset) and vice versa. The protocol rebalances the fees to mint GLP, burn GLP, or perform swaps based on whether the action increases the balance of assets included in the index or reduces it. 

  • Example:
    • If the index has a large % of ETH and a small percentage of USDC:
    • Actions that increase the % of ETH in the index will have a high fee.
    • Actions that reduce the % of ETH in the index will have a low fee.

GMX Breakdown Token Weights

  • Token weights are rebalanced to help GLP holders hedge their exposure based on the open positions of traders:
    • If a lot of traders are long, then ETH would have a higher token weight.
    • If a lot of traders are short, then stablecoins would have a higher token weight. In that scenario, GLP holders would have a synthetic exposure to the tokens being shorted.
    • For example, if traders are shorting ETH, the price of GLP will decrease if the price of ETH decreases. If the price of ETH increases, the price of GLP will increase from the losses of the traders that were short.
  • Even if a lot of traders have a long position on the platform, the price of GLP will also increase when token prices increase.
    • The portion reserved for long positions can be treated as stable in terms of USD value given the profits from the price increase will be used to pay traders.

GLP also grants exposure to volatile markets that negatively impact both long and short traders, filling the pool assets as it simultaneously makes a profit from trading fees.

GMX Breakdown GLP Performance

GM

The GM pool, or GMX Market pool, is the liquidity mechanism of GMX V2, and can be bought or sold on the GM Pools page.

The main difference between GLP and GM is that instead of an indexed basket of assets like GLP, GM represents individual pools, allowing liquidity providers to expose themselves to specific tokens.  Rewards for liquidity providers in GM are also paid in the pool token, with no esGMX earned.

A GM pool consists of:

  • Index Price Feed: Long and short tokens will be opened/closed based on this price feed.
  • Long Token: This is the token that will back long positions.
  • Short Token: This is the token that will back short positions.

For example, a market could be ETH/USD[ETH-USDC], in this case:

  • Index Price Feed: ETH/USD
  • Long Token: ETH tokens back long positions
  • Short Token: USDC tokens back short positions

If a market is labelled as SWAP-ONLY or SPOT-ONLY, then the market only supports swaps and does not support leverage trading.

The price of the GM tokens depends on the following factors:

  • The price of the long/short tokens and the net pending PnL of traders’ open positions.
  • Fees from leverage trading and swaps which will automatically increase the price.
  • There may be a spread for some long/short tokens which would result in a spread when buying/selling GM tokens as well.
  • For stablecoin tokens, the spread will be from the Chainlink price of the stablecoin to 1 USD.

GLV

GMX Liquidity Vaults (GLV) manages liquidity across different trading markets. It is a vault of dynamically rebalancing GM liquidity tokens. GLV is a ‘pool of pools’, optimising liquidity between its underlying GM pools based on demand and usage, and generating fees from all those markets.

This way, liquidity is always available where traders need it most, making it easier for them to trade while giving liquidity providers a more efficient way to earn fees.

GLV is the index pool of GM Markets, rebalancing liquidity to its best-performing GM pools and generating fees from them. As a result, GLV offers liquidity providers a balanced instrument with stable risk-adjusted returns and high capital efficiency.

A GLV (GMX Liquidity Vault) pool consists of:

  • List of supported markets: This is the list of markets in which liquidity will be provided
  • Long Token: This is the token that will back long positions
  • Short Token: This is the token that will back short positions

For example, a GLV could be GLV[WETH-USDC], in this case:

  • The supported markets and allowed liquidity in each market will be recommended by Chaos Labs
  • Long Token: WETH tokens back long positions
  • Short Token: USDC tokens back short positions

Liquidity will be automatically shifted between the supported markets based on utilization and the recommendations of Chaos Labs.

Just as with the separate GM pools, holders of GLV:

  • are exposed to the price movements of the underlying assets (WETH/USDC).
  • are exposed to trader PnL, as long as the GM pools aren’t 50/50 balanced between Longs/Shorts.
  • earn fees from the pools at the listed rate. These fees are auto-compounded, automatically increasing the price of your GLV tokens.

GLV can be purchased with $ETH, $USDC, or any of its seven underlying GM tokens.

Purchasing GLV with any of its underlying GM tokens costs no fees. GMX’s recently introduced SHIFT functionality for GM liquidity providers makes this zero-fee liquidity transfer possible.

gmx glv

Note that while the list of supported markets in which liquidity will be provided are displayed for each GLV, this list can change as additional markets are approved and added.

Fees Breakdown

The following are the various fees for utilizing the protocol.

V1

  • Trading fees = 0.1% of the position size when opening/closing a trade.
  • Swap fees = 0.2% to 0.8% of the collateral size.
  • Borrowing fees = Deducted at the start of every hour, paid to the counterparty of the trade. It varies based on the the following calculation: 
    • (assets borrowed) / (total assets in the pool) * 0.01%.
  • Deposit fees = For depositing collaterals into a long position, a 0.3% for the conversion of asset to its USD value. Not applicable to shorts.
  • Execution fees = Cost paid to the blockchain network, for Keepers order executions.
    • The user sends the first transaction to request open, close, deposit or withdraw collateral.
    • Keepers observe the blockchain for these requests and then execute them.

V2

  • Trading fees = 0.05% or 0.07% of the position size when opening or closing a trade, or for increasing and decreasing a position size.
  • Swap fees
    • 0.05% increases the balance of tokens in the pool
    • 0.07% if not
    • 0.01% for stablecoin swaps
  • Borrowing fees = If there are more longs than shorts then longs would pay the borrowing fee, if there are more shorts than longs then shorts would pay the borrowing fee.
  • Funding fees = If there are more longs than shorts then longs would pay a funding fee to shorts, if there are more shorts than longs then shorts would pay a funding fee to longs.
  • Execution fees = Cost paid to the blockchain network, for Keepers order executions.
    • The user sends the first transaction to request open, close, deposit or withdraw collateral.
    • Keepers observe the blockchain for these requests and then execute them.

V2 Fee Split

Additionally, under the v2 Fee Split snapshot passed on July 19, 2023, an allocation of 10% of protocol fees for which GMX stakers & GM liquidity providers participate would be allocated to the GMX Treasury. Overall, fees from V2 would be split according to the following ratios:

  • 10% distributed to the GMX Treasury
  • 63% distributed to liquidity providers in each specific liquidity pool
  • 27% distributed to a pool that goes to GMX stakers across all chains

Referral Program

  • Users can get fee discounts and earn rebates through the GMX referral program:

Rebates are the maker-taker fees collected by a market maker and that is shared with liquidity providers while charging the customers who take that liquidity out from the exchange.

Operating Expenses

Besides keeper nodes, watcher nodes are also run to verify that the prices submitted by the keepers have not been manipulated. These watcher nodes are responsible for continuously monitoring and computing the median price from the price feeds and comparing this price with the prices submitted by keepers.

Keepers and watchers are currently run by separate team members. As the team becomes more confident with regard to the watcher’s reliability, they can open the watcher to be run by any user and receive notifications instead.

The price feeds and position keepers can be decentralized more by using Chainlink keepers or a custom execution environment such as Intel SGX used by Avalanche.

On May 10, 2023, a proposal to integrate Chainlink’s new oracle was passed, allocating 1.2% of the GMX V2 protocol fees to Chainlink for future development work and support of the low-latency oracles used by GMX V2.

Get a 10% discount on all trading fees at GMX by using our referral code. Click here https://app.gmx.io/ to start trading.

Governance

GMX governance proposals can be tracked on their snapshot page.

There are parameters controlled by the team and adjusted by a Timelock, such as:

  • Listing new tokens
  • Updating the price feeds used by the Trading Vault
  • Updating the contract that validates the opening/closing of positions and also specified how fees are calculated
  • Updating governance values.

The Timelock requires a 24-hour gap between when details of an action are signaled on-chain to when the action is executed. The reason for choosing 24 hours is to quickly respond to any issues that may occur. The Timelock contract is monitored by team members.

Timelock smart contracts restrict the functionality within a smart contract to a specific window of time.

GMX is open source and has a large and supportive community. Such a strong community is a big difference when compared to other protocols since the support and contributions can act as a  great marketing campaign.  The community has built multiple projects and governance proposals that keep pushing the narrative forward. Some examples are the statistics page, a trading competition, a referrals program, an NFT project led by @xm92boi called the GMX Blueberry Club, and more.

Risks

Security

Interacting with any smart contract requires caution. While these risks are minimized through testing, audits, and bug bounties, there is always the risk of vulnerabilities.

If a malicious transaction is sent, it is possible for all funds in the pool to be compromised. To mitigate this, all actions that can impact user funds must pass through a 24-hour Timelock contract controlled by the team. By doing this, an action is signaled on-chain, then there is a 24-hour time gap, and finally, the signaled action goes through.

If malicious transactions are detected through their monitoring system or Bug Bounty program, a multi-sig of advisors and community members can override the admin value of the Timelock and prevent the action from being executed. 

The core logic of GMX contracts can’t be changed, but certain peripheral functions such as price feeds and pricing calculations can be updated. 

The two-step transaction process for swap fees and the integration with KeeperDAO seek to mitigate front-running attacks. 

Flash loans do not have an impact on swaps or traders since the minting and redeeming of GLP are settled using the oracle price and are not dependent on liquidity pool balances or liquidity pool composition parameters. Even if the changing fees for swaps are dependent on pool compositions, the maximum benefit from a flash loan would be a zero-fee swap which adjusts the GLP token index toward the desired token weights.

Audits

The GMX contracts have been audited by various security groups. There is an active bug bounty as well on Immunefi.

GMX V2 Genesis Risk Parameter Recommendations

The recommendations were provided by Chaos Labs in collaboration with GMX core contributors and focused on the protocol’s safety and security.

Methods used in obtaining the recommendations included executing millions of market stress scenarios and Monte Carlo simulations at scale. These simulations, to test the system’s robustness in a myriad of potential scenarios, included a wide array of variables, such as:

  • Diverse price trajectories
  • Liquidity models
  • Levels of network congestion
  • Volatility levels

Subsequently, recommendations to the initial risk parameter for Arbitrum and Avalanche deployments were made.

Economic Attack Vectors

  • Price checks are enforced at the contract level. On each fast price update, contract variables store the percentage change in price for the update as well as the percentage change of the Chainlink price since the last update.  If the cumulative percentage change in the fast prices over a duration exceeds the cumulative percentage chain in the Chainlink prices, the spread between the fast price and the Chainlink price will be automatically updated.
  • The short skew risk appears especially during big market downtrends when prices fall very rapidly. Some short traders win a lot of money and catch a lot of profits from the GLP pool due to the delta exposure to a larger number of traders going long. In this situation, the GLP pool must pay short traders for their profits with stablecoins. This reduces the size of the pool, causing losses to GLP holders that also reflect in a lower TVL.
  • Since GLP acts as the counterparty for traders, the GLP pool can be depleted when the majority of the traders are profitable. Because of this, the protocol’s success to incentivize liquidity providers depends on the assumption that the majority of traders will lose money in the long term.

GMX Breakdown GLP as Counterparty

Dependencies and Access Controls

Access Control parameters on the smart contracts are controlled by the team. Among these settings are permissions to:

  • Set swap and margin trading fees up to a maximum of 5%.
  • Set the token weights of the GLP pool. This affects the dynamic fees of swaps. Currently, a swap that increases the GLP balance towards more of the specified token will be lower, while a swap that moves the GLP balance away from the desired amounts of that token will have a higher fee.
  • Pause swaps or leverage trading under emergency circumstances
  • Set the maximum allowed leverage
  • Set the maximum total capacity for long/short positions.

Liquidity Risk

On Avalanche, the oracle pricing model was exploited due to the thinner liquidity on-chain compared to centralized exchanges. By manipulating AVAX’s price off-chain on CEXs, a trader managed to gain $566,000 from the GLP pool. This example shows how off-chain price manipulation may allow traders to profit from the low slippage feature of GMX.

GMX Breakdown Price Manipulation

A trader could see an imbalance between the long/short liquidity on GMX, buy a token on GMX, then buy a smaller amount on a centralized exchange to move the price up and, afterward, close the long on GMX for a profit, open a short on GMX, and then sell the asset back on the centralized exchange to finally close the short on GMX for another profit. If the profits could cover the cost of price slippage for the position on the CEX, plus the platform fees on both the CEXexchange and GMX, traders with big amounts of money could maybe drain the GLP pool. 

As long as the external liquidity to move up the price of any index asset is lower than the liquidity available in the GLP pool, there is room for traders to long/short the asset on GMX in advance to move the price up/down in CEXs and make a profit.

There is also risk from assets that are very illiquid. The price oracle for these assets might halt for some tokens during extreme market conditions, causing a loss for the protocol. As an example from the past, Venus Protocol lost over $11.2M when an attacker deposited 230M LUNA tokens to borrow $13.5M given that the last oracle price update reported a price of $0.107 for LUNA when, in reality, the market price was below $0.01.

Get a 10% discount on all trading fees at GMX by using our referral code. Click here https://app.gmx.io/ to start trading.

GMX V2 Risk Monitoring and Alerting Platform

The risk platform was introduced on September 25, 2023 by Chaos Labs.

The V2 Risk Hub is integrated with both Arbitrum and Avalanche deployments, and provides both high-level and in-depth information about the protocol, including TVL, Fees, Trading Volume, and Open Interest.

The Risk Explorer tool empowers users to run simulations on one or multiple assets, allowing them to simulate price drops and assess the potential impact on protocol positions and expected profit and loss (PnL). This functionality proves valuable for understanding the risk exposure associated with a position, particularly in market volatility.

Investors

GMX has raised no funds from VC investments. GMX is the evolution from Gambit, a BSC (Binance Smart Chain) project that raised community funds and then migrated the liquidity to an equivalent of 6M GMX tokens.

From the GMX telegram chat and on-chain analysis, it is possible to discover investors that bought from the open market, such as:

Additional Information

GMX Composability

Uses cases:

  • Abracadabra Money
    • Users can deposit GLP into Abracadabra’s compounding vault.
    • Abracadabra has become one of the largest holders of staked GLP.
    • Abracadabra charges a 1% fee.
  • Rage Trade
    • Rage Trade offers delta-neutral vaults for GLP, allowing users to earn ETH while maintaining a delta-neutral position.
    • This is done by shorting on Aave and Uniswap, suppressing ETH and BTC price exposure.
    • The combination of shorts and GLP hedge the underlying assets in held in the GLP index so users do not suffer from impermanent loss on GLP.
  • STFX
    • STFX is built on GMX, offering copy-trade services to users.
    • Users can join peer-managed trades by depositing USDC and the vault owner can open a crowdfunded position for the trade strategy.
    • Vault managers earn fees on successful trades and the entire trading feature is built exclusively on GMX.
    • Trades are routed to GMX.

Protocol Integration

Protocols building on GMX:

  • Abracadabra: Algo stablecoin protocol with auto-compounding $GLP strategy
  • Beefy Finance: Multichain yield optimizer with $GLP vaults
  • Buffer Finance: Exotic options trading platform, staking mechanism forked from GMX
  • DappsOS: Defi accessibility mobile app with GMX trading integration
  • Delta Prime: Borrowing platform with $GLP integration
  • Demex: Cosmos Defi all-in-one DEX with auto-compounding $GLP Vault
  • Dopex: Options Exchange on Arbitrum, with GMX integration
  • Dsquared Finance: Options-based Defi vaults, integrated with GMX
  • GMD Protocol: Smart Vault and Yield, built on GMX
  • Handlefi: Forex trading and lending protocol with ETH and BTC are routed to GMX
  • Jones DAO: Options yield and strategy vaults leveraging $GMX and $GLP
  • Kostren Finance: Yield Aggregator and Smart Vaults, with $GMX and $GLP strategies
  • Lyra: Optimism native options trading protocol integrated with GMX on Arbitrum
  • MugenFinance: Real Yield aggregator on LayerZero, leveraging $GLP
  • Moremoney: Lending and borrowing protocol on Avalanche, with $GLP Vaults
  • MUX: Leverage trading platform with GMX trading integration
  • Nitro Cartel, Arbitrove: yield-bearing index and strategy vault using $GLP vaults
  • Neutra Finance: $GLP Delta Neutral strategies
  • Olive: Real yield strategies with $GLP vault
  • Perpy Finance: Social trading platform built on GMX
  • Plutus DAO: Governance token black hole, leveraging $GLP vaults
  • Puppet Finance: social trading platform building on GMX (Coming soon)
  • Rage Trade: Yield vault strategy protocol leveraging $GMX and $GLP
  • Redacted Cartel, Pirex: Auto-compounding yield strategies with $GMX and $GLP vaults
  • Rodeo Finance: Leveraged yield farming strategies with a $GLP vault
  • STFX: Social trading platform built on GMX
  • Stabilize Protocol: Stablecoin stabilizing protocol leveraging $GLP pools
  • Steadefi: Optimized yield strategies with 3x leverage long $GLP Vaults
  • Sentiment: Lending and trading platform with $GLP vaults
  • Stardust: Yield aggregator built on GMX and $GLP
  • Tender Finance: Borrowing and lending protocol with $GLP and $GMX collateralization
  • Umami Finance: Delta Neutral vault strategies leveraging $GLP
  • Vovo Finance: Yield vaults with $GLP strategies
  • Vesta Finance: Stablecoin protocol on Arbitrum with $GMX and $GLP Vaults
  • Yeti Finance: Avalanche lending protocol with $GLP vaults
  • Yield Yak: Avalanche Defi tools with boosted $GLP farms

Partnerships

Other protocols can integrate and make the GMX ecosystem stronger. For example, partnerships with DAO Jones Options, Rage Trade, Dopex, and more give traders more flexibility and access to other instruments to speculate on the market. These protocols can create a moat against other competitors. 

  • Dopex European options allow traders to open a synthetic position that allows a perpetual position to be free from liquidations on GMX. 
    • This is achieved by means of Atlantic options by deposition put options on Dopex at the same strike price as perps in GMX. 
  • GMX has partnered with KeeperDAO to relay all GMX oracle updates on Arbitrum and Avalanche through KeeperDAO to discover and settle the value of Oracle Extractable Value.
  • DEX aggregators like Wardenswap, BreederDAO, and YieldKak have integrated GMX as a route.
  • Partnership with OlympusDAO to sell GMX WETH bonds.
    • 50% of the funds raised from the bonds will be used to buyback and burn GMX as per the price floor fund
    • 50% will be used for marketing.
  • Integration with Banxa, a fiat on-ramp platform
  • Integration with Synapse for a multi-chain bridge that allows the transfer of assets between Avalanche and Arbitrum.
  • Umami also developed a USDC vault to offer delta-neutral yield but finally ran into issues that were documented in a post-mortem report pointing to an unexpected dump in the GLP price, and difficulties in their strategy of automating asset rebalances.
  • Vesta Finance offers to maximize GLP yield : 
    • The VST-FRAX pool strategy deposits GLP into Vesta to mint VST which is then staked into the VST-FRAX pool to earn an extra yield between 10% and 30%
    • For example, if GLP has a 24% yield and a VST loan is taken at a 150% collateral ratio to deposit into the VST-FRAX pool, a user would have 20% in ETH from the GLP deposit, and 10% on the VST-FRAX pool deposit. Since the loan is taken at 150%, it would return 6.66% of the principal amount. This increases the GLP yield from 24% to close to 27%
    • Looping GLP on Vesta by depositing GLP into Vesta, taking out a VST loan at the user’s desired collateral ratio, and, with the newly borrowed VST acquiring new GLP again and then repeating the cycle again. Users must be aware of the degree of exposure they wish to have for leverage. At a lower collateralization ratio of 120%, it is possible to achieve 6x leverage on VST, which at a 20% APR is the equivalent of a 120% APR. This looping strategy will raise the liquidation risk of the user.

GMX Breakdown Looping Vesta

  • GLP vault released by PlutusDAO: users can deposit GLP to mint plvGLP, an interest-bearing position whose APR includes both ETH and PLS rewards on Arbitrum, with ETH rewards auto-compounding. esGMX rewards accrue to Plutus but the yield from that esGMX is distributed to plvGLP stakers. 
  • STFX allows users to either invest in or manage vaults, with the vault only being live for one trade.  This is similar to investing in a fund, but your funds are only locked for one trade.  STFX is built on top of GMX, using its GLP liquidity pool and perpetual trading features.
  • Trading View – Platform for market charts.
  • Etherdrops Bot – Crypto monitoring tool.
  • Dolomite IO – A next-gen money market and margin trading protocol on Arbitrum.
  • MUX Protocol –  One-stop access for leveraged trading.
  • TradaoTradao is the First Web3 Derivatives Portfolio Tracker that covers all GMX_IO traders.
  • Struct Finance – Decentralizing Structured Finance.

Get a 10% discount on all trading fees at GMX by using our referral code. Click here https://app.gmx.io/ to start trading.

Referral Program

  • The referral program is subject to change by GMX token holders.
  • Any user can create a referral code by going to https://app.gmx.io/#/referrals and clicking on the Affiliates tab.
  • Referral codes must be created on both Arbitrum and Avalanche chains to earn rebates on both networks.
  • You can share the link and whenever someone clicks on your link, the referral code would be stored with the user’s account. Every time a new user makes a trade, they would receive a discount that would make them eligible to earn rebates from their trading fees.
  • Rebates and discounts apply on the opening and closing fees for leverage trading. Rebates are calculated before the trading discounts so that referrers can earn on the full maker fee and from the trade spread. 
  • There is a cap of 5,000 esGMX distributed per week. 
    • esGMX tokens distributed through the referral program do not require GMX or GLP to vest
    • The esGMX vesting vault for the referral program will be available until the end of 2022
    • The price of esGMX will be based on the 7-day TWAP of GMX.

There is a tier system in place to prevent gaming the referral system through self-referrals. This ensures that referrers receive the rebates for the users that they brought to the platform. 

  • Tier 1: 5% discount for traders, 5% rebates to referrer
  • Tier 2: 10% discount for traders, 10% rebates to referrer
  • Tier 3: 10% discount for traders, 15% rebates to referrer paid in ETH / AVAX, 5% rebates to referrer paid in esGMX

Anyone can create a program by creating a referral code in Tier1. To upgrade to Tier2 or Tier3 there are more steps:

  • Tier 2: At least 15 active users using your referral codes per week and a combined weekly volume above $5 million
  • Tier 3: At least 30 active users using your referral codes per week and a combined weekly volume above $25 million

If an account fulfills the criteria, there is an application form available: https://forms.gle/8QF2bxdYhUHNo7c96. Once filled, the user should get in touch with https://t.me/GMXPartners for a follow-up.

FAQ

  • What are partial liquidations?
    • Due to the borrow fee being charged, the liquidation price for a position will change over time. If the token price crosses the liquidation price and there is any collateral remaining after deducting losses and fees, then the amount is returned to the trader’s wallet.
  • How does pricing work?
    • There is no price impact for trades on GMX, which means that trades are executed at the mark price. This is possible because the liquidity pool acts as the counterparty. However, there is a small spread for entering and exiting trades.
  • What are stop-loss and take-profit orders?
    • These are 2 kinds of limit orders that prevent further losses or secure gains at prices set by traders. Note that in GMX, if a position is closed manually,  the associated limit orders will remain open unless manually canceled.
  • Why are limit orders not guaranteed to be executed?
    • Limit orders are not guaranteed to go through when:
      • The mark price, which is an aggregate price from centralized exchanges, did not reach the specified price in the limit order.
      • The specified price was reached but did not remain there long enough for the order to be executed.
      • No keeper picked up the order for execution.
  • How does the rebalancing of the basket of GLP assets work?
    • The fees to mint/burn GLP will change depending on whether the deposit/withdrawal of assets improves or worsens the balance of assets:
      • If the index has a large percentage of an asset, actions that increase that percentage will have a higher fee.
      • If the index has a small percentage of an asset, actions that increase that percentage will have a lower fee.
  • What is GLP?
    • GLP is an index of assets that are used for trading in GMX. It can be minted/burnt against any index asset and the pricing for minting/burning is calculated based on
    •  (total worth of assets in the index including profits and losses from open positions) / (GLP supply).
  • What are multiplier points?
    • Multiplier points are a mechanism created by GMX to reward long-term holders without token inflation. When GMX tokens are staked, the user receives multiplier points every second at a fixed rate of 100% APR (1,000 GMX staked for 1 year would earn 1,000 multiplier points). Multiplier points can also be staked for extra fee rewards.
  • What is the difference between GMX & esGMX?
    • esGMX tokens are escrowed GMX; locked GMX tokens that are subject to vesting rules. Your esGMX can either be staked, to earn rewards just like normal GMX tokens do, or vested in your GMX or GLP Vault. They can not be sold. While vesting, esGMX tokens earn no rewards and linearly unlock to become GMX over the course of 365 days.
  • Will I lose my Multiplier Points if I unstake my GMX?
    • Yes, when you unstake, Multiplier Points get burned proportionately to the amount unstaked (eg if you unstake half your GMX, half your Multiplier Points are burnt).
  • What is the planned, long-term emissions schedule?
    • esGMX emissions are tapering off. The main use of esGMX emissions is to incentivize the decentralization and usage of the protocol. As GMX adoption increases, esGMX emissions to stakers and liquidity providers are decreased. This process of reducing token inflation is currently underway. The goal is for the protocol to reach a state where esGMX incentives are no longer necessary.
  • Does GMX have sufficient runway? What about long-term financial sustainability?
    • GMX has sufficient runway to compensate its paid contributors for, at least, another 1,5 years as of the time of writing (January 2023). At mint, 1 million GMX tokens were reserved for marketing, partnerships, and community developers. Additionally, bond sales of discounted GMX are ongoing via Bond Protocol. 50% of the proceeds of those bond sales help fund the protocol’s further development.

Community Links

Project Links

Token Links

Get a 10% discount on all trading fees at GMX by using our referral code. Click here https://app.gmx.io/ to start trading.

Useful Tools

Crypto Community Links/Resources