Decentralized Perpetuals Part 1: GMX and dYdX

    Matthew Fiebach and Sam Martin

    Key Takeaways

    • GMX and dYdX offer a decentralized alternative to CEXs for leveraged trading.
    • GMX generates substantial revenue from platform trading fees that is returned to GMX stakers and GLP LPs in the form of ETH and AVAX.
    • dYdX has proven to be the dominant leveraged trading venue in DeFi, but its token lacks value accrual and its move to an app-specifc L1 presents numerous challenges.
    • Whether GMX will overtake dYdX as the most popular dapp for leveraged trading remains to be seen, but it seems likely that dapps will continue to eat CEX derivative market share given the monetary incentives the former group provides.

    Perpetual futures or “perps” are a form of cash settled futures with no set delivery date. They give traders the ability to get synthetic long or short exposure to an asset with an infinite duration, until they decide to close their position. Unlike traditional futures contracts that often represent a large quantity of the underlying asset, the contract size is generally one of the underlying, and for some coins, a fraction. Buyers and sellers pay each other a fee known as the funding rate.

    The funding rate helps keep the perp price in line with the underlying asset's spot price. When the perp trades at a premium, longs pay shorts. Conversely, at a discount, shorts pay longs. Although the funding rate can take place at any cadence, it is generally set to one hour. If a perp trades at a 0.1% discount for 24 hours, purchasers of that perp will receive 0.1% as the summation of the 24 funding period.

    Although theorized as early as 1992, Bitmex was the first exchange to launch perpetual futures in 2016. Today, FTX and Binance rule perp trading by volume. Perps are a crypto native instrument and largely do not exist for traditional financial markets.

    Decentralized perpetual futures exchanges employ smart contracts in order to facilitate trading in a decentralized manner. Traders maintain control of their funds at all times. dYdX and GMX are the largest players in the decentralized perp space.

    GMX Overview

    GMX is a decentralized exchange that supports spot and margin trading on Arbitrum and Avalanche. It is able to offer zero price impact trades through the use of Chainlink oracles and price feeds from large CEXs, instead of relying on arbitrageurs like many other AMMs in DeFi. This is an important distinction for GMX because LPs do not bear the burden of price discovery through impermanent loss, as is the case with other AMMs. Another important distinction to make for GMX in relation to dYdX is the fact that they are technically not a perpetual futures exchange because they utilize oracles for pricing instead of relying on funding rates. Liquidity is provided through a basket of assets called GLP, which consists of BTC, ETH, USDT, USDC, LINK, UNI, FRAX, AVAX, and DAI depending upon which chain the dApp is deployed. GLP liquidity providers are essentially the “house” while traders are the “gamblers”. Leveraged traders borrow assets from the GLP basket to gain exposure, with the borrowed collateral for long positions being the same as the token being longed and the borrowed collateral for short positions always being stablecoins.

    GMX is a very attractive place to conduct asset swaps in DeFi given their zero slippage nature and minimal fees to open and close positions. Its leveraged trading differs from other decentralized perps platforms in terms of funding rate calculations and price retrieval, but is similar in regards to enabling users to long or short any of GLP’s underlying assets with up to 30x leverage. The growth of GMX despite the broader crypto bear market has been impressive. We expect this growth will only accelerate with the Arbitrum Odyssey event set to resume in September after the implementation of Abitrum’s Nitro upgrade.

    Funding Rates and Fees

    The cost to open or close a position is fixed at 0.1% of the position size for both swaps and leveraged trades. If a swap is required when opening or closing a position, then the regular swap fee of 0.2 - 0.8% of the collateral size is applied, ultimately determined by whether the swap improves the target balance of GLP’s asset weighting. Additionally, there are dynamic execution fees charged by keepers to execute transactions on-chain. These fees might seem high at first glance, but they are mostly offset by GMX’s zero price impact oracle model.

    As previously mentioned, funding rate calculations are much different on GMX than dYdX and other decentralized perps applications. On CEX’s such as Binance or FTX the funding rates offset one another i.e. a positive funding rate of 0.02% means shorts are being paid 0.02% by longs to keep their position open. This model ensures that the perp price remains close to the underlying asset’s spot price. GMX does not rely on the funding rate to keep prices in line with spot, so it can instead derive its funding rate based on GLP asset utilization. The fee can be calculated by dividing the assets borrowed by the total assets in the pool and multiplying it by 0.01%. This borrow fee is deducted from a user’s balance every hour the trade is open and paid out to GLP LPs and GMX stakers.

    Crypto funding rates have historically been positive over long periods of time, which gives bearish traders little incentive to use GMX. They are instead better off opening a short position on a perps platform that will pay them to be short (a positive funding rate where longs pay shorts, not GLP LPs). Another point raised by GMX skeptics is that LPing is risky during strong trending markets. GLP is constantly lending out assets to leveraged traders with a funding rate that fails to keep long and short positions balanced. In a scenario where the market runs up and most open interest is long, then GLP LPs net heavy losses. Similarly, if traders are heavily positioned short and the market tanks, GLP LPs net heavy losses in terms of dollar denominated AUM as well as paying out winning shorts in stablecoins. While these are certainly valid critiques of GMX’s design, GLP has continually outperformed popular LP positions after baking in fee revenue.

    Liquidations

    A liquidation is triggered on GMX when a user’s collateral, less unrealized losses and borrowing fees, falls below 1% of an open position’s size. Any funds remaining are returned to a user’s wallet after the liquidation is executed. The liquidation value will constantly change on an open position, not only due to price changes in the assets being traded but also as borrowing fees accrue over the lifespan of a trade. As displayed in the following chart, historical trader PnL is deeply negative despite some of the aforementioned concerns around LPing for GMX through GLP during a strong trending market.

    Tokenomics

    GMX is the governance token and GLP is the LP token of the GMX protocol. GMX token holders can elect to stake their tokens for 30% of protocol fees paid out in ETH or AVAX for Arbitrum and Avalanche stakers respectively. In addition to protocol earnings, GMX stakers earn escrowed GMX (esGMX), which can be staked to earn a larger share of esGMX and ETH rewards or converted to GMX over a 12-month vesting period, and multiplier points that increase staker’s share of protocol revenue. These strong incentives have led to the staking of 6.91M GMX tokens of the 7.98M supply across Avalanche and Arbitrum; a circulating supply stake rate of more than 86%.

    GLP holders, or GMX LPs, receive 70% of protocol earnings in the form of ETH or AVAX for Arbitrum and Avalanche respectively. GLP can be minted by providing supported assets to the basket, or burned for any of the assets in the basket. The fees to mint or redeem GLP are determined by GLP’s composition: if the index is overweight BTC but underweight USDT, any action that withdrawals USDT from the index will result in a higher fee than any action that would reduce its exposure to BTC. The target token weightings of GLP are adjusted based on trader positioning to reduce risk for GLP LPs. If a lot of open interest is long BTC, then the target token weight for BTC would increase alongside fees related to actions that would reduce GLP’s BTC exposure. Conversely, if a lot of open interest is short BTC, then the target token weight for stablecoins would increase alongside fees related to actions that would reduce GLP’s stablecoin exposure.

    GLP and GMX holders are the prime beneficiaries of the success of the GMX protocol. GLP’s AUM is hovering near all-time high’s of $343M. The higher TVL backing GLP, the more volume that can be traded on GMX, which increases the amount of protocol revenue returned to GMX stakers and GLP LPs. The ~$80M of fees generated over the past 12 months has resulted in $56M of revenue for GLP LPs and $24M for GMX stakers.

    dYdX Overview

    dYdX V3 is a decentralized exchange for trading perps with up to 20x leverage. The user experience is much the same as trading on a centralized order book exchange such as FTX or Binance. The orderbook nature where all trades must be matched by a counterparty diverges from GMX’s AMM model. All deposits are converted to USDC, the only collateral asset. The smart contracts live on their own Layer-2 zk rollup through StarkEx and there are no gas fees for trading. The exchange’s V4, set to launch early 2023, will move dYdX to its own Layer-1 application specific chain built with the Cosmos SDK. V3 has done almost $700 billion in volume since launch in early 2021.

    Funding Rates and Fees

    An index price for each asset is calculated using price data from exchanges such as Coinbase, Binance, FTX, Gemini and more. The median of best-ask best, best-bid and last-traded prices is taken to calculate a spot price for each asset. The median of all exchanges' spot prices is deemed the index price. A premium is calculated using the index price compared to the average execution price of a $5000-$10000 market order, depending on the initial margin fraction for a pair. The premium is found each minute and the TWAP over an hour divided by 24 is the hourly funding rate. In the scenario the perp trades at a premium, longs pay shorts, and vice versa at a discount.

    dYdX has lowered their trading fees twice over the last year and offers rates competitive with any other exchange. Trading fees are further discounted for holding a Hedgies NFT or the DYDX token.

    Liquidations

    A position is liquidated when it falls below its maintenance margin requirement. The maintenance margin is 3% for BTC and ETH and 5% across all other pairs. In other words, a position size must not exceed 30x the collateral value for BTC and ETH and 20x for everything else.

    dYdX uses the median of 15 Chainlink nodes’ prices for an asset to calculate an oracle price. The oracle price is used to find the value of a position and whether the collateral meets the maintenance margin. When a position moves against the trader and falls below the maintenance margin, a liquidation engine automatically closes the trade.

    Tokenomics

    The primary use of the DYDX token is governance over the exchange and Layer 2 rollup. Holders also govern the treasury, currently made up of ~$40 million in DYDX. The token can also be staked to the safety pool and grants holders discounted trading fees. DYDX is awarded to traders based on their fees, functioning as an incentive mechanism to get users on the platform.

    The token is highly inflationary and has little mechanism for value accrual outside of its governance rights. It seems traders who receive DYDX rewards generally dump their tokens. There is some hope for the token in V4 of the exchange which will return fee revenue to token holders, outlined here.

    Comparing Exchanges

    Placing a trade on dYdX or GMX is much the same. Both exchanges allow market and limit orders to buy or sell an asset. dYdX has a few additional order types such as trailing stop and bracket orders. GMX allows for up to 30x leverage, 10x more than dYdX. GMX only has support for trading five assets today to dYdX’s 37. GMX has multiple collateral assets whereas dYdX only uses USDC.

    Despite the similar trading experience, the mechanisms deployed diverge. GMX functions as an automated market maker (AMM) whereas dYdX uses an order book (CLOB). Trading on GMX means trading against GLP holders, trading on dYdX is against a multitude of counterparties such as market makers. Pricing on dYdX is determined by market participants in a laissez faire manner with help from the funding rate, whereas, GMX pegs prices via an oracle. dYdX is a far more attractive exchange for traditional market makers as they are able to take advantage of market inefficiencies that are captured by GLP in GMX. The DYDX token incentives also help drive volume.

    dYdX currently leads the space, but GMX is new and encroaching.

    Protocol Tokens

    GMX and dYdX provide traders with a similar product, but each have entirely different token models. In their current states, GMX is structured in line with the ethos of web3 as a decentralized protocol, whereas, dYdX takes a more corporate approach with their app-specific rollup that returns revenue to a centralized entity. In defense of dYdX, protocols typically decentralize over time and they have prioritized decentralization over performance in their recent commitment to launching an app-specific chain on Cosmos.

    GMX employs a two token model between GMX and GLP where all protocol revenue flows back to GMX stakers and GLP LPs in the form of ETH or AVAX. The $45B of all-time trading volume seen on GMX is dwarfed by dYdX’s ~$700B, but has resulted in nearly $80M returned to stakeholders while the company behind dYdX has extracted all of the revenue leaving token holders with nothing. It is also worth noting that in contrast to GMX, dYdX uses its native token to incentivize trading volume which is unsustainable over the long term. The token incentives seem like a good deal for traders at first glance, but are essentially extracting value from them by swapping an inflationary token with constant sell pressure for USDC trading fees.  

    We believe dYdX’s move to Cosmos will provide more value accrual for their token, but more decentralized processes could lead to degraded performance. The move will require dYdX to spend more on security, introduce MEV-related problems, and apply transaction fees to a user base that has grown accustomed to 0 gas trading. Nearly 87% of the circulating GMX supply is staked despite a hefty portion of the rewards requiring a vesting period of 12 months versus dYdX’s stake rate of ~23% with minimal withdrawal delays. This is a testament to investor’s preference for tokens that generate yield from organic activity that are in part paid out in exogenous collateral over inflationary rewards paid out in a project’s native token.

    Final Thoughts

    GMX has numerous tailwinds as we ride out the rest of 2022. They are continuing to improve platform reliability and polishing the UI. The Arbitrum Odyssey will resume with the Nitro upgrade having gone live on August 31, and they plan to launch synthetics in the coming months to give traders access to more long-tail assets. On the other hand, dYdX has been the dominant player in the leveraged trading space but faces significant headwinds as it embarks on its app-specific chain deployment. They currently have the most volume, DAUs, and best UX on the market, and the move to their own chain opens up the door for token value accrual and true decentralization. However, it remains to be seen if dYdX will be able to seize the opportunity while overcoming the tradeoffs between the Cosmos SDK and StarkEx’s app-specific rollups.

    The opportunity for decentralized derivative products to trade digital assets is absolutely huge. Centralized exchanges FTX, Binance, and BTCEX held a 98.4% market share on futures trading volume on August 31 when compared to dYdX and GMX. Given that GMX (and soon dYdX) redistribute trading fee revenue back to token holders, it seems plausible dapps will continue to eat CEX trading volume over the coming decade. For more on the 2022 outlook for dYdX and GMX, check out our Q2 report which discusses their roadmaps at a deeper level.