ByteTrade Lab: A Detailed Explanation of DEX Innovative Features, Taking dYdX, GMX, KTX, and Bracket as Examples
Original Title: Innovations of On-Chain Perpetual Protocols Part 3
Authors: Frank Hu & Kester Wu, ByteTrade Lab
Compiler: Qianwen, ChainCatcher
Introduction
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."
This article will focus on the innovative features of derivatives DEXs, with the previous part detailed in “Taking GMX as an Example, Exploring the Innovations of On-Chain Perpetual Contract Protocols.”
Background
The collapse of centralized exchanges has led to a de-risking of self-custody/on-chain trading by centralized exchanges, as evidenced by the dominance of DEXs versus CEXs in the market from October 2022 to December 2022.
Source: TheBlock, Defillama, ByteTrade
While most on-chain trading volume still occurs on spot DEXs like Uniswap, the trading volume and TVL of on-chain derivatives protocols are also increasing.
Key Highlights
- Innovative features being implemented by derivatives DEXs include:
Cross margin on dYdX, hybrid or 100% stablecoin AMM pools, and social trading on KTX.
- Cross margin on dYdX allows traders to open multiple positions using the same collateral.
- Derivatives DEXs utilize two types of AMM designs:
1) Hybrid (stablecoin + asset)
2) 100% stablecoin.
- KTX adopts a hybrid AMM design and plans to utilize social trading to balance OI discrepancies on the platform.
- Decentralized options protocols operate in a peer-to-peer manner. In the "peer-to-peer" model, liquidity management is similar to that of spot trading. Liquidity providers deposit assets into a pool, from which traders can buy options.
- The integration of options remains limited, and the most likely integration between derivatives DEXs and options protocols is for asset price hedging.
- "Necessity is the mother of invention." There will be more adoption of DeFi and more trading on-chain, making it more likely for protocols to collaborate.
In traditional finance, derivatives are financial assets whose prices derive from underlying assets (stocks/bonds/commodities).
Derivatives DEX
This article will focus on some interesting features that DEXs provide to users.
Funds deposited into contract addresses will only be used for their intended purpose
Derivatives DEXs experienced a decline in trading volume in December 2022. However, innovations occurring within the industry keep optimism alive.
Cross Margin
Among many DEXs, cross margin is specifically used by dYdX when opening positions. Compared to isolated margin, cross margin allows traders to open multiple positions that share the same collateral.
Cross Margin Illustration
The margin requirement for the entire account is the sum of the margin requirements for each position.
The margin calculation for a single position is as follows:
Initial margin requirement = ABS(SxPxI)
Maintenance margin requirement = ABS(SxPxM).
Note: S is the size of the position, P is the oracle price, I is the initial margin requirement, and M is the maintenance margin requirement.
Thus, with the concept of cross margin, calculating the margin for an account only requires summing the total of all positions.
Total initial margin requirement = Σ(ABS(SxPxI))
Total maintenance margin requirement = Σ(ABS(SxPxM)).
Although cross margin is more flexible, it can be slightly cumbersome for traders who prefer isolated margin. On dYdX, isolated margin can only be achieved by creating separate accounts (using new wallet addresses).
AMM
dYdX operates an off-chain order book matching engine, while protocols like GMX, GainsNetwork, and KTX use AMM to facilitate order execution.
Derivatives DEXs utilize two types of AMM designs:
1) Hybrid (stablecoin + asset)
2) 100% stablecoin.
GMX and KTX utilize a hybrid multi-asset pool of "50% stablecoin + 50% blue-chip assets" to facilitate trading. KTX is currently on the BNB Chain Testnet, and readers can try out the protocol here.
Source: KTX
On the other hand, Gains Network uses a 100% DAI treasury to facilitate trading.
On Gains Network, regardless of the trading pair, DAI collateral is used for trading. Leverage is synthetic, supported by the DAI treasury, GNS/DAI liquidity, and GNS tokens. DAI is withdrawn from the treasury to pay traders' PNL (if positive) or to obtain DAI from trades with negative PNL.
The table below lists some key differences between the two designs:
GMX and KTX offer users leverage of up to 50 times the trading assets. By using a hybrid design, protocols like MMX and KTX are limited by the quantity of each individual asset in the pool. The benefits and challenges of these two AMM designs are summarized as follows:
Social Trading
LPs on GMX and KTX face challenges from the price volatility of underlying assets. Some protocols, such as Rage Trade and Umami Finance, have begun to address this challenge. However, few AMM derivatives protocols attempt to mitigate the challenges of balancing OI.
KTX aims to establish an internal OI balancing mechanism through social trading.
Source: KTX
KTX Social Trading Logic Illustration
This feature has not yet been released, but the logic of social trading can be broken down into the following points:
Top traders will be selected from KTX's trading competitions based on total trading volume, total PnL (%), and PnL (in USD). These traders will be categorized into long and short traders.
Traders can participate in social trading by depositing assets/stablecoins into long/short treasuries and minting receipt tokens.
The trading scale of the social trading treasury will be limited.
The minting/burning fees of treasury receipts will also be adjusted based on KTX's current OI. For example, if more trades lean towards long positions, the fees for traders depositing into the long treasury will be higher, creating a natural balancing mechanism for OI on the protocol.
Options
Options are contracts that give their buyers the right to buy/sell the underlying asset at a specific price.
Call options provide the option buyer with the right to purchase an asset at a certain price, while put options provide the option buyer with the right to sell an asset at a certain price. In centralized exchanges, options are traded in a peer-to-peer manner. Options are sold by those who have collateral of the underlying asset, and then the option buyer can purchase this option and pay a premium to the option seller.
For decentralized options protocols, options are traded in a peer-to-pool manner. In the peer-to-pool model, liquidity management is similar to that of spot AMMs. Liquidity providers deposit assets into a pool, from which traders can buy options.
The following diagram shows a simplified example of a peer-to-pool model:
Option sellers can passively earn by providing liquidity of (1) underlying assets ($ETH/$DPX) and (2) quote assets ($USDC/$2CRV) to write call and put options, respectively. These collateral assets are deposited into a contract that sells call options to buyers at a fixed strike price, expiring at the end of the epoch (week/month).
Taking Dopex as an example, the peer-to-pool model includes different option timeframes (weekly/monthly/quarterly), but also brings inherent challenges of capital inefficiency and liquidity fragmentation.
Building Mechanism Around DEX Options Protocols
The uses of options are vast, and any financial yield can be created using put and call options. However, the integration of options remains limited, and the most likely integration between derivatives DEXs and options protocols is for asset price hedging.
Asset Price Hedging
Since protocols like GMX and KTX operate hybrid multi-asset pools, LPs face significant price volatility of underlying assets, which can be hedged using options.
For example, by providing liquidity on GMX/KTX, LPs receive tokens called $GLP/$KLP. The function of $GLP is similar to that of an ETF, with its price based on the underlying assets (mainly $BTC and $ETH), including fees generated from trading activities on GMX. As shown in the diagram below, the price of $GLP is adversely affected by the decline in the prices of $ETH and $BTC. However, since the GLP pool consists of about 50% stablecoins, the price of $GLP experienced a 36% decline, while the prices of $ETH and $BTC fell by 65%.
In this case, options can be used for risk management. As mentioned, purchasing call/put options gives the buyer the right to buy/sell the underlying asset at a certain price. Since LPs want to minimize losses, they would naturally purchase put options.
The Bracket protocol on Arbitrum or BNB Chain is providing this service for DeFi participants.
Bracket operates in a peer-to-pool model, as shown in the diagram below:
Investors will deposit stablecoin collateral and make "quotes" to buyers. These "quotes" include out-of-the-money long/short contracts based on the market spot price at the time of purchase.
Several variables need to be considered when purchasing contracts:
The profit situation for the buyer of the short contract is illustrated below:
When purchasing options, the buyer receives an ERC-721 NFT uniquely associated with each Bracket contract. This NFT tracks the ownership of the contract and makes the contract tradable, creating a potential secondary market.
The above points are packaged into a one-click experience. Bracket can integrate with other protocols through widgets, providing seamless "price protection."
Source: Bracket Labs
LPs on GMX and KTX can purchase price protection with the corresponding weights of $ETH and $BTC.
Challenges
One of the challenges that Bracket may face is the automatic pricing of options. Option pricing is very complex and involves more variables (expiration time, strike price, implied volatility, risk-free rate) compared to the simpler "constant product formula" used by spot DEXs.
Most peer-to-pool options protocols utilize the Black-Scholes model to price options premiums on-chain and ensure that prices are updated in an automated and timely manner.
Black-Scholes Model
This operation is cumbersome because:
1) The input values for the model are difficult to determine (e.g., what is the risk-free rate for cryptocurrencies?).
2) Inputs often come from off-chain and require continuous oracle updates. Delays between actual price changes and oracle updates can allow bots to profit from re-pricing lagging options. As we have seen from the Mango/GMX exploit, oracles are also one of the most frequently attacked vectors in DeFi.
3) General blockchains are unlikely to provide the throughput needed to accurately and completely update prices on-chain. Traditional market makers use custom hardware to update 1000 option prices whenever there is a price change at each point.
Conclusion
Necessity is the mother of invention.
There will be more adoption of DeFi and more trading on-chain, making it more likely for protocols to collaborate. With DEXs (spot or derivatives) as the foundational layer, other protocols can stack on top like Lego blocks.
Some potential ideas worth exploring include:
- Using covered options to increase yield
For protocols like GMX and KTX, LP tokens generate implied prices based on the underlying tokens in the pool and the fees charged. In different scenarios, it may be possible to write covered options on LP tokens to enhance yield and profit efficiency.
However, there may be issues related to option pricing.
- Collateralized debt positions + minting stablecoins
LP tokens/shares have intrinsic value as they represent a certain share of the pool. Banks can accept stocks/bonds as loan collateral, similarly, lending protocols (Aave, Radiant Capital) may consider LP shares as collateral.
Potential issues:
The collapse of DEXs. When the price of LP shares declines, liquidations by lending protocols could lead to the collapse of DEX TVL.
LP shares may be locked, making immediate liquidation impossible when locking occurs. However, a possible solution is to use semi-fungible tokens (ERC-3525).