History of DEX
Markets naturally form within human society’s cooperative systems. Buyers bid to purchase, sellers place orders, and a virtual “order book model” naturally emerges. The market maker’s role is to match transactions for the “order book”. The first market makers appeared in the seventeenth-century spice market, where intermediary merchants would buy from one side and sell to the other, profiting from the price difference. As technology developed, the form of “securities” evolved from paper bills over the counter, to electronic systems, to the current attempts at “tokenization”, increasing scalability.
In an order book model, users frequently place and withdraw orders, which require the system to calculate the timestamp, price, quantity, etc., and the system shall also keep recording order flows. The traditional centralized order book system demands significant computational overhead, risking server overload and downtime in extreme market conditions.
Blockchain platforms, like Ethereum, incur a fee for each transaction. Layer 2 solutions like Arbitrum come to solve the performance issues, but still each transaction incurs a cost. Despite the low cost per order, these fees create significant friction and obstacles for high-frequency trading, especially for market makers who need to frequently submit and cancel orders. On Solana, a high-performance blockchain, a DEX called Serum has built an orderbook-based exchange, but still its volume and market depth could not compete with centralized exchanges due to the frictions.
Ethereum, initially positioned itself as the “world computer,” supports various applications, with financial applications being the first to emerge. The concept of DEX was born alongside Ethereum. In 2017, first-generation decentralized exchanges such as Etherdelta and DDEX, fueled by tens of millions in financing, popularized the concepts of fairness and transparency. However, due to high on-chain overhead and user experience issues such as the need to deposit and withdraw funds within the smart contracts, these first-generation exchanges were short-lived. This marked the advent of the Automated Market Maker (AMM) mode of DEX.
In fact, AMM has been an academic study topic long before Bitcoin and crypto, with AMM first mentioned in 2002 by Robin Hanson’s Logarithmic Market Scoring Rules. Non-cryptocurrency related AMM studies include Information Aggregation (2004), Prediction Markets (2006), Bayesian Models (2012), and Betting Markets (2012).
The idea of AMM applications on the blockchain was first proposed by Vitalik Buterin, implemented by Hayden Adams in 2018, and later became the largest decentralized exchange, Uniswap. In this research, we dive into all the AMM models currently in the market, giving you an overview of their design, pros, and cons.
The evolutions of AMM Evolution
In simple terms, the AMM model is akin to a vending machine for a trading pair. AMM sells tokens on both sides of the trading pair, acting as the counterparty for the buyer and seller. The Liquidity Provider (LP) supplies the vending machine with one or both tokens for sale as per the rules. Traders invest one token and based on the vending machine’s rules and the current token ratio, they can determine the amount of another token they receive in exchange.

Source:bancor.network
After each transaction, a new price is automatically generated due to the change in the tokens’ proportion inside the vending machine. Trades can only occur at current prices, leading to many AMM-based DEXs being referred to as swaps.
AMM’s application in the blockchain scene is only five years old, but from the earliest x*y = k model, dozens of different models have emerged. This article will examine the AMM models currently available in the market, including those that have been implemented, market-tested, and even the latest proposed improvements. This research aims to provide inspiration for related business developers, to help them find the most suitable AMM model for their own business model.
Universal AMM Form
Earliest AMM Model – Constant Product Function
The well-known x*y = k AMM model is used by many DEXs, including Uniswap V1 and V2. Here, x and y represent the “inventory” of the two tokens in the “vending machine”, and k is the liquidity parameter. K remains constant during each swap, and it increases or decreases during each liquidity deposit or withdrawal. Uniswap V2 allows pool creating to be any pair of ERC20 standard tokens. The token proportion in the pool determines the current exchange price, each liquidity deposit or withdrawal will be in equal proportions according to the current ratio.
The token price is ultimately decided through each trade. There might be price difference for the same assets in different pools and arbitrageurs maintain price balance by arbitraging between different trading pools. As shown in the following diagram, the trader inputs A token to exchange for B token, where the length of the line segment represents the amount of exchange. The state of the liquidity pool (contract) is updated from the old state to the new state, completing a swap. The new token ratio in the liquidity pool represents the new price.

Source: Ethresearch, Vitalik Buterin
– Advantages:
– Liquidity coverage from 0 to infinity supports arbitrary fluctuations in token prices.
– The liquidity provision method is simple, without requiring active liquidity management.
– Supports the creation of any ERC20 trading pair.
– Liquidity provision tokens obtained after providing liquidity are ERC20 tokens and can be embedded in other DeFi applications, such as liquidity incentives or as collateral for lending activities.
– Disadvantages:
– Liquidity is dispersed, resulting in high slippage.
– Only supports swap on the current market price and is incompatible with limit orders.
– Vulnerable to MEV/front run attacks (hence slippage limit protection).
– Liquidity providers must provide bilateral tokens according to the pool ratio.
– Liquidity providers will incur impermanent loss as their token exposure will change once the price moves.
Concentrated liquidity AMM – CLMM
Uniswap V3 introduces the concept of Concentrated Liquidity Market Maker (CLMM), allowing liquidity providers to customize their liquidity provision range. In Uniswap V3, for example, the price range is divided into an infinite number of ticks. When the pool is established, the tick step and trading fee ratio are set, and liquidity providers can inject liquidity into several consecutive ticks. Because the range and quantity of liquidity provision vary, Uniswap V3’s liquidity provider token are characterized by NFTs.

Source: Uniswap V3 Core whitepaper
The figure above illustrates the liquidity provision method of Uniswap V3 in comparison to Uniswap V2. Given the same amount of funds, Uniswap V3 offers higher liquidity and price depth than Uniswap V2. Given that in most cases, the price won’t be 0 or approach infinity but instead fluctuates within a certain range, a lot of the liquidity in Uniswap V2 is not utilized. Uniswap V3 allows liquidity providers to offer liquidity within a certain range, thereby improving the shortcomings of Uniswap V2 and increasing the capital efficiency.
– Advantage
– Support any ERC20 token trading pair.
– With the same amount of token, AMM in the form of Uniswap V3 has a higher capital efficiency
– Compared with AMM in the form of Uniswap v2, CLMM can provide better trading depth and lower slippage under the same liquidity. Can even support stablecoin trading scenarios.
– Disadvantages
– Active liquidity management is necessary to prevent inefficiencies when prices are out of the selected range, thus unsuitable for long-tail assets which are highly volatile. When current price goes out of price range of all the liquidity will be ineffective until price moves back to the range.
– The liquidity provider token is the form of NFT, which is incompatible with most DeFi protocols (generally ERC20).
– Higher impermanent losses compare with Uniswap v2
– Still vulnerable to MEV/front run attacks
Uniswap V2 vs Uniswap V3 status quo
Uniswap V3, due to its high capital efficiency, saw a concentration of transaction volume after its launch.

Source: Uniswap V2/V3 Comparison (dune.com)
However, since Uniswap V3 requires active liquidity management and is only suitable for mainstream assets with a large user base and lower volatility, new pool creations and trading of long-tail assets are still primarily conducted in Uniswap V2. This is also due to the ease of integrating liquidity incentive schemes in Uniswap V2. As illustrated in the figure below, most trading pairs are created in Uniswap V2. In the recent Memecoin wave, Uniswap V2 saw a significant increase in terms of trading volume compared to V3, further showing that Uniswap V2 is a more project-friendly liquidity solution.

Source: Uniswap V2/V3 Comparison (dune.com)
The copyright of Uniswap V3 expired in April 2023, after which other platforms could use its open-source code for free. Decentralized exchanges such as Quickswap and Pancakeswap have imitated their design, all adopting CLMM model.
Order book AMM – DLAMM/Liquid Book
Uniswap V2 and V3 both offer continuous liquidity in nature, allowing the price to be any point on the curve. The traditional order book model offers discrete liquidity, with each order providing liquidity at a specific price point and the price not being continuous but having at least a minimum scale difference. Uniswap V3 divides the price range into countless small ranges allowing users to choose a range to place liquidity. Can these ranges be further compressed into points, providing liquidity at each point to achieve AMM in order book mode? The DLAMM (Discrete Liquidity Automated Market Maker) proposed by iZUMi Finance was designed with this in mind. Trader Joe’s new Liquid Box also uses this idea.

Source: iZiSwap Whitepaper
When creating a liquidity pool, the creator sets a minimum price scale and trading fee ratio. Liquidity can only be allowed at those price points with no other price value. On each point, trading rule is according to constant sum function x + y =k, if an order can be fulfilled within the liquidity of a certain price point, then there’s no slippage for this trade.
DLAMM uses a similar approach to CLMM for liquidity provision, where liquidity providers can choose to provide liquidity on one or several consecutive price scales. Since it provides discrete liquidity, DLAMM is compatible with on-chain limit orders. This gives liquidity providers the option to place buys and sell orders at specific prices, a feature not available in Uniswap V2 and V3. As a result, DLAMM can be seen as a hybrid of the traditional order book model and the AMM model, offering the advantages of both.
In addition, DLAMM gives more control to liquidity providers. They can choose at which price points they want to provide liquidity, and how much liquidity to provide at each point. This means that liquidity providers can effectively manage their risk and returns.
– Advantage:
– DLAMM combines the advantages of the order book model and the AMM model, giving traders and liquidity providers more flexible options.
– Allows liquidity providers to place limit orders.
– Gives more control to liquidity providers.
– Others similar to Uniswap v3
– Disadvantages
– Including limit orders, trades on DLAMM must occur at a fixed price point (generated when the pool is created), and the user cannot set arbitrary order prices.
– After the limit order is placed, the funds are directly in the liquidity pool, and an additional transaction is needed to withdraw the filled.
– Since there is no timestamp for limit orders on the same price, if only partially executed, the amount of the transaction is obtained by the user who first completed the withdrawal transaction.
– Others are similar to Uniswap V3
Scenario-specific AMM
Stableswap
In DeFi, many tokens exist that anchor to the same price but come from different sources and serve various applications. There is often a high demand for exchanging these tokens, such as stablecoins or derivatives of ETH in liquid staking. Stableswap, exemplified by platforms like Curve, emerged in this context and plays a vital role in this ecosystem.
In the constant sum curve x + y = k, x and y maintain a 1:1 ratio, suitable for pegged tokens. However, there could be considerable shifts in the pegged token price due to extreme risk situations, such as stablecoin de-pegging. Therefore, the design of an AMM must consider the possibility of de-pegging, to prevent an attack on liquidity providers by arbitrageurs.

Source: Curve Whitepaper
Curve facilitates the exchange of multiple coins within one pool, with xi representing the inventory of i tokens in the pool. In simple terms, Curve’s AMM curve is a fusion of the constant sum curve and constant product curve. D is a constant, meaning the total amount of token when they have an equal price. N is the total number of coins in this pool. χ serves as an indicator of the balance of token inventory in the pool. When there is a major shift in inventory due to events like stablecoin de-pegging or large selloffs, χ approaches zero, and the entire formula becomes a constant product curve, similar to Uniswap V2, leading to significant slippage. When the inventory is balanced, tokens should exchange at a 1:1 ratio, χ approaches positive infinity, and the formula approximates a constant sum curve, achieving a 1:1 token exchange.

Source: Curve Whitepaper
– Advantages:
– Ideal for exchange between pegged assets or for fixed percentage exchanges.
– The liquidity provider token is in the form of ERC20, which can be easily integrated into DeFi protocols.
– Disadvantages:
– Limited use cases. The asset must anchor to a fixed ratio, without deviation, making it unsuitable for bond scenarios (prices are relatively stable but can change slightly over time).
– Platforms like Platypus and Wombat, also Stableswaps, are similar to Curve. They introduce the concept of the debt ratio into the formula to calculate the asset deviation in the liquidity pool, which simplifies contract design and reduces gas overhead. They also allow for one-side liquidity deposit and withdraw.
Curve V2 Tricrypto
Based on the idea of Curve V1, Curve V2 introduces an internal oracle. The price adjusts according to the internal token ratio, and the liquidity concentrates around the new price based on the internal oracle’s price. This process can be seen as dynamic pegging. Each price update leads to a change in liquidity distribution. On the trading side, the platform adjusts fees dynamically—the farther away from the current oracle price, the higher the fee, ranging from 0.04% to 0.4%. This system compensates for higher impermanent losses suffered by liquidity providers at dynamic rates.
When setting up the liquidity pool, the project party needs to set eight parameters, relating to the concentration of liquidity at the central price, the depth of liquidity at the time of price deviate, the central price trading fee rate, the maximum price deviation rate, the initial price, the price adjustment step, the adjustment time, and so on.
– Advantage
– Reducing slippage near the current trading price can provide better market depth for the token.
– No external oracles or active liquidity management required.
– Disadvantages
– Due to the lagging nature of internal oracles, arbitrage is prone to occur under extreme market conditions, so it is more suitable for mainstream tokens with relatively small fluctuations.
AMM Based on External Oracle Price Feed
This type of DEX has external price inputs, generally using oracles such as Chainlink, and the state of the contract (including price, token inventory) needs to be actively triggered by other external accounts to update the price, so this type of AMM is not strictly an “automatic market maker”. But still it is also being used on a large scale. Projects adopting this mechanism include DoDo, GMX, GNS, and Pika Protocol.
DoDo’s Automatic Liquidity Adjustment Proactive Market Maker (PMM)
DoDo’s PMM introduces an external reference price through an oracle, concentrating liquidity around the reference price. Its price calculation is adjusted based on the reference price and the inventory of assets in the liquidity pool. Its formula is expressed as follows:

Source: DoDo Whitepaper
where p is the current price, i is the reference price, and k is the “slippage factor”, which indicates the degree of concentration provided by liquidity in the equilibrium process, B and B0 Represents current inventory and equilibrium inventory (protocol liabilities), respectively. When inventory shifts, the price also shifts with the reference price until it returns to the equilibrium level.
– Advantages
– Introduces external price input, automatically adjusts liquidity, and improves market-making efficiency
– Compared to Curve V2, redeploying liquidity through external pricing does not have impermanent losses and can enable single token liquidity deposit.
– Disadvantages
– Given inventory risk, it cannot support long-tail assets
– Relies on external oracle price input, price discovery cannot be achieved
– Risks associated with external oracle manipulation
– Price entry lags, leaving room for arbitrage
No price impact leveraged trading – GMX, GNS,Pika Protocol, etc
Users use their assets as collateral and liquidity pools as counterparties, executing transactions according to the price provided by external oracles, generally in futures trading or leveraged trading. GMX allows spot trading. Trades are executed according to oracle prices with no slippage and no price impact on the spot market. Fees are determined by the size of the trading order and the offset of the current liquidity pool token ratio – the larger the single trade order, the more unbalanced the liquidity pool ratio, and the higher the fee, up to 0.8% for GMX.
This type of scheme is more suitable for high-frequency trading scenarios, such as leveraged trading, derivatives trading, and can provide up to tens of times leverage, so it is generally deployed in high-performance blockchain networks such as Arbitrum, Optimism Rollups, and Avalanche.
– Advantage
– Capable of supporting high-frequency trading scenarios.
– LP has no impermanent losses.
– LP is an ERC20 standard and can be compatible with other DeFi protocols.
– Disadvantages
– The price is an external input and price discovery cannot be realized.
– Oracles have the possibility of manipulation.
– It is difficult to support the trading of long-tail assets.
Other Liquidity provision improvement
In addition to improvements at the trading algorithm level, several new types of DEX have made new attempts at the liquidity provision level, including:
– Trader Joe V2, named Liquid Book, draws inspiration from iZiSwap DLAMM’s design and divides liquidity at each price point into “bins” as units of liquidity distribution. It offers six different liquidity deployment strategies for liquidity providers to choose from, ultimately following a concentrated liquidity deployment approach. Additionally, it provides an automated liquidity deployment tool called Auto-pool to help users automatically rebalance liquidity based on market prices, eliminating the need for manual management.
– iZUMi’s iZiSwap offers a liquidity mining tool called Liquid Box specifically for Uniswap v3 NFT style LP liquidity mining. It utilizes different liquidity incentive models to attract liquidity.
– Maverick Protocol features an automated liquidity placement mechanism that provides four different price-following mechanisms. Each liquidity position of liquidity providers will be rebalanced based on their set strategies, automating the concentration of liquidity as price moves, and ensuring sufficient liquidity and lower slippage.
DEX’s endgame
Due to the characteristics of blockchain, in most cases, the DEX price will lag compared to the CEX, and arbitrage behavior is a significant part of the DEX trading volume and the loss of liquidity providers. Therefore, higher fees and liquidity incentives of DEX are essentially compensating for the risk borne by liquidity providers, while traders benefit from the convenience of trading, including permissionless trading, arbitrary exchange of all the on-chain assets, and so forth.
Different AMM models will adapt to different scenarios, and at present, there is no one AMM model that can unify all markets. Developers need to select the appropriate AMM trading algorithm according to the characteristics of their assets and the trading needs of users.
The order book model has relatively fewer defects, but due to the high computational overhead, it is difficult to achieve on-chain. The order book also requires active market making, and long-tail assets need to cooperate with market makers. Currently, some other projects are developing native on-chain order book to reduce computational cost from the infrastructure level, for example, Sei Network tries to reduce the cost of on-chain market making through the built-in orderbook matching engine. Some other order book mode DEXs are more like CEX, DyDx for example, which realize the order book by running a private chain, making it challenging to maintain openness.
In the long run, DEX will inevitably develop towards high capital efficiency, carrying users to the greatest extent with the lowest liquidity, with new AMM models, or new business models, such as a cross-chain plus order book model.
Reference
The Evolution of AMMs – by Benny Attar – Setira Research (substack.com)mod
Understanding Curve v2 – Curve Finance
White Paper | DODO Docs (dodoex.github.io)
關於 DigiFT
DigiFT aims to provide regulated decentralized finance solutions on the Ethereum public blockchain. We are operating the first regulation-abiding decentralized digital asset exchange where asset owners can issue blockchain-based security tokens efficiently and cost-effectively. Investors can trade with continuous liquidity via an AMM mechanism and retain control over digital asset tokens in their own wallets. We are a global outfit backed by well-established venture partners. The founding team originates from international financial institutions and has deep blockchain technology knowledge.
For more information, please contact:
Disclaimer:
This article and its contents are prepared solely for informational purposes only and do not replace independent professional judgement. Under no circumstances should the information contained herein be used or considered as an offer to sell, or solicitation of an offer to buy any security. The content of this presentation is proprietary and no part of it may be reproduced or redistributed without the prior written consent of DigiFT Tech (Singapore) Pte. Ltd. (“the Company”). This article contains public information as of the specified date, and may be stale thereafter. No representation or warranty, express or implied, is made as to the fairness, accuracy or completeness of the article and the information contained herein and no reliance should be placed on it. None of the Company, its advisers, connected persons or any other person accepts any liability whatsoever for any loss howsoever arising, directly or indirectly, from this article or its contents. All information, opinions and estimates contained herein are given as of the date hereof and are subject to change without notice. This material should not be viewed as advice or recommendations with respect to asset allocation or any particular investment.
如何选择合适的 AMM 模型?全面分析
DEX 发展史
市场是在人类社会的协作体系中自然形成的,买家出价购买,卖家挂单出售,自然形成了订单薄形式的交易所;为交易所撮合交易,就是做市商的角色。最早的做市商在十七世纪的香料市场就出现了,香料的中介商户从一方购买,卖给另一方,赚取中间的差价。随着科技发展,“证券”的形态,从柜台纸质票据,到电子化系统,到现在尝试的“代币化”,可扩展性随之增强。
在一个订单薄模型中,参与的用户频繁挂单、撤单、吃单,每一笔订单需要计算时间序列、价格和数量等等,对订单资金流向也要记录;传统的中心化订单薄模式需要大量的计算开销,在极端行情中甚至可能出现服务器过载宕机的情况。
以以太坊为代表的底层区块链,每一笔交易都需要高昂的手续费开销。即使采用二层扩展技术(Layer 2s,如 Arbitrum),将每一笔订单的开销降低到几美分,对于高频交易需求,如做市商频繁挂单撤单,仍然有巨大的交易摩擦和阻碍。高性能区块链 Solana 上的 DEX Serum 尝试构建基于 Orderbook 的交易所,但交易量和深度还是难以和中心化交易所比拟。
以太坊最初定位为“世界计算机”,能够在其上构建各类应用,金融应用是最早出现的,DEX 的概念甚至随着以太坊的出现而诞生;2017 年 Etherdelta,DDEX 等第一代去中心化交易所,千万规模的融资,将 DEX 公平、透明的概念传播开来。但由于第一代交易所仅是模拟传统订单薄模型,且需要往合约充值或提现资金才能交易,高昂的链上开销以及用户体验问题,导致第一代交易所昙花一现。DEX 概念冷却,随后更适用于链上场景的 AMM (Automated Market Maker,自动做市商)模式的 DEX 开始登上舞台。
早在比特币出现之前,AMM 就被学术界有所研究,第一次提到 AMM 的是 2002 年 Robin Hanson 的研究《Logarithmic Market Scoring Rules》,在非加密货币的语境里,关于 AMM 的研究还有《Information Aggregation》(2004),《Prediction Markets》(2006),《Bayesian Models》(2012)和 《Betting Markets》(2012)。
AMM 应用在区块链上的想法最早是 Vitalik 提出,由 Hayden Adams 在 2018 年实现,后来也成为最大的去中心化交易所 Uniswap。在本篇报告中我们会介绍目前市面上主流的 AMM 模型,介绍他们各自的机制设计、优势和缺陷。
什么是 AMM?
简单来说,AMM 模式就如同一台自动售货机,对于一个交易对来说,AMM 同时销售交易对两边的代币,作为买方和卖方的对手方;流动性提供者(Liquidity Provider,简称 LP)按照规则为这台自动售货机提供一种或同时提供两种代币让售货机销售。交易者投入一种代币,根据自动售货机的规则以及当前两种代币的比例能够确定能够兑换出的另一种代币数量,从而完成交易。

Source: flahub.com
交易完成后,由于售货机内部的代币比例发生变动,自动生成了新的价格。交易只能按照现价交易,因此很多基于 AMM 的 DEX 称为 Swap。
AMM 应用在区块链场景仅五年时间,从最早的 x*y = k 模型,涌现出数十种不同的模型,本文将从流动性需求,资金效率,价格影响等角度切入,对市场上公开的 AMM 模型做机制研究,其中包括已经被应用、被市场检验的产品,也包括最新提出的改进方案,希望能为相关业务的开发者提供一些启发。
通用 AMM 模型?
基础 AMM 模型 – 恒定乘积模型
众所熟知的 x*y = k 的 AMM 模型被诸多 DEX 所采用,Uniswap V1 和 V2 也采用了这种设计。其中 Uniswap V1 于 2018 年上线,仅支持 ETH 交易对;Uniswap V2 在 2020 年 5 月发布,支持任意 ERC 20 交易对。
其中 x 和 y 分别表示“自动售货机”中两种代币的“库存”,k 为流动性参数,在每次交易过程中库存发生改变而 k 保持不变,每次流动性的添加和移除过程中 k 对应增加或减少;Uniswap V2 中 x 和 y 可以是任意的 ERC20 标准代币。代币在资金池中库存比例即为当前兑换价格,流动性提供也根据当前比例等比例提供。
代币的价格最终通过交易路由实现跨交易对交易,由稳定币作为锚定确定其价格,由套利者在不同交易池中套利维持价格平衡。如下图所示,交易者输入 A token 兑换 B token,线段长度表示交换的数量,资金池(合约)的状态从旧的状态更新至新的,即完成一次兑换(Swap),资金池的新代币比例即为新的价格。

Source: Ethresearch, Vitalik Buterin
– 优势:
– 流动性全区间覆盖(0 到无穷),可以支持代币价格任意波动
– 流动性提供方式简单,无需主动进行流动性管理
– 支持任意 ERC20 交易对的创建
– 提供流动性后获得的流动性凭证(LP Token)标准化,能够嵌入其他 DeFi 应用,如做流动性激励,或作为抵押品参与借贷活动
-缺陷
– 流动性分散,同等资金情况下滑点较大
– 提供流动性必须提供双边代币
– 仅能支持现价交易(swap),无法兼容限价订单
– (滑点大)容易遭受交易抢跑攻击(因此有滑点限制保护)
– 流动性提供者会遭受无偿损失,持仓会随交易发生变化
集中流动性 AMM – CLMM
Uniswap V3 提出集中流动性概念(Concentrated Liquidity Market Maker),允许流动性提供者自定义提供流动性的区间,于 2021 年 5 月上线主网。以 Uniswap V3 为例,为允许流动性提供者选择价格区间,Uniswap V3 将价格区间分割为无数个刻度(tick),刻度的步长在池子建立时和手续费一起设定,流动性提供者可以将流动性注入某个刻度或连续数个刻度中,也就是某个价格区间。由于不同流动性提供者选择提供流动性的区间和数量不一致,Uniswap V3 的流动性提供凭证由 NFT 来表征。

Source: Uniswap V3 Core whitepaper
上图分别为 Uniswap V2,Uniswap V3 的流动性提供方式,同样数量的资金,在 Uniswap V3 上提供的流动性和价格深度高于 Uniswap V2,考虑到绝大多数情况下,价格并不会出现在 0 或者接近无穷的位置,而仅仅在某一个区间内波动,因此在 Uniswap V2 中大部分流动性是不被使用的;Uniswap V3 允许流动性提供者在某一区间提供流动性,改进了 Uniswap V2 的缺点,提高了资金使用效率。
– 优势
– 支持任意 ERC20 代币交易对
– 可以在当前价格的一侧铺设单一币种的流动性,或设置更加灵活的策略
– 相同流动性资金的情况下,相比 Uniswap V2 形式的 AMM 有更高资金使用效率
– 相比 Uniswap v2 形式的 AMM,在相同流动性资金的情况下,CLMM 能提供更好的交易深度,更低的滑点;甚至能够支持稳定币的交易场景
– 缺陷
– 需要主动管理流动性,避免价格出区间流动性失效,对于波动率更高的长尾资产并不友好
– 极端行情价格突破区间,区间之外流动性失效影响交易
– 流动性提供凭证为 NFT,难以和大部分 DeFi 协议兼容(一般 DeFi 协议都仅支持 ERC 20 代币标准)
– 相比于 Uniswap v2 无偿损失更高
– 仍然会遭受 MEV 和抢跑交易的攻击
Uniswap V2 Vs Uniswap V3 现状对比
由于 Uniswap V3 的高资本效率,在 V3 推出之后交易量都集中在 V3 中。

Source: Uniswap V2/V3 Comparison (dune.com)
但由于 Uniswap V3 需要主动的流动性管理,仅适合具有较大受众的主流资产,对于长尾资产的流动性创建和交易,场景仍在 Uniswap V2,并且在 Uniswap V2 中能方便集成流动性激励方案。下图中可以看到,大部分交易对创建都是在 Uniswap V2 中。在近期 Memecoin 浪潮中 Uniswap v2 的交易量相较 V3 有大幅度提升,也表明 Uniswap V2 是对长尾资产更加友好的流动性方案。

Source: Uniswap V2/V3 Comparison (dune.com)
Uniswap V3 的版权在 2023 年四月到期,此后其他平台可以免费使用其开源代码。Quickswap,Pancakeswap 等去中心化交易所模仿其设计,都采用了集中流动性方案,但主要交易量集中在大类资产上。
订单薄 AMM – DLAMM/Liquid Book
Uniswap V2 和 V3 本质上都是连续流动性,价格可以是曲线上任意的点。而传统的订单薄模式本质上是离散流动性,从图像上来看,每个订单都是在某个价格点上的流动性,价格和价格之间不是连续的,而会至少有一个最小的刻度差。Uniswap V3 将价格区间分割为无数小区间来允许用户选择区间放置流动性,那是否可以将这些小区间进一步压缩到点,在每一个点上提供流动性,来实现订单薄模式的 AMM 呢?iZUMi Finance 提出的 DLAMM(Discrete Liquidity Automated Market Maker)就在这样的思路下被创建出来,并以此为基础在2022 年 5 月发布了去中心化交易所 iZiSwap。Trader Joe 新提出的 Liquid Box 也是借鉴了这样的思路。

Source: iZiSwap Whitepaper
在 iZiSwap在创建流动性池时,价格空间会被划分为一系列的价格点。除了这些点,价格没有其他取值。每一个点上的价格符合恒定和曲线,即 x + y = k,若交易能够全部在某一个价格点上执行(如订单较小的情况),则没有滑点。
DLAMM 在流动性提供方面采用了和 CLMM 类似的思路,流动性提供者可以选择在一个或数个连续的价格刻度上提供流动性。由于是离散流动性,DLAMM 兼容链上限价订单,本质上限价订单也是在某个价格点位的流动性,可以如上图 b 中所示,黄色为流动性提供者的流动性,蓝色为交易者的限价订单,会有不同的标记。当价格达到限价订单的位置时,限价订单成交后会标记为成交并从流动性池中移出
– 优势:
– 可以实现去中心化链上限价订单
– 相比 Uniswap V3,若订单较小,都能被某一价格的流动性满足,则完全没有滑点(如稳定币兑换,流动性一般集中在数个价格点上)
– 其他同 Uniswap V3
– 缺陷:
– 包括限价订单,DLAMM 上的交易必须发生在设定的价格点上(在池子创建时按规则生成),用户无法设置任意的订单价格
– 发布限价订单之后,资金直接在流动性池中,成交之后需额外一笔交易将成交的订单取出
– 同一个位置的限价订单由于没有时间排序,若仅部分成交,成交的金额由先完成取出交易的用户获得
– 其他同 Uniswap V3
特定场景 AMM
Stableswap
在 DeFi 中有诸多价格一致、但来源和应用场景不同的价格锚定代币,他们之间的兑换也由于各种原因需求旺盛,典型的如稳定币之间的兑换,Liquid staking 中 ETH 的流动性衍生品等等。Curve 等 stableswap 也是在这样的背景下出现,Curve 的 V1 在 2020 年 1 月上线,并在相关生态中起到至关重要的作用。
在恒定和曲线 x+y = k 中,x 、y 的和保持不变,每次库存的改变,x和y 的变动都为 1:1,该曲线适合锚定代币,但由于极端风险情况,锚定代币价格可能出现大规模偏移,如稳定币脱钩,AMM 设计也需要考虑脱钩的情况,否则会有大量的流动性提供者遭受套利者攻击。

Source: Curve Whitepaper
上述公式为 Curve Stableswap AMM 曲线的设计。Curve 允许多个币种之间兑换,xi 表示池中的 i 代币的库存,D 表征流动性池中代币在价格相等的时候的数量,是一个常数;n 表示池中代币种数。简单来说,该 AMM 曲线时恒定和曲线和恒定乘积曲线的结合,由 χ 作为池中代币库存平衡的指标。当库存出现大规模偏移,如某稳定币脱钩被大量抛售,此时 χ 会趋近于 0 ,此时整个公式变成了一个类似 Uniswap V2 的恒定乘积曲线,会有较大的滑点。当库存平衡时,代币应该能够 1:1 兑换,此时 χ 无限趋近正无穷,此时公式近似为恒定和曲线,代币之间实现 1:1 的兑换。

Source: Curve Whitepaper
– 优势
– 非常适用于锚定资产之间的兑换,或是固定比例的兑换,如 LSD 代币的兑换
– 流动性凭证为 ERC20,可以方便集成于不同的 DeFi 协议中
– 缺陷
– 缺乏灵活性;资产必须是固定比例锚定,无法有偏差,不适用于债券场景(价格相对稳定,但会随时间有小幅度变动)
Platypus 和 Wombat 也是 Stableswap,大致思路和 Curve 类似,将恒定和曲线和恒定乘积曲线结合,在公式中引入了负债率的概念来计算流动性池的资产偏离度,让合约设计能够更加简单,Gas 开销更低,也允许单币的流动性注入。
Curve V2 Tricrypto
在 Curve V1 的基础上,Curve V2 增加了内部预言机,根据内部代币比例调整价格,根据内部预言机的价格将流动性集中在新价格附近,相当于时一个动态锚定的过程,每一次动态更新都会有流动性分布的改变,于 2021 年 6 月上线。在交易端有动态的手续费调整,距离当前预言机价格越远手续费越高,从 0.04% 提高到 0.4%,以动态费率补偿流动性提供者遭受的较高的无偿损失。
在项目方设定流动性池时会需要是设定八个参数,关系到中心价格流动性集中程度、价格偏移时流动性深度、中心价格费率、价格偏移最高费率、初始价格、价格调整步长、调整时间等。
– 优势
– 降低交易价格附近的滑点,能够为代币提供较好的市场深度
– 无需外部预言机,也无需主动流动性管理
– 缺陷
– 由于内部预言机的滞后性,在极端行情下容易出现套利,因此更适用于波动相对较小的主流代币
– 无偿损失相对较高
基于外部预言机喂价 AMM
这类 DEX 有来自外部的价格输入,一般为预言机,合约的状态(包括价格、代币库存)都需要有其他外部账户主动触发,来对价格进行更新,因此这类 AMM 严格来说并不完全算“自动做市商”,但也是目前 DEX 正在大规模应用的,包括 DoDo、GMX,GNS,以及 Pika Protocol。这类算法有其适合的应用场景,也有其设计的缺陷。
DoDo 的自动流动性调整 Proactive Market Maker(PMM)
DoDo 的 PMM 通过预言机引入外部参考价格,将流动性集中在参考价格附近,于 2020 年 8 月上线主网。其价格计算会根据参考价格和流动性池中资产库存进行调整。其公式表示如下:

Source: DoDo Whitepaper
其中 p 为当前价格,i 为参考价格,k 为“滑点系数”,表示均衡过程的流动性提供集中程度,B 和 B0 分别代表当前库存和均衡库存(协议的负债)。库存偏移时,价格也会随参考价格偏移,直到回归均衡水平。
– 优势
– 引入外部价格输入,自动调整流动性,提高做市效率
– 相比于 Curve V2,通过外部定价重新部署流动性,可以单币提供流动性,且没有无偿损失
– 缺陷
– 考虑到库存风险因素,无法支持长尾资产
– 依赖外部预言机价格输入,无法实现定价
– 外部预言机价格偏移风险
– 价格输入滞后,存在套利空间
无价格影响杠杆交易 – GMX、GNS、Pika Protocol 等
用户以自己的资产作为抵押品,以流动性池作为交易对手方,根据外部预言机提供的价格执行交易,一般为期货交易或杠杆交易。GMX 允许用户现货交易。
交易根据预言机价格执行,没有滑点和对现货市场的价格影响。会根据交易订单的大小和当前流动性池代币比例的偏移程度收取,单次交易订单越大,流动性池比例越不均衡,费率越高,对于 GMX 费率最高达到 0.8%
该类方案更适合高频交易场景,如杠杆交易、衍生品交易,可以提供高达数十倍的杠杆倍率,因此一般部署在高性能区块链网络,如 Arbitrum,Optimism Rollups 和 Avalanche
– 优势
– 能够支持高频交易场景
– 提供流动性没有无偿损失
– 流动性凭证为 ERC20 标准,可以和其他 DeFi 协议兼容
– 缺陷
– 价格为外部输入,无法实现价格发现
– 依赖外部预言机喂价,有操纵可能性
– 难以支持长尾资产交易
其他流动性部署方式改进
除了交易算法层面的改进,数个新型的 DEX 在流动性部署层面做了新的尝试,其中包括:
– Trader Joe V2 ,命名为 Liquid Book,较多参考 iZiSwap DLAMM 的设计,将每个价格点的流动性称为 “bin” ,作为流动性分布的单元,其流动性部署提供六种不同流动性形态的策略供流动性提供者选择,本质还是集中流动性的部署方式。此外还提供自动化流动性部署工具 Auto-pool 帮助用户根据市场价格自动再平衡流动性,无需用户手动管理。
– iZiSwap 提供流动性挖矿工具 Liquid Box,是针对 Uniswap v3 NFT 形式的 LP 的流动性挖矿方案,通过不同流动性激励模型来吸引流动性。
– Maverick Protocol 自动流动性放置机制,提供四种不同的价格跟随机制,流动性提供者的每一个流动性仓位,会根据其设定的策略,跟随市场价格做再平衡,从而能够更大程度保持交易有充足的流动性,和较低的滑点。
DEX 的终局之战
由于区块链的特性,大部分情况下 DEX 价格会滞后于 CEX,套利行为是 DEX 交易量的很大一部分,对于某些用户较少的区块链上的 DEX,套利交易量甚至超过总交易量的 80%,这部分套利者的收益也是流动性提供者的损失;因此 DEX 更高的收费以及流动性激励实质上是对流动性提供者承担风险的补偿,而交易者在其中获得交易的便利性,包括无需许可交易、任意兑换全链资产等。
不同 AMM 模型会适配不同的场景,目前来看并没有一个 AMM 模型能统一所有市场,开发者需要根据自身资产的特性和用户的交易需求选择合适的交易算法。
订单薄模型相对来讲缺陷更少,但由于高计算量的需求,在链上难以实现,同时订单薄也有主动做市的需求,长尾资产需要和做市商合作。目前链上订单薄的发展方向上,Sei Network 尝试通过底层内置交易撮合引擎来实现,来降低链上做市的成本,目前暂未上线,有待考察其可行性。其他订单薄模式 DEX 更像是 CEX,通过运行私链来实现订单薄,很难具有开放性。
DigiFT 作为符合监管的去中心化交易所,也尝试在 DEX 上构建符合监管的框架和功能,来接纳传统世界的金融需求。长期来看,DEX 必然向高资本效率发展,用最低的流动性最大程度承载用户,新的 AMM 模型,或是新的业务模式,如跨链 + 订单薄结合的模式等。
参考文献
The Evolution of AMMs – by Benny Attar – Setira Research (substack.com)
Understanding Curve v2 – Curve Finance
Whitepaper | DODO Docs (dodoex.github.io)
关于 DigiFT
项目介绍: DigiFT 由张之皓——前华美银行大中华区首席执行官、花旗银行和渣打银行中国区副行长,于 2020 年创立,其管理团队在传统金融机构和金融科技领域拥有丰富经验。 DigiFT 的愿景是整合中心化与去中心化金融的优势,是目前第一家,同时也是唯一一家进入新加坡金融管理局(MAS)金融科技监管沙盒的去中心化交易所。DigiFT 在以太坊公链上提供符合监管的去中心化金融方案,部署自动做市商(AMM)机制,促进由债券、股权等金融资产作为底层支持的证券型通证的二级市场交易流动性。
更多信息,请联系:
免责声明:
本文及其内容仅供信息目的使用,不替代独立的专业判断。在任何情况下,本文所包含的信息不应被视为出售或购买任何证券的要约或征求。未经DigiFT Tech (Singapore) Pte. Ltd.(“公司”)事先书面同意,任何部分均不得复制或重新分发。本文包含的公开信息仅截至指定日期,并可能在此后过时。对于文中和其中所包含的信息的公正性、准确性或完整性,不作任何明示或暗示的陈述或保证,不应依赖于此。公司、其顾问、关联人员或任何其他人对于由于本文或其内容而直接或间接引起的任何损失概不承担任何责任。本文中所包含的所有信息、观点和估计均截至本日期,并且可能随时变动,恕不另行通知。本材料不应被视为关于资产配置或任何特定投资的建议或推荐。