ByteTrade Lab: Taking GMX as an Example, A Detailed Explanation of the Innovative Path of On-Chain Perpetual Contract Protocols

ByteTrade
2022-12-02 11:28:52
Collection
The aftermath of the FTX explosion is still ongoing, and discussions about decentralization and transparency are intensifying. In the past few months, perpetual contract protocols like GMX have also garnered significant attention.

Original source: Bytetrade Lab by Frank Hu and Kester Wu

Original title: "Innovations of On-Chain Perpetual Protocols Part 1"

Compiled by: Qianwen, ChainCatcher

The aftermath of the FTX collapse continues, and decentralization and transparency are receiving increasing attention. The migration of trading activities from CeFi to DeFi is no longer a question of "if," but rather "when."

In recent months, perpetual contract protocols like GMX have gained significant attention. An independent ecosystem has developed on top of GMX's unique design.

Key Takeaways

GMX operates entirely on-chain and uses AMM functionality to enable leveraged trading.

On GMX, traders have full visibility of their counterparties, which is completely different from trading on CEX.

Unlike other perpetual contract protocols like dydx, GMX operates entirely on-chain and uses AMM functionality to enable leveraged trading.

The GLP pool consists of 50% stablecoins and 50% blue-chip assets ($ETH, $BTC, $UNI, and $LINK). GMX uses the GLP pool to provide traders with four token/USD trading pairs.

GMX operates a dual-token model: $GLP and $GMX.

$GLP is the "liquidity proof" receipt for LPs, while $GMX is the utility and governance token of the protocol.

Trading on GMX is a zero-sum game:

If a trader wins, LPs lose. If a trader loses, LPs win.

Main Benefits of GMX:

  1. Zero slippage

  2. High capital efficiency

Main Challenges of GMX:

  1. Trading bias faced by LPs

  2. Inability to balance open interest (OI)

  3. Oracle manipulation

  4. Lack of trading pairs

GMX

GMX is a decentralized spot and perpetual exchange that offers traders the ability to trade assets with up to 50x leverage. The protocol currently operates on Arbitrum and Avalanche, providing four token/USD pairs for trading on each chain.

On GMX, traders have full visibility of their counterparties, which is completely different from trading on CEX. Unlike other perpetual contract protocols like dydx, GMX operates entirely on-chain and uses AMM functionality to enable leveraged trading.

Single Multi-Asset Pool

Compared to other DEXs that operate with single-asset liquidity pools, liquidity providers (LPs) on GMX provide liquidity to a single multi-asset pool.

LPs provide liquidity by minting $GLP. $GLP is an asset that tracks the price movements of the underlying index. $GLP is the "liquidity proof" receipt for LPs.

The $GLP pool on Arbitrum is an index composed of approximately 50% stablecoins ($USDC, $USDT, $FRAX, $MIM) and 50% blue-chip tokens ($ETH, $BTC, $LINK, and $UNI).

image

The above image shows that the majority of the $GLP pool is composed of USDC, $ETH, and $BTC.

$GLP can:

  1. Be minted using any underlying index asset

  2. Be burned to redeem any related index asset

Assets within the multi-asset pool are used for trading, allowing traders to take leveraged positions in any direction.

Example of 30x Long ETH

image

A trader posts 1 $ETH as collateral and establishes a 30x long position on $ETH on GMX. The trader secretly borrows 29 $ETH from the liquidity pool, creating a 30 $ETH long exposure. Depending on the trading outcome, the $GLP pool will be affected differently.

If the trader profits, they withdraw (1 + profit) $ETH from the $GLP pool.

If the trader incurs a loss, they withdraw (1 - loss) $ETH from the $GLP pool.

image

The trading outcome translates into differences in GMX's open interest (OI). The $GLP pool is directly affected by the trading results and direction. Therefore, it is necessary to rebalance the asset weights within the $GLP pool.

GMX rebalances the $GLP pool in 2 ways:

1. $GLP Minting/Burning Fee Discounts

image

As mentioned, LPs can mint $GLP using any underlying index asset. Since OI determines the demand for assets, each asset in the pool has a target weight. Therefore, GMX offers lower minting fees for $GLP and higher burning fees for $GLP, encouraging each asset to move toward its target weight.

To illustrate this, consider an extreme example:

Take $UNI, which has the smallest weight in the $GLP pool. By minting $GLP with $UNI, LPs can pay the lowest minting fee. Conversely, minting $UNI with $GLP will incur the highest minting fee.

2. Trading Fee Discounts

image

In addition to leveraged trading, users can trade between different index assets on GMX. GMX attempts to raise the cost of exchanging low-weight assets to rebalance the $GLP pool.

As shown in the above image, trading $UNI (removing this low-weight asset from the $GLP pool) incurs a higher fee of 0.52%, while trading $USDT (removing this high-weight asset from the $GLP pool) incurs a lower fee of 0.34%.

Token Economics

GMX adopts a dual-token model: $GLP and $GMX.

image

$GLP

$GLP is the "liquidity proof" receipt for LPs.

It is important to note that:

  1. Holding $GLP exposes LPs to price fluctuations of the underlying assets in the $GLP pool.

  2. The yield earned on $GLP depends on two factors: 1) trading volume 2) trader losses.

Providing liquidity on GMX is a zero-sum game: since trading outcomes directly affect the $GLP pool, LPs are always the counterparties in trades.

image

Main Advantages of GMX

1. Traders on GMX enjoy zero slippage

Slippage is defined as the difference between the expected price of a trade and the execution price of the trade.

GMX uses a custom oracle to extract prices from three CEXs (Binance, Coinbase, and BitFinex) to achieve "zero slippage." Previously, FTX was also among these three major CEXs but was replaced by Coinbase.

2. High capital efficiency

The enablement of leverage allows GMX to have extremely high asset utilization, which means higher returns for $GLP LPs. During peak periods, GMX's AUM daily utilization rate approaches 300%.

image

In comparison, spot DEXs like PancakeSwap have an asset utilization rate of only about 15.0% (calculated as trading volume/TVL=433.5/2900=~15.0%).

image

Main Challenges of GMX

1. LPs may face trading bias

In strong trending markets (bull or bear), there may be a specific OI bias. In such cases, traders may unilaterally enter long or short positions.

image

For example, in a bull market, most traders want to go long. When traders hold long positions, the asset is "borrowed" from the $GLP pool. Referring to the above figures, in September 2021, long OI was 97%. In cases where traders make significant profits, the asset holdings in the $GLP pool ($ETH or $BTC) may be depleted.

It is worth noting that in September 2021, GMX had only about 100 users. Therefore, trading bias can easily be influenced by larger trades. As the number of users grows, it will become more difficult to affect the overall trading bias of the protocol.

Conversely, in a bear market, when traders short the market heavily, the GLP pool will pay out stablecoins while the value of other tokens in the index continues to decline. Referring to the above figures, in November 2022, short OI peaked at 76%.

In cases where most short traders profit, $GLP holders will be affected in two ways:

(1) Loss of stablecoins

  • The prices of related assets decline.

Understanding this, it becomes clear that the impact of short bias on $GLP holders is greater than that of long bias.

image

Data from 3M shows that trading did not severely skew in one direction. However, in light of the recent FTX failure, the proportion of trades biased toward shorts was 65%, soaring to 76.5% on November 11, 2022.

image

In summary, traders lost nearly $3 million on November 9.

image

2. Lack of OI balancing

The above challenges are exacerbated by GMX's lack of an internal mechanism to balance OI.

GMX calculates its funding rates based on asset utilization. Regardless of concentration, the funding rates for long and short positions are always positive (meaning that traders always need to pay a rate whether they are long or short).

On CEXs, funding rates financing rates are typically used to balance OI. Since funding rates are paid on a peer-to-peer basis, they serve as a natural catalyst that promotes price convergence.

image

When the funding rate is positive, the price of perpetual contracts is higher than the spot price. Long traders pay funding to short traders. This incentivizes more traders to short perpetual contracts, bringing the perpetual contract price closer to the spot price, and vice versa.

3. Oracle manipulation

Oracle mispricing/manipulation during volatility can lead to "harmful arbitrage."

To address this issue, GMX uses a custom oracle that retrieves mid-prices from three CEXs (Binance, Coinbase, and BitFinex). Additionally, prices are updated at the start of each block—ensuring that every trade within the same block receives the same updated execution price, which helps prevent front-running.

Despite the protocol's efforts to maintain integrity, this oracle design remains susceptible to exploits. In September, GMX was exploited by a trader on Avalanche, resulting in a profit of approximately $565,000.

To understand this case study, we must consider several factors.

  1. Opening long/short positions on GMX does not affect CEX prices. This is because GMX is always a price taker, extracting prices from CEXs.

  2. Traders who understood this mechanism executed the following steps. They first opened a leveraged long position on $AVAX on GMX. Subsequently, they pushed the price up on CEX. When the price feedback updated on GMX, they closed their long position, profiting approximately $565,000.

  3. It is important to note that this can only be executed during times of low liquidity, when the market is susceptible to scale effects.

To address this issue, GMX temporarily imposed a formal cap on open interest for $AVAX. Ideally, there should be no need for manual intervention, as trading limits should only be constrained by the assets in the $GLP pool.

4. Lack of trading pairs

For traders interested in trading tokens, GMX is not a good choice. Currently, there are only four USD trading pairs on GMX for both Arbitrum and Avalanche.

Author Institution Profile

ByteTrade Lab is based in Singapore and is supported by the Sea International Group (SIG) Asia Venture Capital Fund and several leading institutional investors, including INCE Capital, BAI Capital, Sky9 Capital, and NGC Ventures, having raised $40 million in Series A funding in June 2022.

ByteTrade is actively building its own Web3 operating system (OS), based on an open blockchain-edge node-client (BEC) architecture, which is a decentralized version of the original full-stack internet protocol, aimed at mass adoption of users and decentralized internet applications in Web3.0, ultimately returning data ownership to users.

In addition to being a builder of the Web3 operating system, ByteTrade is also actively incubating and investing in early Web 3.0 projects to establish an exclusive Web 3 operating system ecosystem. ByteTrade is committed to providing various resources to builders in Web3.0, including but not limited to: technology, product definition, business plans, GTM strategies, and funding.

ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
banner
ChainCatcher Building the Web3 world with innovators