Introducing the Discretized Liquidity AMM with Limit Orders
Introduction & Background
Ref Finance v2 is bringing the future of trading to NEAR: a Discretized Liquidity AMM (DLAMM) with limit orders. Launching in the coming weeks, you can soon enjoy a CEX-like trading experience with all the DEX benefits.
1. The collapse of FTX points to the necessity for DEXs with trading experience comparable to CEXs.
2. Ref Finance is launching its v2, the core components of which are its discretized liquidity AMM (DLAMM) and limit orders.
3. DLAMM is an improved version of Uniswap v3’s concentrated liquidity, with more accurate liquidity provision, increased capital efficiency, and near-zero slippage.
4. Ref v2 also has built-in limit orders. Traders can place market- and limit orders with near-zero slippage, bringing a CEX-style trading experience on a DEX.
5. Ref v2 can be enjoyed faster and cheaper than almost any other chain, thanks to NEAR’s fast finality (1–2s) and negligible fees (<$0.01).
6. Discretized liquidity AMM is a positive sum game where LPs and traders both win.
With the recent collapse of one of the world’s biggest centralized exchanges (CEX), FTX, the crypto community quickly awakened to the importance of decentralization. Adoption to decentralized finance (DeFi) protocols, especially decentralized exchanges (DEXs), grew as people recognized the necessity for transparency and self-custody over one’s assets.
With DEXs more important now than ever, let us take a look at where they are headed. In this article, we will analyze the evolution of DEXs through its prime example, Uniswap, and introduce the next phase of its development: discretized concentrated liquidity.
Recap of Uniswap v1, v2, and v3
In November 2018, Uniswap v1 launched mostly as a proof of concept. It introduced the idea of an AMM, leveraging the math behind the constant product equation, x * y = k. At the time, Uniswap v1 only supported ETH-ERC20 trading pairs and liquidity pools (LPs).
In May 2020, Uniswap v2 launched as an improvement upon v1. Some of the key improvements were the introduction of liquidity pools, ERC20-ERC20 pools, decentralized TWAP price oracle, and flash swaps.
In May 2021, Uniswap v3 launched. v3 introduced key innovations such as concentrated liquidity, as well as improved security, new fee-tiers, oracle feed development, and non-fungible liquidity. All in all, the main thesis of Uniswap v3 was to achieve better capital efficiency for the platform’s traders and the liquidity providers through the concept of concentrated liquidity.
What is concentrated liquidity? What benefits does it bring?
As opposed to AMMs, where liquidity is simply provided without specifying a range, concentrated liquidity means LPs can allocate capital to their preferred price intervals, which allows for a significantly higher capital efficiency.
Concentrated liquidity benefits all parties: traders and LPs.
LPs benefit from the capital efficiency of providing a narrow range of liquidity, generally which is utilized more by traders, which consequently can generate up to 4000x more fees compared to Uniswap v2.
Traders, in turn, benefit from the deeper liquidity
Uniswap V3 saw strong adoption from the crypto community thanks to its new concentrated liquidity model. Uniswap v3 volumes increased non-stop since its launch, quickly reaching a 97.2% dominance over Uniswap v2 in terms of daily volume.
Discretized Liquidity on Ref v2
In partnership with iZUMi Finance and Arctic, Ref Finance is proud to introduce Ref v2: the Discretized Liquidity AMM (DLAMM) with limit orders. Think Uniswap V3’s concentrated liquidity but better, and now with limit order functionality to bring the CEX trading experience on-chain.
Discretized Liquidity AMM vs Concentrated Liquidity AMM
Discretized Liquidity is the shorthand for DLAMM, which means “discretized liquidity automated market maker.” Existing concentrated liquidity AMMs, such as Uniswap v3, follow the constant product formula (X*Y=K), where the price changes continuously with the amount of X and Y tokens in the pool. Designed by iZUMi Finance, the discretized liquidity AMM uses a synthetic continuous constant product curve with a discretized constant sum formula (x+y=k), where prices are discretized in the AMM (see figure below).
This results in two major improvements for discretized liquidity AMMs: reduced slippage and more accurate liquidity provision within a price range.
How Ref v2 Improves Upon Uniswap V3
Ref v2 not only introduces the best parts of Uniswap v3 (capital efficiency) with its discretized liquidity AMM, but goes even further to enable a CEX-like trading experience normally impossible on DEXs with a built-in limit order functionality. And all of this, with the full benefits of a DEX: decentralized, secure, and transparent end-to-end transactions for traders and liquidity providers.
On Ref v2 you can..
- Enjoy high capital efficiency thanks to the Discretized Liquidity AMM
Just like on Uni v3, Ref v2 enables you to provide concentrated liquidity — i.e. liquidity that is specific to a price range. This means that as an LP you are able to provide liquidity to a price range that you think traders utilize more, for instance, and potentially collect way more fees than before. As a trader, you can potentially enjoy deeper liquidity in the price ranges that you frequent, as liquidity doesn’t have to be spread out across the entire range anymore.
2. Enjoy Uni V3-style AMM at a fraction of the speed and costs
By leveraging NEAR, Ref is able to offer its discretized liquidity AMM with incredibly fast finality (1–2s) and at negligible costs (fractions of a penny).
3. Place limit orders
By definition, a limit order is an order to buy or sell an asset with a restriction on the maximum price to be paid or the minimum price at which you sell. This is a typical feature on CEXs that use an orderbook, which allows users to program orders within their preferred price range.
Currently, there isn’t a proper limit order function on Uniswap v3. The only way is to provide concentrated liquidity outside the current price and thus mimic a limit order. Ref v2, on the other hand, introduces built-in limit order functionality. Now users can trade on a DEX like they normally would on a CEX 🤯
4. Place limit orders without price limitations
As Uni v3 only allows for limit orders in a roundabout way, once the synthetic limit order is filled, if or when the price returns to its original point, LPs are no longer able to claim their order earnings as the earned tokens would have been reverted.
On Ref v2, users can place limit buy orders at a price higher than current price, and the algorithm will then auto match with the best price. This further provides a trading experience akin to CEXs.
5. Place limit orders with near-zero slippage
Thanks to Ref’s discretized liquidity AMM, which leverages the power of a constant sum formula, traders can not only place limit orders, but do so with near-zero slippage.
Moreover, when traders place limit orders on Ref v2, they effectively become temporary LPs to that pool in that price range. Aside from the state of the art DLAMM model itself, Ref v2’s limit order capacity effectively adds additional liquidity into the pools, thus reducing even more slippage.
6. Benefit from limit order priority AND fair LP fee structure
The introduction of the limit order liquidity provider on Ref v2 naturally introduces competition on fees with the regular LPs who provide concentrated liquidity. To best incentivize each party, limit orders will always be prioritized in terms of the order of transaction, but the LP fees will be distributed proportionally to the concentrated liquidity providers.
Why should YOU care?
Tldr; Discretized Liquidity AMM is a positive sum game. Everybody wins on Ref V2.
- Liquidity Providers: Like on Uni v3, LPs on Ref v2 can maximize the transaction fees they collect from trades by providing concentrated liquidity into a specific price range that traders frequent. In addition, LPs also receive all the fees generated from limit order trades. When a limit order gets filled, it is not the trader who receive the transaction fee, but rather the underlying LP within that range.
- Traders: Traders are able to enjoy deeper liquidity now, as well as place market orders and limit orders with near-zero slippage. When traders place limit orders, they effectively become liquidity providers, who “make markets” by placing offers onto the exchange.
- Active Market Makers: Market makers can reduce the cost of LP management to a much affordable rate(<$0.01/txn), with more predictable profit and loss (PnL), and trading experience closer to a CLOB exchange.
“Tldr; DL-AMM is a positive sum game”
Official Ref Finance Twitter
Ref Finance V2 Testnet
Ref Finance App
Ref Finance does not endorse or promote any of the projects, platforms or cryptocurrencies mentioned in this blogpost. Any descriptions of functionality and services provided are for information only. Ref Finance is not responsible for any loss of funds or other damages caused as a result of using the projects, platforms or cryptocurrencies described above.
Why Ref v2 is Better than Uni v3 was originally published in NEAR Protocol on Medium, where people are continuing the conversation by highlighting and responding to this story.