Uniswap V3's Alchemy

Published on:

May 25, 2021

May 14, 2021

Uniswap’s recent release of Uniswap V3 has caused much excitement in the Ethereum space. The core of Uniswap V3 lies in its customizability. A user can pool liquidity to market-make positions amongst a specific price range instead of being exposed to positions at all prices, and also set custom swap fees for its pool.

The core of Uniswap’s contracts lies in its NonFungiblePositionsManager.sol contract that lives at this contract address. This is the contract that users interact with to deposit and withdraw their liquidity. An NFT that represents that liquidity is then correspondingly minted and burnt. This NFT is a ERC-721 token that has a unique token ID. At time of 15th May, there are around 15,000 Uniswap NFTs that have been minted.

Transactions that provide liquidity in Uniswap V3 call the Multicall function, which bundles multiple transactions at once). If a pool contract is available for that specific pair, the liquidity is directly deposited into the pair. If a pool contract is not available (i.e. the user is the first liquidity provider), a new pool contract is deployed. Here’s an example of such a pool.

In this piece, we examine the nascent rise of Uniswap V3, and its implications for the DeFi landscape as a whole.

Better ways to utilize capital

How are users utilizing Uniswap V3? We can take a look at NFT minting numbers to find out. Every NFT mint is a unique representation of a user’s market orders, and thus his or her view of how the asset pair will perform. Approximately 15,000 NFTs have been minted. The top 8 liquidity pairs by number of NFTs minted take up more than 30% of this number. 

2 types of pools stand out as being the most popular here: volatile asset - stablecoin pair and asset - asset pairs whose prices are highly correlated. Let’s explore why these 2 pair types are so highly utilized in further detail.

Directional Market Making

WETH-stablecoin pairs among liquidity providers are popular because market-making strategies that are directional in nature may be placed.  Here’s an example of how to set buy limit orders for ETH, as quoted from the Uniswap V3 documentation.

“The Current price of a DAI / ETH pool is 1,500 DAI / ETH. You expect that ETH will rebound after it drops to 1,000 at the next market downturn, so you would like to place a range order swapping DAI to ETH at the price of 1,000 DAI / ETH. This is possible, as the price space below the spot price is denominated in the lower-priced asset, DAI. You can provide DAI at the price of 1,000 DAI / ETH, which will be swapped for ETH when the spot price of ETH drops past 1,000 DAI / ETH.”

Sell limit orders are also possible: if one wants to sell out ETH when it hits a certain price range, one simply has to set a range order above 1,500 DAI/ETH, and provide only ETH to the pool.

Low slippage stable-asset trades

Pairs that have high correlation in price movements (WBTC-WETH, USDC-USDT) have always been attractive to liquidity providers because they suffer less from lower Impermanent Loss. 

Traders, however suffer from high slippage on these pairs. As seen on the graph below, as x moves along the Uniswap invariant curve, the price of y fluctuates wildly. This models the x*y=k formula over the entire range of prices, as it is done in Uniswap V2. 

Source: Curve.fi Whitepaper

Recognizing that high slippage trades shouldn’t occur on pairs that were designed to hold highly correlated assets, Curve Finance published its whitepaper proposing a new sort of “stableswap invariant” in 2019 that closely mimics the sort of concentrated liquidity Uniswap V3 now offers (though not in the exact same way).  Curve has since attracted over 9 billion USD worth of deposits, and is doing 500K USD daily volume.

Uniswap V3, in fact, was designed with solving V2’s stable-asset slippage problems in mind. In Uniswap V3, x*y=k is only applied over the range of prices the liquidity provider sets. Liquidity Providers are pooling liquidity around very tight spreads (e.g 0.995-1.005DAI/USDC), as illustrated by the depth chart below.

Source: Uniswap Analytics

Which model wins? If we take the Total Value-Locked over Daily Trading Volume as a proxy for capital efficiency, V3 is running ahead for now. The efficiency of V3’s pools was further acknowledged by the Curve team on twitter.

Bear in mind, however, that pools on Curve have inflated TVL due to incentivized yield rewards, which may account for the lower Volume/TVL ratio on Curve.

Volume/TVL ratio over the past 24 hours. Taken 14th May

Automated Liquidity-Providing strategies 

Like all things on-chain, smart contract programmability introduces a new way for DeFi users to create automated strategies for all sorts of capital markets. Projects building on Uniswap V3 opens a whole new door for DeFi users to access liquidity-provisioning strategies with much higher complexity than before. One of these is charm.fi‘s Alpha Vault, which is already live on mainnet. 

Backtests run for trading fees based on Charm’s Alpha Vault Strategy. Source: Charm Fi

Charm’s strategy is smart and simple. On Uniswap V3, once the market price exceeds this range of prices you set in your liquidity position, you will no longer earning trading fees on your capital. Charm’s Alpha Vault manages assets, on a high level, by moving the price range of your market making orders up and down according to changes in market price. LPs can thus consistently earn trading fees. Because there was a cap on vault deposits, Nansen found only 36 deposits into the contract, with no known funds or projects participating.

V3’s gas efficiency

There is a real demand for applications that optimize for gas costs. Minting an NFT, routing etc. are complex computations that may possibly require higher gas fees to perform. In the past 7 days, Uniswap transactions have spent almost 65,000 Ether in gas fees. Its share of overall gas fees spent on Ethereum has risen steadily and rapidly. Some argued that Uniswap V3’s contracts were clogging up the gas market, with Uniswap taking as much as 50% of the share of gas fees expended by our top 20 gas spending entities.

Let's dig through aggregate data to find out. One would find that providing liquidity on Uniswap V3 does indeed spend a larger amount of ETH in gas per transaction. The difference is significant if you think about how many repeated transactions there are for each new liquidity position (NFT) minted. At peak gas prices on May 11th, a mint on Uniswap V3 cost an average of 0.17 ETH, compared to 0.15 ETH on Uniswap V2. Interestingly, the number of new LP positions in Uniswap V2 has also been steadily decreasing.

Do swaps on Uniswap V3 cost more or less in gas? The debate rages on. Uniswap V3's announcement post wrote:

Even with these groundbreaking design improvements, the gas cost of v3 swaps on Ethereum mainnet is slightly cheaper than v2

Still, many disputed this claim.

We further aggregated data for gas fees spent on Uniswap trades from May 4th onwards. Average gas spent is calculated by taking the total amount paid in gas fees divided by number of swaps made in either V2 or V3. As it appears, Swaps on Uniswap V3 cost marginally higher, paying out an average of 0.037 ETH per transaction on May 13th, compared to 0.027 ETH per transaction on Uniswap V2. That's more than 30USD more expensive per swap. The number of transactions in V2 remain high, while number of transactions on V3 have decreased since 8th of May.

In the past 10 days, swaps on V3 cost, on average, 0.0024 ETH more than swaps on V2, with a standard deviation of 0.03078 ETH. It would be interesting to further compare gas spending data as time goes by.

The Future of Uniswap

Since its launch, Uniswap V3’s has achieved remarkable results, with more benefits to the DeFi ecosystem than one may realize. Lower slippage swaps decrease the possibility of users being sandwich attacked by bots who frontrun or backrun transactions. Capital efficiency is boosted even on simple discretionary strategies -- what more when projects like Visor, xToken, and Method take off?  Uniswap is unique in its stability and sufficiently decentralized manner of governance.

V3 provides a secure "L1 for AMMs" that all other protocols can build on. There are already grants funding research into complex market-making strategies that optimize the return on capital, for specific assets.

Even if one is put off by higher gas fees, Uniswap V3 deserves our attention.

Grow your business.
Today is the day to build the business of your dreams. Share your mission with the world — and blow your customers away.
Start Now