Dose of DeFi will be off for the rest of the summer and back in the fall. Research ideas and suggestions welcome just hit reply. Have a safe and happy for summer.
– Chris
Automated-market makers (AMMs) are the greatest innovation DeFi has ever seen. Decentralized exchanges were created to allow non-custodial trading, but AMMs took this further with pooled liquidity, which enables passive market making and always ensures there’s a counterparty to trade with. And unlike lending, there’s no dependence on off-chain infrastructure like oracles.
Uniswap launched in the fall of 2018 and by DeFi summer in 2020, it was clear that AMMs had found product-market-fit, by offering permissionless liquidity bootstrapping for any token. Yet the problems with AMMs were also soon clear: namely MEV and the aptly-named ‘impermanent loss’, which has since been rebranded into the more technical ‘loss versus rebalancing (LVR)’. To simplify, when prices move, arbitrageurs trade against passive liquidity providers (LPs) that are still quoting stale prices, leading to consistent losses. Additionally, the public and permissionless liquidity pools in AMMs make these exchanges highly vulnerable to the dark forest of MEV.
The order book versus AMM argument has gotten old. Yes, order books should theoretically be more efficient, but the stubborn real-world success of AMMs implies there is clearly demand.
Now, with the mainnet launch of Ambient Finance (formerly CrocSwap) and the public release of Uniswap v4, there’s hope that the full potential of AMMs can be realized. The remaining question though, is whether two conflicting visions can be reconciled: Can AMMs simultaneously be both the playing field for sophisticated high-frequency traders and a reliable place for passive DeFi investors to park their assets?
Market makers do not make directional bets. Their business is buying and selling an asset quickly, earning their take not from asset appreciation, but from trading fees. The shorter amount of time they have to take price exposure to an asset, the better.
Market makers will sell to anyone – but they do have favorites. The ideal counterparty is an uninformed investor looking to sell at market price, as a market maker usually feels confident that they can quickly sell into the broader market at a similar price. A market maker’s least favorite counterparties are fellow sharks and market makers. They’re not trading because they want asset ownership, but because there’s some price arbitrage to be squeezed. This is toxic flow because the PnL is hurt more than the extra trading fees generated.
For automated market makers, most toxic flow comes from sudden CEX price changes. Every time the price of ETH moves on Binance, there’s a race to trade against AMM LPs which have not updated their prices. Ambient Finance’s 0xfbifemboy estimated that $100m was lost by USDC/ETH LPs on Uniswap v3 to arbitrageurs in the 12 months leading up to September 2022 during the five minutes after major price movements on Binance.
In Uniswap v3, liquidity providers could customize the pool and the price range for their liquidity. V4 introduces more customizable features to pool creation known as hooks – arguably its most attractive new feature:
Hooks are externally deployed contracts that execute some developer-defined logic at a specified point in a pool’s execution. These hooks allow integrators to create a concentrated liquidity pool with flexible and customizable execution. Hooks can modify po9ol parameters, or add new features and functionality. Example functionalities that could be implemented with hooks include:
Executing large orders over time through TWAMM
Onchain limit orders that fill at tick prices
Volatility-shifting dynamic fees
Mechanisms to internalize MEV for liquidity providers
Median, truncated, or other custom oracle implementation.
Individually, none of these functionalities solve the issues facing AMMs, but they provide the tools to design a more efficient system. Going back to the example of toxic flow, a liquidity pool in v4 could dynamically raise the swap fees during times of high volatility or protect itself by using an external oracle that would update the pool’s prices more quickly, or allow certain addresses to trade with the pool.
Ambient has a similar feature through its protocol gating and permissioned pools, although these must be approved by protocol governance. Essentially, liquidity can unionize and program the specific terms it will trade with the market. This helps tilt the balance towards LPs trying to earn a return.
Uniswap v4 and Ambient introduce a myriad of efficiency upgrades, thanks to the five years of real life experience in DEXs, particularly in optimizing gas usage in smart contracts. The most important design choice is the singleton smart contract architecture, used by both Uniswap v4 and Ambient. In the previous versions of Uniswap, each pool has its own smart contract, which means significant transaction costs when shifting tokens from one pool to another. Balancer v2 was the first to put all tokens in a single contract, which introduces additional security concerns in return for lower gas costs.
Uniswap v4 and Ambient also both feature ERC-1155 flash accounting, which allows gasless trading (only paying gas costs when adding/removing from the pool). Ambient differs from Uniswap in its fee accumulation. Fees are automatically converted to Ambient LPs (traditional 50/50 Uniswap v2 LP positions), instead of in the native asset and with the need to be claimed.
The last few years of development in the MEV space have shown that you can’t uniformly protect against MEV. Inefficiencies will emerge and sharks will be there ready to pounce. It’s a constant cat and mouse game. Permissioned pools in Ambient and hooks in Uniswap v4 are significant tools in the arsenal for LPs and swappers to protect against MEV, because they create programmable ways to intermediate between swappers and LPs. MEV minimization and extraction will still take place through batch auctions, SUAVE, or some other intents matching protocol, but with the customizable pools in Ambient and Uniswap v4, LPs can now demand a piece of the pie. Dynamic fees will also help a lot.
Early on, DeFi seemed to be a continuation of the passive investing revolution. Just as Vanguard showed that active stock picking was worse than just sitting on a general basket of stocks, DeFi would eventually show that active market making was inferior to passive liquidity provisioning controlled by smart contracts. In this world, anyone could be a market maker, not just the Wall Street Elite.
More recently, MEV can trace its lineage to the Flash Boys revolution and the rise of electronic trading in the early 2000s. Uniswap v3 fits better in this lineage. Most average DeFi users don’t LP on Uniswap v3; it’s too complicated to benefit from the capital efficiency advantages. The vision that third-party apps, like Gelato, would be a usable rebalancing interface for retail users never fully materialized.
Uniswap v4 and Ambient aim to be universal protocols, ones that don’t just cater to HFT firms or passive liquidity bros. Yet it remains unclear whether the goal will be to go after the most widely-traded tokens (ETH) or the long-tail of smaller tokens? The burden of connecting these disparate groups will fall to new AMM designers.
Over the last few years, the AMM pendulum has clearly swung to sophisticated traders. Yet AMMs (and DeFi more broadly) will only thrive if there are passive, profitable, and verifiable ways for everyday users to earn yield on-chain.
-
Different ways to access the 3.49% Dai Savings Rate Link
-
Token Terminal: Overview of DeFi asset management Link
-
Restaking protocol Eigenlayer launches, maxes out with $16m in deposits Link
-
Frax to launch its own Layer 2 rollup Link
-
Synthetix lists stETH Perps Link
That’s it! Feedback appreciated. Just hit reply. Written in Jacksonville, Florida next to the St. John’s river. Hope everyone gets some beach time this summer.
Dose of DeFi is written by Chris Powers, with help from Denis Suslov and Financial Content Lab. All content is for informational purposes and is not intended as investment advice.