DeFi Exchanges
Decentralized Exchanges (DEXes) have a wide range of amazing properties: they are often censorship-resistant, meaning they are guaranteed to be open to anyone, noncustodial, meaning you don’t need to trust the custody of your funds to anyone, and permissionless meaning anyone is free to create new markets. These properties, however, usually come at a high cost for economic efficiency regarding trade execution quality.
DEXes, particularly ones that do on-chain order matching, are often very inefficient. Users not only often pay high gas fees, but their orders are also constantly frontran and sandwiched, resulting in high transaction costs. This constitutes the most controversial part of what is called maximal extractable value (MEV), the money that blockchain validators can make by reordering transactions in a block.
However, even the less controversial parts of MEV are also indirectly bad for the users. Liquidity pools or automated market makers (AMMs), a class of liquidity providers that is often used by DEXes, constantly lose money to arbitrageurs, and that shows up as a loss-versus-rebalancing (LVR) for liquidity providers. This means that users provide liquidity on AMMs constantly lose money if they attempt to maintain a balanced position (keeping exposure to assets constant). This is the most important component of what is sometimes called impermanent loss (IL). Liquidity pools have to generate enough trading fees to offset LVR to become economically viable.
Protocols such as 0x introduced the concept of off-chain order matching with posterior on-chain settlement. A user sends signed orders to a relayer, who has the right to match them and later submit trade settlements on-chain. Because trade amounts and prices are determined by the relayer, there is no money to be made by reordering such settlement transactions in a block.
Improving upon this idea, protocols such as Loopring and StarkEx moved the trade settlement to a ZK-rollup. This allowed thousands of trade settlements to be condensed in cryptographic proof and submitted in a single on-chain transaction, decreasing gas costs dramatically.
As a result of these developments, non-custodial exchanges now have the potential to offer the same trading efficiency as centralized exchanges, without sacrificing security guarantees. However, they currently are way behind centralized exchanges in the amount of liquidity they can offer. Trading fees or market spreads are significantly higher, and order books are much shallower.
Newer protocols such as GMX do away entirely with both AMMs and orderbooks, and instead trade directly against their users through the use of price oracles. While an interesting bootstrapping technique, the use of a price oracle does not allow for internalized price discovery, and either significantly limits liquidity or makes the protocol susceptible to price manipulation.
Last updated