Fundamentals of Uniswap
Introduction to the Uniswap Protocol
Uniswap v1 emerged in November 2018, marking a pioneering step for automated market makers (AMMs) - a revolutionary type of exchange that enables anyone to contribute assets into collective market-making tactics. In May 2020, Uniswap v2 was unveiled, bringing with it innovative features and enhancements that spurred a rapid increase in AMM adoption. Within less than a year of its launch, v2 processed over $135 billion in trading volume, establishing itself as one of the world's foremost cryptocurrency spot exchanges. Uniswap has become indispensable infrastructure within the decentralized finance sphere, granting developers, traders, and liquidity providers a secure, efficient platform for engaging in financial transactions.
We're thrilled to introduce Uniswap v3. This latest version is slated for an L1 Ethereum mainnet release on May 5, with plans for an L2 rollout on Optimism to follow promptly.
Uniswap v3 introduces several groundbreaking features:
Concentrated Liquidity: This feature offers liquidity providers (LPs) precise control over the price ranges in which their capital is employed. Individual positions are amalgamated into a single pool, creating a unified curve for trading.
Multiple Fee Tiers: These allow LPs to receive compensation that reflects the level of risk they undertake.
The innovations embedded in Uniswap v3 position it as the most adaptable and effective AMM to date:
LPs can achieve liquidity provision with up to 4000x more capital efficiency compared to Uniswap v2, leading to higher returns on their investment.
The increased capital efficiency facilitates low-slippage trades, rivaling both centralized exchanges and AMMs focused on stablecoins.
LPs gain the opportunity to enhance their exposure to preferred assets while mitigating potential losses.
By allocating liquidity to price ranges entirely above or below the current market price, LPs can effectively execute a fee-generating limit order that follows a smooth curve, enabling them to transition from one asset to another.
Uniswap's oracles have become significantly more accessible and cost-effective to incorporate. The oracles in v3 are designed to offer time-weighted average prices (TWAPs) instantly for any timeframe up to approximately the last 9 days. This advancement eliminates the necessity for those integrating the system to log historical data points.
Moreover, despite these innovative design enhancements, the transaction costs for v3 swaps on the Ethereum mainnet have been slightly reduced compared to v2. Transactions conducted on the Optimism platform are expected to be even more economical!
Continue reading for further insights into Uniswap v3. For those interested in a more detailed technical analysis, the Uniswap v3 Core whitepaper and the Uniswap v3 Core smart contracts are excellent resources.
Concentrated Liquidity
In Uniswap v2, liquidity is evenly spread along the x*y=k price curve, covering all price points from zero to infinity. This wide distribution means that, for many pools, a significant portion of the liquidity remains unused. For instance, in the v2 DAI/USDC pool, only about 0.50% of the capital is allocated for trades within the $0.99 to $1.01 price range, even though this is where liquidity providers (LPs) would anticipate the highest volume and, by extension, the highest fee earnings.
This setup results in LPs earning fees on just a fraction of their invested capital, which might not fully compensate for the price risk or "impermanent loss" associated with maintaining large holdings in both tokens. Moreover, the dispersal of liquidity across all prices leads to traders experiencing significant slippage.
Uniswap v3 introduces the concept of concentrated liquidity, allowing LPs to focus their capital within specific price ranges of their choosing. This approach lets LPs create personalized price curves that better align with their trading preferences.
LPs have the flexibility to establish multiple concentrated positions within a single pool. For example, an LP in the ETH/DAI pool might allocate $100 to the price range of $1,000-$2,000 and another $50 to the range of $1,500-$1,750. This method enables an LP to mimic the configuration of any automated market maker or traditional order book they prefer.
Trades are executed against the aggregate liquidity of all individual curves without increasing the gas cost per liquidity provider. The fees generated from trades within a specific price range are distributed among LPs in proportion to their liquidity contribution to that range, ensuring a fair share of rewards based on participation.
By opting to concentrate their liquidity, LPs are able to match the depth of liquidity provided in Uniswap v2 for specific price ranges, while significantly reducing the capital they need to put at risk. The capital that is not tied up can be held externally, allocated to other assets, invested elsewhere within the DeFi ecosystem, or even used to bolster exposure within the chosen price range to amplify trading fee earnings. Here's how it works in practice:
Imagine two liquidity providers, Alice and Bob, each looking to supply liquidity in an ETH/DAI pool on Uniswap v3, with both having $1 million to invest. The current price of ETH stands at 1,500 DAI.
Alice opts to spread her capital across the entire price spectrum, as she would in Uniswap v2, leading her to deposit 500,000 DAI and 333.33 ETH (valuing her total investment at $1 million).
Bob, on the other hand, decides to take a more targeted approach by creating a concentrated position between the price range of 1,000 to 2,250 DAI. He allocates 91,751 DAI and 61.17 ETH, which totals around $183,500. This leaves him with $816,500 to manage as he sees fit, whether that's further investment or hedging strategies.
Despite Alice deploying over five times the capital that Bob has, they stand to earn the same in fees, provided the ETH/DAI price fluctuates within Bob's chosen range.
Moreover, Bob's strategy introduces a form of risk management akin to a stop-loss mechanism for his investment. Should the ETH price plummet to $0, Bob faces a loss of just $159,000 compared to Alice's entire $1 million. The remainder of Bob's funds can then be utilized to mitigate any potential downside or to explore other investment avenues.
V3 LPs, thus, have the option to not only match the liquidity depth provided by their v2 counterparts with less capital but also to significantly enhance it with the same amount of capital. This choice does mean accepting a higher degree of price risk, known as "impermanent loss," in exchange for facilitating increased trading volumes and, consequently, higher fee revenue.
In pools perceived as more stable, LPs may opt for even narrower price ranges. For instance, if the approximately $25 million currently in the Uniswap v2 DAI/USDC pool were concentrated between 0.99 and 1.01 in v3, it could provide the same liquidity depth as $5 billion in v2, assuming the price remains within those bounds. Concentrating that $25 million between 0.999 and 1.001 would offer the same depth as $50 billion in v2.
The calculator below demonstrates the potential gains in capital efficiency for a concentrated liquidity position (centered around the current price) as opposed to spreading capital across the full price curve.
Liquidity Deposit Value:
Value of paired tokens: $
Select ETH price range:
Current Price: $1,820
V3 Range Position:
Capital Required: $150,000
Fees per $ vs. V2: 5.24x
V2 Position:
Capital Required: $785,779
These positions are poised to earn equivalent fees and perform the same as long as the price stays between $1,200 and $2,800.
At launch, the maximum capital efficiency gains could reach up to 4,000x for LPs who concentrate their liquidity within a single 0.10% price range. The v3 pool factory has the technical capability to support even more finely tuned ranges, down to 0.02%, potentially achieving up to 20,000x capital efficiency gains relative to v2. However, creating more detailed pools could elevate swap gas costs and may be more strategically viable on Layer 2 solutions.
Active Liquidity
When market prices drift beyond the bounds of an LP's chosen price range, their provided liquidity is essentially withdrawn from the active pool, ceasing to accrue fees. In such scenarios, an LP's capital is entirely converted into the asset that currently holds lesser value, remaining in this state until the market price re-enters the designated price range, or the LP opts to adjust their range to reflect the prevailing market rates.
In the framework of Uniswap v3, there exists the theoretical possibility that a particular price range may momentarily have no liquidity. Nevertheless, it is anticipated that rational LPs will proactively modify their price ranges to ensure they consistently encompass the ongoing market price. This active engagement is crucial for maintaining the effectiveness and profitability of their liquidity provision.
Range Orders: A New Dimension of Trading
Uniswap v3 introduces an innovative feature that expands the toolkit of liquidity providers (LPs) beyond traditional market orders, aptly termed 'range orders'. This feature grants LPs the ability to place capital in a single token within a specified price range, either above or below the current market price. Should the market price shift into their set range, they effectively execute a sale of one asset for another, following a smooth transaction curve and simultaneously earning swap fees.
Depositing assets within a narrowly defined range mimics the dynamics of a conventional limit order. For instance, with the current DAI price below 1.001 USDC, Alice might allocate $10 million in DAI to a range set between 1.001 to 1.002 DAI/USDC.
As soon as the DAI value ascends beyond 1.002 DAI/USDC, Alice's positioned liquidity would be entirely converted to USDC. To secure her USDC or to prevent her assets from reverting back to DAI if the DAI/USDC ratio dips below 1.002, Alice would need to retrieve her liquidity or engage a third-party service to do so on her behalf.
The average execution price for a fully executed range order is calculated as the geometric mean of the set's minimum and maximum prices. In Alice's scenario, the execution rate would be 1.001499 DAI/USDC, totaling $1,001,499. It's important to note that this execution price doesn't reflect the additional swap fees accrued while the prices fluctuated within the 1.001 — 1.002 DAI/USDC range.
Utilizing range orders with broader price intervals can be particularly advantageous for strategies like profit-taking, purchasing during dips, and managing initial token distributions. For the latter, issuers now have the flexibility to place liquidity solely in one asset, delineating the precise price scope at which they aim to distribute their tokens.
Last updated