Given a fixed amount of LP liquidity, a v3 AMM requires considerably less capital. However, these are not the only way to generate capital-efficient LP positions. To understand, let’s start with the basic unrestricted range LP position.
Uniswap v2
There is one axiom in a standard constant product automated market maker (CPAMM).
I prefer the concrete ETH and USD in examples because its clear price refers to USD to ETH. However, this generalizes; you can replace either with x and y.
Our intuitive notion of price is defined as the marginal exchange rate of USDC to ETH, which equals the ratio of tokens in a v2 pool.
Given this, we can calculate the number of tokens in an LP position based on the LP's liquidity and the asset's current price.
ETH balances go to infinity as the price goes to zero, ensuring the pool will always have positive values of both tokens, and the value will always be positive.
As the LP's position is linear in liquidity, the sum of the individual positions equals the pool positions. Every LP can be considered a pro-rata owner of the pool with equal standing, like a standard stock owner: double the liquidity doubles the value.
When a trader swaps a token into the pool, the new price can be calculated given the initial price and liquidity. Liquidity is constant during a swap transaction, as it is a constant by assumption.
One can also calculate the amount of tokens spit out of the pool, given the amount going in and the pool's initial price and liquidity.
It's a robust, elegant solution to decentralized trading on the blockchain.
Restricted Range Adjustments (aka, Uniswap v3)
A nice property of v2 pools is there is zero risk of a contract or LP having a negative net value (insolvency). With no potential insolvencies, LPs can be assured their position values are secure. LPs merely face the price risk of the asset in the pool (their delta) and the convexity costs (their gamma).
The cost of this approach is they are overcapitalized. Half of LP capital is only touched if the price rises by a factor of four {-75%, +400%}. That's fine for many LPs who want to ignore their positions for a month or more. Yet it is excessively prudent for those who are more active because they know their active management makes this excessive.
Uniswap introduced their version 3 (v3) to increase capital efficiency. V3 truncates an individual LP's position at user-chosen low and high price bounds, a restricted range. If the price goes outside the LP's range, his positions do not change because it is inactive.
When the price is below the LP's range, the LP has a fixed amount of ETH and zero USDC. When the price is above the range, the LP only has a fixed amount of USDC but zero ETH. Within the range, when it is active, his ETH and USDC pool balances change just as with v2 LPs, as shown by the black term that is a function of price. The red term is constant, reflecting the implicit leverage created by the v3 approach.
This leads to liquidity varying over the price range, as the pool aggregates many independent LPs with various overlapping ranges. Below is a chart from Uniswap where each verticle blue column represents the liquidity in a specific price range. On v3 pools, liquidity is usually distributed symmetrically around the current price, but it can and does vary considerably across pools and time.
The original v2 price and swapping functions are put into a looping function with piecewise linear liquidity assigned to multiple price points. When trades push a price to the end of a liquidity range, the remaining tokens to be sold are applied to the price as if it were a separate transaction. This is done repeatedly until the trade is finished. The contract has to store data for each liquidity range price point to calculate the fees accruing inside the range. This process generates 50 to 300% more CPU per trade than in the original case.
Ugliness aside, V3's capital savings are considerable, especially for those who like to actively manage their LP positions daily. Daily volatility for ETH is around 3%, so a 5% range with price pounds +/-5% around the current price, adjusted daily, would be active most of the time over a year. Such a range would generate leverage of nearly 40, or a capital savings of 97% compared to a v2 approach.
While the system is always solvent, it can still generate scenarios where it can get ‘stuck.’ For example, there's no logical reason there cannot be zero liquidity below or above a specific price (though, if liquid, this would generate a profit opportunity ). If so, the contract can run out of USD or ETH, so trades above or below specific prices are not feasible. You may not be able to buy if the current AMM price is $4000 and there is zero liquidity above that price. The v3 AMM will always be solvent, but it can be inactive.
Margined LP Positions
Instead of creating multiple ranges with their specific liquidity, one can generate capital efficiency by giving LPs margin accounts that record the amount of their pool positions borrowed at inception. For example, if an LP deposits 1 ETH and 3k USDC to generate pool positions of 5 ETH and 30k USDC, the LP's ETH and USDC margin would show a debt of 4 and 12K, respectively. This AMM loan is just an accounting contrivance because no external ETH or USDC is needed to generate this loan.
The LP's margin quantities in pink above are constant, fixed debts that must be repaid. The pool quantities in blue on the asset side of the balance sheet vary as a function of price. The LP's equity or net position in green is the residual of the variable pool quantities minus the fixed debts.
As with all leveraged accounts, a margined LP with an unrestricted range can become insolvent, unlike a v3 LP position. While LP insolvency would be disastrous, with a leverage cap of 5, the range covered would be from down 75% to up 400%. A margined LP, or potential liquidators, will have ample time to redress potential insolvencies.
However, it is not insolvency but the absence of tokens that generate a bigger problem for the margined AMM. For example, in the graph below, the LP is levered 5 times as in the above chart; the LP puts in one-fifth the capital a regular v2 LP would. With a price starting at $3000, the LP would run out of USDC at $1920, well before his insolvency price of $750 on the downside. On the upside, the LP would run out of ETH at $4700, with insolvency at 12k
If our pool contained only a single LP, negative token balances would be impossible because the pool would not have the tokens to send to the swapper, so that the transaction would fail. This contract failure would be no different than if a v3 pool's current price were at the edge of a range, and a swap would push the price into a range with zero liquidity. Realistically, with several LPs, the defaulting LP would generate a pool token deficit that would eventually require some rectification outside of the standard v2 LP add-remove logic.
One can solve for the price changes needed to run out of ETH and USDC for various leverage levels. Here, I define leverage as the amount of v2 capital needed compared to this levered approach. For example, if Bob put 1 ETH and 3000 USDC into a standard v2 amm, an LP levered 2 times would put down half of that; an LP levered 5 times would put down 0.2 ETH and 600 USDC. The difference between insolvency and running out of a token are significant, at least doubling the price movement.1
A just-defaulted LP, one with a slightly negative net balance in either token, will still have significant total value. This provides a liquidator with more than enough capital to incent him to discipline these accounts. Consider the case above where the LP is levered 5 times. If the price fell 36% to $1900, the LP's value is positive at $4275, but they have a negative net USDC balance of -$63. This is a defaulted LP, and his liquidity needs to be removed from the pool (even though solvent).
Price Down Default Scenario
To rectify this situation, the liquidator must put 63 USDC into the pool to get his reward. The liquidator would be paid 0.033 ETH to cover his 63 USDC expenditure (0.033 ETH = 63/1900), bringing the position out of deficit, and get a fee of 0.05 ETH as a reward (could be pro-rata, 0.04 ETH, etc.). The defaulting account had 2.28 ETH at default. If the defaulting LP were sleeping during his liquidation when he awoke, he would find he no longer has an active LP position but has 2.200 ETH (2.283 – 0.033 – 0.05).
Alternatively, one could have a mechanism so that a liquidator needs zero ETH or USDC. In a single transaction, the defaulter's surplus token is first swapped to rectify the token deficit. The remaining positive token amount subtracts a fee given to the liquidator, leaving the final amount for the LP owner to retrieve. The LP position—its liquidity—is removed at liquidation.
Competition among liquidators to get the fee would ensure defaulting LPs are liquidated expeditiously because the first liquidator gets the reward. If liquidation happens soon after a negative token balance appears, the amount of capital liquidators need or the price impact from a liquidation would be trivial. This can be easily automated and requires only looking at the AMM state variables, not any centralized exchange price feeds.
Clean and Extensible
This approach is much cleaner than the v3 approach if you like gas efficiency and dislike piecewise linear liquidity curves and looping through price impact functions. Cheap gas on many chains has diminished the importance of a contract's gas efficiency, but efficiency has many other benefits besides its direct costs. Contract complexity makes it more difficult to audit, and more importantly, it makes audits less definitive.
The extension to margin trading, perps, is potentially the most valuable aspect of this approach to LP capital efficiency. Using a similar margin treatment, a swapper could generate a long ETH position with only 50% of its value in USDC or a short 2.0 ETH position with only 1.0 ETH deposited. In this case, the default trigger would be a traditional maintenance margin of something like 20% of the asset's gross position (5x leverage). The key is that with margin accounting and a liquidation mechanism, margined LPs lead seamlessly to margin trading.