Automated Market Makers (AMMs): Versioning Up

Amber Group
28 min readApr 1, 2022

--

Summary

Automated market makers (AMMs) form the backbone of decentralized finance. They allow users to trade assets, create new markets, and earn yields, all available 24/7 and without a central entity. Since their inception, they have grown to execute over $180 billion of trading volumes.

DeFi moves fast. In this report, we review important AMM designs and market trends, highlighting some of the projects we find most interesting. We also discuss emergent behaviors that arise from AMMs, such as impermanent loss (“IL”), concentrated liquidity management, and just-in-time liquidity (“JIT”).

AMMs: Versioning Up

Automated market makers (AMMs) form the backbone of decentralized finance. They allow users to trade assets, create new markets, and earn yields, all available 24/7 and without a central entity. Bancor first introduced the constant product AMM in 2017, but its platform saw only modest adoption because each token was paired with Bancor’s native token. Only when Uniswap launched its v2, which by default paired tokens with ETH, did AMMs really take off. Total DEX volumes have skyrocketed from monthly volumes of $1 billion in May 2020 — when Uniswap v2 launched — to $186 billion in December 2021. Now, DEX volumes consist of ~12% of those from centralized exchanges.

Source: The Block, CoinGecko as of 23 March 2022

DeFi moves fast. Since Uniswap’s maiden whitepaper, a whole range of new AMM designs has been launched to improve upon Uniswap’s initial design. In this report, we review important AMM designs and market trends, highlighting some of the projects we find most interesting. We also discuss emergent behaviors that arise from AMMs, such as impermanent loss, concentrated liquidity management, and just-in-time liquidity.

Uniswap v2 — Zero to Infinity

We first briefly introduce Uniswap v2’s constant product formula. Uniswap v2 consists of liquidity pools — smart contracts that hold reserves of two tokens and allow anyone to withdraw and deposit funds according to the formula x * y = k, where x and y are the reserves of two tokens, A and B. In order to withdraw token A from the pool, a user must deposit an appropriate amount of token B to maintain the constant k before fees. A deeper dive into how the protocol can be found in Uniswap’s documentation.

Uniswap v2 immediately gained market traction. It introduced permissionless creation of any liquidity pool, allowing anyone to trade a long-tail of assets generally not available on centralized exchanges. Compared to DEXs that attempted to replicate limit order books on-chain, Uniswap provided a superior user experience with an intuitive user interface and significantly lower gas costs.

Perhaps most importantly, it enabled composability with other DeFi protocols. Users can use their LP tokens as collateral, developers can query liquidity pools as price oracles, protocols can create liquidity mining programs to spur liquidity for their native tokens, etc.

As a testament to its importance, Uniswap’s v2 codebase is perhaps the most forked smart contract in crypto. And when a new Layer 1 or Layer 2 platform is created, often the first primitive launched is a version of Uniswap v2.

Uniswap v2 — One of the Most Forked Contracts

Source: Github

Curve — One to One

But despite its elegance, there are several drawbacks to Uniswap’s constant product formula. One inefficiency of Uniswap v2 is that the model doesn’t appropriately suit swaps between different types of pegged assets that should theoretically have a 1:1 exchange rate, such as stablecoins. The DAI-USDC pool in Uniswap v2, for instance, utilizes only ~0.5% of total capital available because most trading occurs at a rate between 0.99 and 1.01. Furthermore, swappers experience a high price slippage on these trades. At the time of this writing, a trader looking to swap 1 million USDC tokens into DAI would incur 2.4% price slippage and only receive ~976k DAI through Uniswap v2.

A more appropriate pricing function for these stableswaps would be a constant sum formula (x + y = k), in which the price of one asset in relation to another is always one. In a constant sum USDC-DAI pool where k=10,000, a user that deposits 500 USDC into a pool would receive 500 DAI in return (excluding fees) so that k continues to equal 10,000.

The problem with this model, however, is that the pool can be completely drained. A pool initially consisting of 50% USDC and 50% DAI could eventually consist of solely one token. In contrast, a benefit of applying the constant product formula to stableswaps is that it is impossible for reserves to be completely drained in a liquidity pool.

Curve’s stableswap formula finds the middle ground between these two approaches. The stableswap formula contains a dynamic variable that modifies pricing based on a liquidity pools’ balance. The pool can slide up and down the constant sum formula when pools are approximately balanced, providing a stable price close to $1. When the pool becomes imbalanced it behaves more like a constant product formula, making it more expensive to move the pool out of balance and incentivizing liquidity providers to balance the pool. This can be seen visually in the chart below, where Curve’s Stableswap invariant is “in the middle” between Uniswap’s invariant and the constant sum formula.

Curve Stableswap Invariant

Source: Curve

Consequently, Curve’s stableswap formula is significantly more efficient for swaps between perfect or highly correlated assets, such as pairs between stablecoins, liquid staking to underlying assets (e.g., stETH — ETH), and wrapped assets (e.g., wBTC — renBTC). For the same 1 million USDC swap proposed above, Curve returns 999.7k DAI, a price slippage of only 0.03%.

USDC-DAI Rates on Ethereum

Source: 1inch as of 27 March 2022

Uniswap v3 — The Universal AMM

Another drawback of Uniswap v2’s design is its capital inefficiency. Pools offered liquidity from a price range of zero to infinity, but the reality is that most assets do not trade across that wide range; thus, the majority of liquidity in v2 pools remains unused.

Uniswap launched v3 in May 2021 to address this efficiency. Its defining feature is the introduction of concentrated liquidity. Instead of providing liquidity across the full price range, users can specify the ranges in which they would like to provide liquidity. For instance, LPs can provide capital for the DAI-USDC pool between 0.999 and 1.001, offering a ~2000x improvement in capital efficiency.

Uniswap v3 also introduced custom swap fees for each pool at 1%, 0.3%, and 0.05%. These swap fees allowed liquidity providers to better tailor their margins to expected pair volatility. For swaps between perfectly correlated assets, such as stablecoins, pairs converge to the lowest fee tier. In contrast, pairs for long-tail assets often calibrate to 1% due to greater uncertainty.

Yuga Lab’s recent airdrop of Apecoin illustrates this behavior. For the first few trading days after Apecoin’s airdrop, DEX liquidity was primarily executed on Uniswap’s 1% fee tier during initial price discovery. After prices settled in a range between $8 to $15 and price uncertainty lowered, volumes moved to Uniswap’s 0.3% fee tier.

Uniswap LPs Migrating to 0.3% Fee Tier After Initial Price Discovery

Source: Dune

Uniswap governance later added a 0.01% fee level, which is now the canonical fee tier for stablecoins. Combined with concentrated liquidity, volumes for USD stablecoin swaps on Uniswap are now on par with Curve’s.

USD to USD Stableswaps Concentrated At 1bps Fee Tier

Source: Dune (@pandajackson)

USD Stableswap Volumes — Uniswap Volumes On Par With Curve’s After Introduction of v3 and 1bps Fees

Finally, v3 also allows users to provide range orders. These are similar to limit orders on traditional limit order book exchanges, except that they could be partially filled or re-crossed if the price changes direction.

In addition to unlocking capital efficiency, Uniswap v3 greatly expands the design space for liquidity provisioning with customized price ranges. For instance, Dan Robinson from Paradigm illustrated how any static AMM can be replicated using a series of Uniswap v3 liquidity positions. In addition, Uniswap v3 range orders can be used to mimic options strategies — an interesting area for further exploration but out of the scope of this report.

However, with greater complexity comes greater headaches for LPs. Because Uniswap v3 positions are reflected as NFTs instead of ERC-20 tokens, they break the widely used convention of fungible LP tokens. Major money markets, such as MakerDAO and Aave, still do not directly accept Uniswap v3 tokens as collateral. Liquidity providers also do not get the benefit of compounding returns. Instead, they have to manually collect fees if they want to redeploy liquidity. Moreover, whereas LPs could not outcompete each other in Uniswap v2 — everyone was being rewarded for sharing the same dumb strategy — the introduction of Uniswap v3 tilts the playing field in favor of market makers, professional traders, and whales who can constantly rebalance positions at the expense of retail LPs who may wish to “set and forget.”

And perhaps the biggest issue LPs are still grappling with is the risk of magnified impermanent loss.

Impermanent Loss

Impermanent loss (“IL”, sometimes called divergence loss) describes the phenomenon in which the value of a liquidity provider’s stake can go down despite income from fees. More specifically, it is commonly defined as the difference between the value of a liquidity position in an AMM and the value of an equivalent HODL position. The intuition behind IL is simple: a constant product AMM consistently purchases the underperforming token and sells the outperforming token. Therefore, an investment that would have appreciated 1000x outside the AMM is limited to a mere 14x within the AMM.

Impermanent Losses Can Be Quite Permanent

This IL can be reversed if the token in question returns to its original value — hence the name impermanent loss. Trading fees are meant to compensate liquidity providers for IL risk, but multiple studies suggest that generated fees are not sufficient to cover IL, and liquidity providers generally end up only profiting when a trading pair eventually reverts to its original rate.

Concentrating liquidity also concentrates impermanent loss. It is akin to providing leveraged liquidity — and similar to trading on leverage, both gains (from fees) and losses (from impermanent losses) are magnified. Intuitively, as one token moons, liquidity providers that defined narrower price range deplete their reserves of the appreciating token faster than those with wider ranges, hence accruing greater IL. But if correctly done, those LPs also earn a greater share of trading fees.

Tighter Ranges Have Greater IL Risks

Source: Guillaume Lambert. Higher r values denote wider price ranges.

Concentrated Liquidity Managers

Because of the added complexities in managing concentrated liquidity, a whole host of concentrated liquidity managers (CLMs) have been launched. CLMs offer several benefits, such as:

  • Determining optimal ranges for providing liquidity by attempting to find the right balance between fee generation and impermanent loss;
  • Adjusting ranges when liquidity moves out of range;
  • Automatically compounding earnings back into liquidity positions; and
  • Providing gas savings from rebalancing.

CLMs typically offer vaults in which users can deposit their tokens. Positions in these vaults are typically reflected as ERC-20 tokens, reintroducing fungible LP positions back into the DeFi ecosystem. For instance, although Aave does not directly accept Uniswap v3 positions, it does recognize G-UNI vault tokens, ERC-20 tokens reflecting a vault position in Sorbet Finance’s liquidity manager, as collateral. Additionally, protocols and DAOs can also outsource liquidity strategies and mining programs to these vaults instead. Instadapp, Liquity, OlympusDAO, and several other projects all leverage the composability of CLM vault tokens in their liquidity management strategies.

Some CLMs, such as Charm Finance and Sorbet Finance, adopt a passive rebalancing strategy in which rebalancing rules are set initially and published on-chain. Keeper bots are used to monitor the pool’s condition and rebalance if necessary. Others, such as Gamma Strategies, take an active rebalancing approach in which strategies are determined off-chain and often kept proprietary. Teams are also experimenting with letting the market decide the optimal strategy. Steer Finance and Sommelier Finance, for instance, plan to allow anyone to create and run their own strategies.

Overview of Concentrated Liquidity Managers

Based solely on yield generation, the effectiveness of CLMs is still questionable. Judged on ETH-USDC vaults, Gamma’s Hypervisor has underperformed a comparable Uniswap v2 strategy. Charm’s equivalent Alpha Vault only marginally outperformed. Furthermore, vaults that publish their rebalancing rules on-chain are vulnerable to being front-run — akin to a professional market maker that broadcast its strategy to the market before executing its trades. This is a low risk for now given their relatively modest TVL, but will likely become a concern if they continue to grow.

USDC-ETH Vault Performance

Source: Dune (@vividot)

Research from the Bancor team also found little evidence that active liquidity management strategies perform better than passive LPs. In fact, it found that the only consistently profitable LP strategy — one where fees generated outweigh impermanent loss — is providing just-in-time liquidity, which we touch on in the next section.

More research needs to be done, but the outlook for meaningful outperformance is not positive. Sommelier Finance, a blockchain protocol built on the Cosmos SDK focusing on Ethereum DeFi strategies, originally focused on automating Uniswap v3 positions before pivoting to another direction. According to the team, even by running backtests where the team knew the future price of the token in advance, automated strategies were still unprofitable due to rebalancing costs (crystallizing impermanent loss and transaction costs).

Nonetheless, CLMs provide other benefits, such as enabling DAOs to more efficiently run liquidity mining programs and provide liquidity on DEXs. Therefore, they will likely continue to grow alongside greater adoption of concentrated liquidity.

Flash in the AMM

One of the arguably pernicious emergent behaviors from the introduction of Uniswap v3 is just-in-time (JIT) liquidity. JIT liquidity occurs when a trader (or more accurately, a trading bot) sees a pending swap transaction in the mempool that has yet to be included in a block on-chain. The bot carefully adds concentrated liquidity around an incredibly narrow range prior to the swap, allows the swap to occur, then removes liquidity, typically all in a single block. By doing this, the bot is able to capture a high percentage of fees for the “sandwiched” swap while virtually eliminating the risk of impermanent loss.

We provide a recent example of JIT liquidity below for a user looking to swap ~$80k worth of Apecoin. The trading bot minted a Uniswap v3 position consisting solely of $ETH (range order), allowed the user to swap $APE for $ETH in the next transaction, then removed liquidity afterward. Note that in this example, in addition to capturing an inordinate proportion of the swap fee (94%), the bot also profited from different prices listed on Uniswap (~$12.80 per $APE) and on centralized exchanges like FTX (~$13.19 per $APE).

Source: Etherscan, Trading View, Uniswap

Some argue that JIT liquidity improves the experience from the perspective of a swapper, who gets a reduction on expected price impact due to the spike in liquidity. In the above example, the bot added ~$40 million of liquidity into a pool that only had ~$18 million of TVL prior, improving depth.

However, passive liquidity providers lose out. They get their income from swapping fees diluted while still being exposed to impermanent loss and high market impact trades.

Fortunately, the impact of JIT liquidity is relatively muted for now as activity is mostly limited to two MEV bots. But profits attract competition, and these two bots have cumulative racked up ~$1.3 million of profits since last June. Greater growth of JIT liquidity could gradually disincentivize passive liquidity provision, and taken to its extreme, would result in a request-for-quote market in which users place limit orders and active LPs compete to fill them with JIT liquidity. In this scenario, price discovery is limited and users bear greater uncertainty about their expected execution price. And philosophically, this situation goes against one ethos of decentralized finance where users operate on a (relatively) equal footing as market makers.

Curve v2 — Concentrated Liquidity for Risky Assets

As mentioned above, Curve v1 concentrated liquidity at a 1:1 exchange rate for perfectly correlated assets, such as stablecoins and liquid staking tokens. Curve v2 aims to introduce this dynamic to volatile asset pairs by using a dynamic peg. It calculates an internal price peg for each liquidity pool based on the trading within the pool and concentrates liquidity around that peg.

Curve v2 Compared to Other AMM Invariants

Source: Curve, Nagaking

The internal price is based on a running exponential moving average, which is similar to a simple moving average but places higher weights on most recent prices.

Curve v2’s Internal Price Oracle vs. Spot Price for CRV-ETH

Source: Curve

Sometimes, an asset’s sudden price movement may warrant concentrating liquidity around another price. However, much like adjusting an out-of-range Uniswap v3 position, this makes an impermanent loss permanent. Therefore Curve’s internal price peg can readjust, but only when it is profitable to do so (i.e., when accrued profits from trading fees since the last re-peg outweighs the crystallized impermanent loss).

Moreover, trading fees within Curve v2 pools are dynamic. During periods of low volatility, trading fees are low (as low as 0.04%). In volatile times, trading fees are increased to harvest volatility and compensate liquidity providers for impermanent loss that occurs in directional moves.

The (Other) Curve Wars

Curve v2 could be appealing to liquidity providers as it offers the capital efficiency of Uniswap v3 without the active management of positions. Furthermore, because all LPs deposit into the same pool with the same price range, there are no JIT liquidity issues.

For now, Curve v2 is still limited to only a handful of pools. Its Tricrypto pool (USDT + wBTC + wETH) is its most popular, with ~$3 billion of monthly volume. Tricrypto volumes have significantly grown since last year, achieving nearly 40% of Uniswap’s volumes for the same pairs.

Tricrypto Volumes Stabilizing Around 40% of Comparable Uniswap Volumes

Source: Dune (@momir)

Tricrypto only sees between 20–30 daily active traders and 477 total unique users since inception — volumes are driven primarily by MEV (miner extractable value) bots running arbitrage strategies, DEX aggregators, market makers, and whales.

Activity Largely Driven by MEV Bots and Aggregators

Source: Dune (@momir), Etherscan, Nansen

Curve also offers v2 pools for a handful of other assets, such as CVX-ETH, CRV-ETH, and EURT-USDT. In practice, Curve v2 pools are often as competitive as rates offered by Uniswap and other DEXs.

Competitive Rates for Curve v2 Pools

Source: 1inch, as of 25 March 2022

Uniswap v3 and Curve v2 share many similarities. The difference lies in how each platform manages the complexity that comes with concentrating liquidity. Uniswap v3’s philosophy of building a universal AMM creates an ultra-flexible platform and relegates the task of managing positions to users. Curve v2 also has a high degree of complexity, with nine tunable parameters that affect the bonding curve, internal price scaling, and fee characteristics of the pool. But if you treat these parameters as a black box, using Curve v2 pools become extremely easy.

Crocswap — Enabling HFT in DeFi

Creating new pools and rebalancing concentrated liquidity positions on most DEXs cost high gas fees because each liquidity pool is a separate smart contract and, on Uniswap, each concentrated liquidity position is its own NFT token.

Crocswap, a soon-to-be-launched DEX, is built with a first-principles approach to blockchain design. It consolidates all liquidity pools on the exchange into one single smart contract and represents individual pools as lightweight data structures. This architecture allows traders to execute multi-step, multi-pool transactions all within a single contract, netting the flows across all pools. As a result, traders have lower transaction fees and fewer taxable issues — a differentiator that will be particularly pronounced for those that trade frequently across multiple pairs. The single-contract design also paves the way for a ton of other features — for example, margin trading becomes easier to implement as capital is all under one location.

Similar to Uniswap, Crocswap allows liquidity providers to provide ambient (Uni v2 style) or concentrated (Uni v3 style) liquidity. But unlike Uniswap, ambient and concentrated liquidity all live within the same pool. This offers several benefits compared to Uniswap’s design. First, it enables fungible LP tokens that offer the composability benefits mentioned in prior sections. Second, other users and protocols can query the total ambient liquidity and fraction of active concentrated liquidity in a single call function. In contrast, whereas ambient liquidity can be replicated in Uniswap v3 as liquidity with very wide ranges, it is impossible to aggregate this total liquidity in an on-chain context.

Moreover, fees automatically compound for concentrated liquidity providers into the ambient liquidity pool, saving LPs time and gas fees. Conceptually it’s as if Uniswap v3 positions accumulate fees in the form of Uniswap v2 LP tokens. This is likely a net positive for volatile pairs (e.g., ETH-USDC) but less efficient for pegged assets (e.g., DAI-USDC). The team is considering variations of this structure for different types of liquidity pools.

Crocswap Dual Liquidity Example

Source: Crocswap

Crocswap also mitigates issues from JIT liquidity by allowing pools to have a time threshold for depositing and withdrawing concentrated liquidity, between 0 to 255 seconds. This creates a fairer environment for less active liquidity providers, provides firmer quotes for swappers, and improves price discovery. Nonetheless, because JIT liquidity does improve execution quality, the protocol could allow for whitelisted participants to act as JIT traders.

Finally, similar to centralized exchanges, Crocswap also allows LPs to deposit collateral directly in the DEX. Active traders could deposit surplus collateral at the exchange, such as USDC, and execute hundreds of trades throughout the day, with each trade outputting to their surplus collateral balance. Again, this saves on gas costs — traders only need to handle one single surplus withdrawal. It also provides a pool of collateral that other traders can leverage for flash loans.

We anticipate that Crocswap’s design will unlock the ability to conduct high-frequency trading on-chain. It is a step in the right direction for having price discovery occur primarily on-chain, and in the long term, for the bulk of trading to occur on DEXs instead of CEXs.

Platypus — One to One to One

Despite Curve’s efficiency in swapping between stablecoins and pegged assets, its design still has some pain points. Notably, separate liquidity pools have to be created for each token pair (/ trio/quartet/etc.) and similar assets can be duplicated across multiple pools. USDC in one pool cannot support liquidity in another USDC pool.

Liquidity for the Same Assets Spread Across Multiple Pools

Source: Curve Finance

New stablecoin projects may need to create and support multiple pools to provide sufficient liquidity to users and prevent arbitrage opportunities. Moreover, the growth of stablecoin pools is often bottlenecked by the least popular token.

Platypus, a stableswap that launched on Avalanche early this year, is designed to address these drawbacks. It allows an open liquidity pool in which all similarly-pegged assets are commingled. Liquidity providers can deposit and withdraw tokens of the same kind.

We mentioned above that Curve v1 uses a combination of the constant sum formula (x + y = k) and constant product formula (x * y = k). Platypus instead modifies the constant sum formula alone, using coverage ratios to encourage depositors to keep the open liquidity pool balanced. This results in a longer, flatter region and accelerated slippage at the tail ends of the curve. Consequently, in normal times, Platypus can offer slippage reduction of as large as 40% compared with other AMMs for large stableswaps.

Platypus Design Overview

Source: Platypus. Green line is Platypus AMM invariant.

Platypus Offering Better Price Slippage than Curve on USDC-DAI

Source: 1inch, as of 27 March 2022

So far, Platypus only supports the three major USD stablecoins: USDT, USDC, and DAI. Its liquidity utilization rate (24-hour volume divided by TVL) is an impressive 12%; in contrast, Curve’s comparable pool (“3pool”) has a rate of 1.84%. We look forward to seeing how the platform’s utilization rates and TVL growth evolve with the addition of smaller-cap stablecoins (e.g., FRAX, FEI, MIM) and other types of pegged assets.

Bancor — Don’t Fade the OG

Bancor v2.1

Bancor has iterated on multiple AMM designs since v1 in 2017. Its v2 attempted to utilize oracles to dynamically rebalance liquidity pools and avoid arbitrage opportunities but decided to pivot due to poor performance (we touch on the challenges of oracle-reliant AMMs in the next section).

Introduced in October 2020, the current version of Bancor (v2.1) is predicated on two key features: single-sided liquidity and impermanent loss protection.

Bancor was one of the first AMMs that enabled single-token exposure. [Note: the ability to deposit only one token to receive LP tokens is not necessarily single-token exposure; some platforms either convert the deposited tokens into the correct ratio on the back-end or account for slippage when calculating pro-rata LP ownership.]

Every pool on Bancor consists of two tokens: a relevant token and $BNT, Bancor’s native token. For instance, if Alice wants to supply wBTC tokens, Bancor’s protocol will match the equivalent USD value of those tokens by minting BNT. Therefore, Alice and Bancor protocol each both own 50% of the pool. If another swapper on Bancor’s platform wants to sell ETH for wBTC, the trade would be routed through ETH-BNT and wBTC-BNT pools, and Alice would receive fees from the wBTC-BNT trade.

Bancor v2.1 also offers impermanent loss protection to long-term liquidity providers. LPs who maintain their deposit after 30 days are guaranteed to receive at least 30% of their initial deposit back. This ratio increases linearly by 1% per day, so that on the 100th day, LPs’ principals are fully guaranteed by Bancor protocol. Any IL incurred by LPs is first covered by the trading fees that Bancor incurs through matching each LP’s position, and then by minting $BNT if there is a shortfall.

Bancor’s IL Protection Design

Source: Bancor

However, Bancor’s v2.1 design had several key limitations:

  • High gas costs. Bancor’s gas fees are significantly higher than competing DEXs due to protocol and smart contract design. Each swap is a double hop between two assets (token A -> BNT and BNT -> token B). There is also underlying complexity in calculating IL incurred by each individual LP.
  • Limited single-side LPing. Due to IL protection, each token pool has a cap that is determined by Bancor DAO’s co-investment. If a pool is full, prospective LPs have to wait for existing LPs to withdraw their liquidity. Pools for more popular tokens, such as ETH, wBTC, and stablecoins, have remained fully subscribed for a long time.
  • 100-day waiting period for IL protection. As mentioned above, Bancor’s IL insurance is spread out over 100 days.
  • Manual claiming of rewards. LPs have to manually claim their rewards, preventing auto compounding of fees and making it more uneconomic for smaller LPs to justify compounding.

Bancor v3

Bancor v3, announced in November 2021 and yet to be launched, attempts to address these drawbacks by effectively redesigning the protocol while maintaining v2.1’s key features.

Single-sided liquidity provisioning has been redesigned. When an LP deposits a token (TKN), they receive an equivalent Bancor pool token (bnTKN). These pool tokens auto compound fees, so 1 bnTKN is always greater or equal to 1 TKN. Pool tokens were absent from Bancor v2.1, and because these pool tokens reflect a single underlying asset with no IL, they will likely be powerful primitives in other DeFi platforms (e.g., as collateral).

The deposited tokens are sent to a single smart contract, which contains all tokens across the platform. So although it seems like there are individual liquidity pools on the front-end, in reality, all funds are in a single vault with a logic layer coordinating deposits, withdrawals, and swaps.

Bancor v3’s Omnipool Design

Source: Bancor

This architecture presents several benefits. First, it allows trades to happen in one hop instead of two, as the intermediate BNT hop is virtualized, reducing gas fees. Second, the complexity of calculating each LP’s IL is dramatically reduced with pool tokens, again saving on gas costs. BNT stakers also do not need to pick which specific pool their tokens should go to. Instead, all BNT liquidity providers earn the same yield.

Most notably, this design allows for uncapped deposits. Similar to Bancor v2.1, the Bancor DAO determines the available liquidity for trading for each token. But if this limit is reached, users can continue to deposit tokens. These excess tokens help 1) reduce the overall IL impact of sudden price changes, and 2) can be deployed for other fee-earning strategies outside the protocol. For instance, spare ETH can be staked for stETH, excess LINK can be staked, spare USDC can be lent out in Aave, etc.

Impermanent loss protection in v3 has also been redesigned. LPs get full IL protection immediately, instead of waiting 100 days in v2.1. In exchange, Bancor v3 imposes a 0.25% withdrawal fee and 7-day delay to mitigate any potential attack vectors. Additionally, other protocols and DAOs have the option to offer IL protection in their own tokens, improving their ability to get whitelisted and encouraging greater liquidity on Bancor’s platform.

A New Dawn

Every AMM has to balance the interests among users (who want the widest selection lowest slippage and lowest fees), liquidity providers (who want the highest yields with limited IL), external protocols (who want to offer sufficient liquidity for their tokenholders at low cost), and native tokenholders (who want to see token appreciation). Bancor v2.1 introduced several innovative solutions that protected LPs and protocols, but perhaps at the expense of users due to high gas costs. Combined with deposit limits, this has resulted in stagnated growth in TVL, trading volume, and ultimately, BNT token price.

Stagnant Growth of Bancor’s AMM Since Last Summer

Source: DefiLlama, CoinGecko

Bancor v3 offers the best of all worlds. With unlimited deposit caps and immediate IL protection, Bancor will likely see substantial growth in TVL. The Bancor DAO could use this additional firepower to lift the available liquidity for trading, deepening the depth of the pool and reducing price slippage for swappers. Along with a reworked design that reduces gas fees, this could boost volumes routed to Bancor via aggregators like 1inch. Higher trading fees both directly improve IL protection, through a larger IL insurance fund, and indirectly through potential BNT price appreciation. Protocols and DAOs could also contribute to platform growth by launching customized rewards programs. 30+ DAOs are already using Bancor for treasury management, including Nexus Mutual, Yearn Finance, and Woo Network.

But we have yet to see this play out. Bancor v3’s will be rolled out in three phases. The first phase, containing key features of Bancor v3 such as instant IL protection, will likely be launched in Q2 2022 with a public bug bounty. Phase two includes additional features such as the superfluid yield generation with idle assets.

Due to Bancor DAO’s whitelisting process, it may never become the “universal AMM” that AMMs like Uniswap and Crocswap aspire to. Nonetheless, its platform design stands out in the DeFi space, and we expect Bancor to play an integral part in the ecosystem going forward.

Oracle-Assisted Market Makers

A common problem with simple AMM algorithms, such as the constant product formula, is that prices are always “stale.” Because prices between two pairs are simply a function of reserve balances, they are primarily updated to market prices through arbitrage trading. In fact, the majority of flows that get executed on AMMs are primarily arbitrage-driven.

Impermanent loss can also be thought of as the loss that liquidity providers incur from receiving “toxic flow” — a term commonly used in high-frequency trading that describes trades from informed counterparties. LPs in AMMs are always providing the “wrong” price and rely on others to trade against them until the quote is correct. In an attempt to limit toxic flow, some protocols are integrating oracles that pull prices from external markets to avoid their liquidity providers being run over. These AMMs are commonly termed proactive market makers.

Dodo — The Proactive Market Maker

Dodo is one of the first proactive market makers to launch on the market, leveraging prices from external markets to concentrate liquidity around the market price. Dodo can adjust the impact that external prices have. On one extreme, Dodo’s AMM concentrates liquidity at exactly the external market price and executes buy and sell orders at that price. On the other extreme, the market price has no impact and Dodo’s bonding curve effectively becomes a Uniswap v2 curve.

It may seem that Dodo should just set its parameter to execute only at the external market price, but that also increases the risk of arbitrage loss. For instance, consider a trader that knows that the oracle price for an asset will go up in the next block. She would attempt to buy this asset in size before the price update, allow the oracle to post the updated price on-chain, and sell it on Dodo immediately for risk-free profit. Reducing concentrated liquidity alleviates this risk. Therefore, Dodo sets the parameter to not solely rely on oracles to balance concentrated liquidity with the risk of arbitrage loss.

Dodo also sets transaction fees between 0.3–0.5% for volatile pairs, so front-running is only profitable when price deviations are greater than 0.6–1.0% (transaction fee occurred from both buying and selling). And because Chainlink updates on-chain prices for every 0.5% for these assets, such as BTC-USD and ETH-USD, front-running primarily occurs in extreme market conditions. Backtests that the Dodo team ran suggest that losses are incurred mostly during volatile market environments.

Source: Dodo

Dodo also allows liquidity providers to deposit any combination of two tokens in a trading pair, including single-token deposits. LPs can, for instance, solely deposit ETH in an ETH-USDC pool. Thus, Dodo asserts that providing liquidity on their platform offers no impermanent loss.

But there is no free lunch. Because Dodo takes inventory from liquidity providers and effectively acts as a market maker, it trades off IL risk with inventory risk — the risk that comes with being overweight on one pair as the market moves against that pair. This is effectively another form of toxic flow — and one that Dodo has struggled to mitigate. For that reason, the majority of Dodo’s TVL is locked in pegged assets instead of volatile ones.

Percentage of TVL Between USD Stableswaps

Source: Dodo, Uniswap as of 29 March 2022

Lifinity — Proactive Market Making on Solana

Lifinity replicates a similar model but on Solana using Pyth Network as an oracle. Because Pyth provides data feeds on every slot and the lack of a fee market on Solana, front-running price oracles are not an issue. Lifinity is currently in beta with gated access to depositing liquidity but test results appear positive: Lifinity was even able to achieve gains through January on its SOL-USDC pool.

Source: Lifinity

It largely achieved this during the beginning of the period by accumulating more USDC while the price of SOL was falling (period A above). Hence, it profited through astute inventory management. Nonetheless, during more volatile market conditions (period C), Lifinity also saw a period of losses as it rebalanced its liquidity pool right before SOL prices contracted quickly.

The litmus test will come when Lifinity opens deposits to the wider public; it is easier to outperform with a $1 million vault compared to a $100 million vault. Furthermore, the upcoming introduction of a fee market on Solana may create vectors for front-running, depending on how the fee market is implemented.

Challenges in PMMs

AMMs that use oracles come with distinct trade-offs. Oracles are a key attack vector for DeFi exploits through price manipulation and front-running. Furthermore, they are limited to larger-cap cryptocurrencies. Chainlink, the largest oracle provider, covers only 104 cryptocurrency pairs on Ethereum mainnet; in comparison, Uniswap v2 has over 1,500 tokens on its platform.

Perhaps these are temporary issues that could get solved within the near term. But even aside from those, they face path dependency issues that traditional constant product AMMs do not face. If ETH unexpectedly moons by 50% relative to USDC and then returns to its original value, LPs in constant product AMMs are guaranteed to have no impermanent loss and benefit from the activity in trading fees. In contrast, PMMs may see losses from unfavorable inventory changes and also see less trading activity from widening their spreads.

Summary

To summarize some of the major AMM trends:

Greater emphasis on protecting LPs and managing IL risk instead of capital efficiency. Early last year, there was a greater focus on improving capital efficiency for LPs. The introduction of Uniswap v3 has not only solved that, but also shown how damaging IL can be for liquidity providers. Thus, attention has shifted to protecting LPs and managing impermanent loss through a wide range of mechanisms, from IL protection (Bancor), price oracles, dynamically adjusting spreads, etc.

Efficiency gains are now more focused on protocol design. Projects seek to improve price slippage and reduce gas costs largely through consolidation. For instance, Bancor v3 and Platypus all use an “omnipool” concept that reduces liquidity fragmentation, hence improving depth. Similarly, Crocswap consolidates everything into a single smart contract, drastically reducing gas fees. The benefits are obvious. But this trend could also heighten smart contract risk — hackers stand to gain a lot more from successful exploits.

Composability is still front of mind. While Uniswap v3 does not necessarily break composability, it is a taller task for other projects to integrate unique NFT positions instead of fungible tokens. Other AMMs are thinking of creative ways to create useful, composable money legos that other users and protocols can leverage.

We attempt to cover most of the major existing and upcoming AMMs, but due to the rapidly growing DeFi ecosystem, we necessarily focus primarily on EVM-based AMMs. There is a ton of innovation outside of the AMMs we mentioned, particularly with the emergence of key enabling infrastructure. High throughput blockchain platforms have enabled a return to exchanges that utilize a central limit order book, such as Serum on Solana and ZigZag Exchange on StarkNet/zkSync. New DeFi primitives such as Opyn’s Squeeth allow LPs to completely hedge impermanent loss. The introduction of countless bridges enables AMM systems that span across multiple blockchains, such as Osmosis and Catalog Finance.

Overview of Major Existing AMMs

Source: Project websites and whitepapers, DefiLlama, CoinGecko. As of 27 March 2022.

Media often comments that cryptocurrency is just rediscovering traditional finance. The emergence of high throughput L1 and L2 blockchains that enable order book trading begs the question: why bother with AMMs?

Yet the allure of DeFi is not just recreating traditional finance. Nor is it about addressing some of TradFi’s flaws. Instead, we believe the promise of DeFi is the rethinking of how financial systems should operate, in a digital context, from the ground up. AMMs are exciting because they are a completely new primitive that never existed before. And we have only scratched the surface.

Disclaimer

The information contained in this post (the “Information”) has been prepared solely for informational purposes, is in summary form, and does not purport to be complete. The Information is not, and is not intended to be, an offer to sell, or a solicitation of an offer to purchase, any securities. The Information does not provide and should not be treated as giving investment advice. The Information does not take into account specific investment objectives, financial situation or the particular needs of any prospective investor. No representation or warranty is made, expressed or implied, with respect to the fairness, correctness, accuracy, reasonableness or completeness of the Information. We do not undertake to update the Information. It should not be regarded by prospective investors as a substitute for the exercise of their own judgment or research. Prospective investors should consult with their own legal, regulatory, tax, business, investment, financial and accounting advisers to the extent that they deem it necessary, and make any investment decisions based upon their own judgment and advice from such advisers as they deem necessary and not upon any view expressed herein.

--

--