2. Related work
Genius DEX v1
Last updated
Genius DEX v1
Last updated
Decentralized exchanges (DEX) are a type of cryptocurrency exchange protocol enabled by smart contracts. They allow for the execution of secure and direct peer-to-peer cryptocurrency transactions. In this scenario, the intermediary is replaced by a distributed ledger, the blockchain. There are two main types of exchange architectures: Automated Market Makers (AMMs) and order books. AMMs are simpler to implement and are the de facto design choice for account-based ledgers like Ethereum. However, the following sections will describe why an order book architecture is far more suitable for an UTxO-based ledger.
The first AMM-based DEX was implemented by Uniswap on the Ethereum blockchain [18]. It is a protocol that incorporates an autonomous trading mechanism and relies on a mathematical formula to price assets, eliminating the need for an intermediary (Fig. 5). Such protocols are permissionless, trustless and decentralized. They allow users to concurrently act as market takers (swap a digital asset for another) and market makers (provide liquidity to a DEX in exchange for trading fees).
There are different pricing formulas but the most commonly used is the Constant Formula Market Maker (CFMM) [19]. They have the desired property that price response can be easily computed no matter how large the order size nor how tiny the liquidity pool. Their simplicity and robustness have made this design the most commonly used by DEXs. However, they possess significant limitations that are often overlooked. First, capital allocation is highly inefficient compared to traditional markets. The DEX’s Total Value Locked (TVL) is equally distributed across the entire price range (0, ∞), implying that the price of an apple is equally likely to be $1 or $10,000. This assumption makes the CFMM unrealistic and doesn't reflect actual market conditions. The main drawbacks of such capital inefficiency are borne by the DEX’s liquidity provider since their revenues earned from trading fees are diluted. At the same time, their liquidity is subject to impermanent loss.
Impermanent loss is the perceived loss in total asset value from liquidity deposited into a pool, compared to just holding the assets. It is due to a change in pool assets ratios (i.e. price) between a deposit and a withdrawal. This puts liquidity providers at a real disadvantage even including revenue from trading fees. Therefore, in the absence of liquidity mining incentives AMM pools with high impermanent loss will see their liquidity drained overtime.
The order book design, although rarely used in DEXs, is the go-to architecture employed by large exchanges in traditional finance, for example Robinhood and Coinbase. An order book is a registry of buy orders (bids) and sell orders (asks) at each price point (Fig. 6). In such a system, market makers help stabilize the price by filling trader’s orders and tightening the bid-ask spread.
Order book exchanges are capital efficient because price is maintained locally, where the bids meet the asks. The price is not a global state (like in an AMM), but an emergent dynamic property of the order book, allowing for an arbitrary liquidity curve as opposed to a deterministic one. Moreover, rich pricing and volume information is made visible to traders, making informed trading decisions easier by understanding market demand and supply. On an AMM only market orders are possible (trades at the current price), whereas order book exchanges work with limit orders. Limit order is an order to buy or sell at a specified price, which remains in effect until executed or canceled by the user. In practice, it allows for more sophisticated trading strategies commonly used in traditional finance and also allows the trader to name their price.
Why are order books not widespread in DEXs? Historically, AMM-based protocols have been easier to implement on account-based blockchains to mitigate transaction costs, settlement speeds, and complexity. In an order book exchanges, liquidity is inherently distributed across bids and asks. Matching orders involve complex operations that require highly scalable matching engines, making them both technically and economically infeasible in an account-based paradigm.
AMM DEXs came out of the account-based mindset spearheaded by Ethereum. On Cardano, DEXs will be fundamentally different as they will need to take a UTxO-first approach to be successful. In a UTxO model, state fragmentation and parallel processing are base features of the ledger and coincidentally a natural design pattern for order books. The order book design has been battle-tested in traditional finance and has demonstrated to be both a powerful and efficient way to run large scale exchanges. UTxO-based smart contracts might just be the right abstraction the industry needed to make such exchanges feasible on a blockchain.
Concentrated liquidity is when Liquidity Providers (LPs) can allocate their capital to a DEX at selected price ranges. It is in contrast to regular liquidity pools where liquidity is distributed uniformly across the entire price range. As mentioned in the AMM section, this results in high capital inefficiencies and impermanent loss. Concentrated liquidity pools attempt at remediating AMM’s limitations.
In Uniswap’s v3 whitepaper [20], the concept of concentrated liquidity pools is introduced, in which LPs can allocate their capital at specific price ranges called Range Orders. When asset prices exit the range order bounds, no liquidity is provided and consequently no fees are collected. This unlocks tremendous capital efficiency gains for liquidity providers (market makers) who can manually adjust their exposure based on their trading strategies (Fig. 7). As a result, LPs can earn more rewards with less capital investment and incur less impermanent loss.
Instead of a fixed liquidity curve defined by the CFMM formula, the Uniswap V3 DEX allows the market sentiment to decide on the liquidity distribution in a decentralized way. This is, in fact, what naturally occurs in an order book system and the development of the concentrated liquidity AMM attempts at replicating these desirable properties.
LPs can now create as many liquidity positions as they see fit. However, although more flexible than static AMMs, a concentrated liquidity AMM still isn't as flexible and efficient as an order book exchange. A drawback of concentrated liquidity pools is that they require active and frequent manual “rebalancing” of a LP’s position to remain within the optimal price range and maximize rewards. For blockchains with high transaction fees, for example Ethereum, frequent rebalancing may not even be economical as rewards get canceled out by fees paid for the liquidity rebalance. Nevertheless, unless you are a day trader with technical understanding of the market, inefficient allocation of liquidity can still occur in a concentrated liquidity pool.
For these reasons, Genius Yield believes it is necessary to augment a concentrated liquidity DEX by overlaying a secondary protocol that can algorithmically automate asset allocation to maximize users’ APYs, while minimizing risk exposure. Genius Yield’s Smart Liquidity Management solution will be an AI-powered protocol able to execute various trading strategies based on the user's predefined risk tolerance, expected returns and timeframe. We will dive deeper into the Smart Liquidity Vault protocol in a later section.
In practice, Uniswap V3 is implemented by fragmenting the liquidity pool into thousands of individual price ticks (price increments). Each price tick accumulates liquidity independently, allowing for an arbitrary liquidity curve (Fig. 8). Range orders are minted as NFTs, represented as a LP’s active position. Positions are closed and rewards cashed out by simply burning the NFT.
Upon closer look, the fragmentation of a liquidity pool maps nicely to the UTxO paradigm. Instead of tracking the pool liquidity in one UTxO, as it would be the case for an AMM, the price ticks dividing the liquidity can each be tracked by a separate UTxO. As a result, concentrated liquidity doesn’t just make the DEX more capital efficient, it also maps well to the UTxO paradigm (more detail in Section 3.2).