Deep Dive Research
17 Oct 2022
Just-in-Time (JIT) Liquidity Provision is a new form of Maximal Extractable Value (MEV) strategy that traders conduct on the latest version of Uniswap v3. This strategy, which implements bots, capitalizes on the update’s newly introduced feature, concentrated liquidity, which allows liquidity providers to supply capital within a specific price range. In theory, the new MEV strategy increases liquidity for traders within their desired trading ranges, minimizing slippage and thus increasing their profits. However, liquidity providers, on the flip side, think otherwise, citing the possibility that JIT Liquidity Provision is actually potential risk for liquidity providers on Uniswap and other DEXs. To further understand this topic, it is crucial to know what Uniswap is, familiarize oneself with the latest updates introduced in its v3 edition, and assess how JIT Liquidity Provision affects both traders and liquidity providers.
Uniswap is an exchange that uses the protocol of Ethereum for swapping cryptocurrency tokens on the Ethereum blockchain through smart contracts. Uniswap was created to work as a tool for the public to swap tokens without incurring any platform fees. Unlike most exchange platforms that match buyers and sellers to determine the prices of and execute trades, Uniwap applies a simple mathematical equation and a handful of token pools to handle the pricing and execution of trades.
Prior to a discussion of Uniswap v3 and its feature in question, concentrated liquidity, one will need to understand the history of Uniswap and the evolution of its feature set.
On November 2, 2018, Uniswap was first released on the Ethereum main net as a DEX. It implemented an Automated Market Maker (AMM) protocol to price assets. In traditional order book exchanges, trades require both a buyer and a seller, or a counterparty, to take place. This is due to the fact that assets require both supply and demand, so traders themselves work through a centralized exchange in order to approve and conduct trades. Decentralized exchanges like Uniswap, on the other hand, strive to eliminate the need for big banks and minimize the fees they charge, in order to conduct fair, equitable trades between peers.
Uniswap v1 marked the first iteration of this massively popular DeFi tool, and quickly acquired a large audience.
Uniswap v1 was a proof-of-concept that was massively popular for decentralized finance. Its success led the team to establish Uniswap v2, an upgrade of Uniswap v1, which was launched in May 2020. The following sections establish some of the key improvements that Uniswap V2 brought to its users.
In Uniswap v1, traders incurred higher costs and slippage for swapping one ERC20 token for another. This is due to the fact that Uniswap v1 only supported ETH-ERC20 pairs. Thus, if a trader wished to swap, for example, USDC for DAI, he/she would have to swap USDC for ETH, and then conduct a second swap from ETH to DAI. As a result, this trader would incur, hypothetically, double the fees and a higher possibility of slippage occurring.
Uniswap v2 introduced ERC20-ERC20 liquidity pools (LPs) to resolve this issue. This new solution, dubbed “ETH Bridging”, used wrapped ETH (WETH) in its core contracts instead of native ETH, allowing for seamless swapping. Traders were still able to utilize ETH through helper contracts.
Flash Swaps was another innovative feature that v2 introduced to Uniswap, and it gave traders the ability to withdraw as much of any ERC20 token as they would like without needing to swap for it upfront with another token. Thus, traders could receive ERC20 tokens in their desired amount, reducing the amount of fees they would incur and deferring the need for them to pay for it until later. Traders could choose to pay for the tokens withdrawn or, alternatively, pay for a portion of them and return the remaining withdrawn amount.
Uniswap launched on May 5, 2021, with some new features that focused on maximizing returns for traders and liquidity providers – in particular, minimizing slippage and diminishing downside risks. The following three new features are worthy of note as they pertain to JIT Liquidity Provision:
1. Concentrated liquidity
2. Active Liquidity
3. Range Orders
Through the combined use of these three features, traders became able to use their capital more efficiently, and liquidity providers were better enabled to manage their own risk.
One of Uniswap's breakthroughs was its Concentrated Liquidity feature. In v2, the liquidity provided by users had to be distributed evenly along a price range, (0, ∞). Naturally, however, distributing liquidity over an “infinite” range in practice was highly inefficient, given the fact that most assets are usually swapped within a much narrower price range.
For instance, the Uniswap DAI/USDC pool maintains the majority of its trading volume between the price of $0.99 and $1.01; in Uniswap v2, the pool could thus only use about 0.5% of the liquidity with which it was provided, leaving 99.5% of the remaining capital unused.
Uniswap v3, on the other hand, increases capital efficiency by up to 4000x by enabling LPs to supply liquidity within a predetermined price range where most of the trading occurs. For example, assume there are two USDC-ETH LPs, A and B, and each of them has $10K; assume also that the price of ETH is $1600. A deploys $10,000 across the entire price range, providing 7000 USDC, and 1.875 ETH. B decides to deploy liquidity within a price range of $1500 to $2500, and deposits 900 USDC and 0.5625 ETH, for a combined $1800. In this example, even if A invests significantly more money than B, as long as the price of ETH remains within the predetermined range chosen by B, they will both earn the same amount in fees. In other words, LP B is able to make the same return on his deposit as LP A while only contributing 18% of what LP A had.
This is exactly the optimization benefit that concentrated liquidity offers. Not only does Uniswap v3 provide significantly higher capital efficiency, but it also enables LPs to simulate any programmed market maker or order book by allowing them to dynamically change the price range of their liquidity positions.
This is another new feature of Uniswap v3. With active liquidity, whenever market prices of trading assets change and rise above a specified price range, providers’ liquidity will be effectively removed from the pool and will cease to earn fees, instead shifting over to only the assets in the LP. That liquidity provider will then be able to select whether to wait for the market price to re-enter their price range or to select a new price range to match the current market performance.
This feature enables LPs to provide a single token as liquidity at a specified price range above or below the current market rate. One asset is exchanged for another along a smooth curve as the market price moves into the predetermined range, all while generating swap fees.
Despite all of the revenue-generating abilities that these new features offer, the majority of LPs actually are struggling to improve their ability to provide liquidity in limited price ranges. To understand more about the problem, it is essential to know what Flashbots and MEV are and why it was used by many on-chain market participants.
Just–in–time Liquidity Provision (JIT LP) is another pseudonym for a Maximal Extracable Value (MEV) Strategy. This is a strategy employed originally by bitcoin miners that maximize their revenue by including, excluding, or reordering the transactions in a block. This profit is considered distinct from any block rewards or transaction fees the miner would otherwise receive.
This MEV strategy has shown to be more profitable on decentralized exchanges with concentrated liquidity, such as Uniswap v3. The reason for this is that this strategy deploys bots that deploy liquidity within incredibly narrow price ranges, consuming a significant portion of the trading fees elicited. With the new benefits of increased trade depth around current prices and increased fee production for active liquidity providers, these bots are consuming an even greater proportion of those potential profits.
How this MEV strategy works has to do with the way transactions are ordered within a block by miners. When users make transactions, miners can order transactions any way that they wanted to. The highest-paying transactions usually get ordered by the miners first. Naturally, this creates a proverbial “race to the top,” in which users understand that other users are willing to pay a transaction fee premium in order to get their transactions written onto the block first. Users face a prisoner’s dilemma, in which users must participate in a Priority Gas Auction (PGA), which results in a blockage on the chain and requires higher fees from users since the presence of bots artificially inflates the population of “bidders” who are offering gas prices.
This is where Flashbots comes in handy, Flashbots is an organization that aims to reduce the negative externalities of current MEV (Maximal Extractable Value) mining techniques on liquidity providers and prevent the factual risks MEV could cause to state-rich blockchains like Ethereum. Traders use Flashbots to prevent the problem by proposing a blind-auction relay where MEV bots “bribe” the miners instead of paying higher gas fees. This means the MEV bots deliver liquidity to the related pool after searching the mempool for a substantial pending exchange swap that has yet to reach confirmation. This is how MEV bots (miners) earn a profit, by obtaining a substantial portion of the trading commissions only to remove that liquidity in the same block. And, if the MEV bots add enough liquidity, they can take all the fees in that trade without risking any losses. In this way, MEV bots preclude LPs from the opportunity of profiting from large trades. Moreover, MEV bots allow traders to transfer atomic trades (a bundle of orders) to the Flashbots relay; if during that exchange, the transaction pays the miner enough, the searcher’s specified set of the ordered transaction will be included in the block.
Although JIT liquidity is considered a potential tactic for many users, the strategy still has its advantages and disadvantages that could affect traders and liquidity providers in reality.
In the past, MEV bots, while beneficial to traders, were damaging to liquidity providers by front-running their liquidity provision for traders and snatching the fees they would otherwise earn. Since MEV bots would provide and withdraw their liquidity within a single block, Uniswap attempted to combat this issue by imposing penalties for any liquidity providers that contributed and removed liquidity in the same block.
However, the new JIT Liquidity Provision strategy, which also deploys bots that provide and withdraw liquidity within a single block, has actually shown to have a large positive effect on traders, helping them to minimize slippage and increase liquidity.
Most interestingly, according to Robert Miller, the Product Manager of Flashbots, liquidity providers have actually been able to remain profitable with traders utilizing JIT liquidity, unlike before. Per Miller, MEV bots are unable to utilize JIT liquidity provision as a strategy for single atomic transactions, as it does pose a certain risk. Thus, liquidity providers are still able to earn a significant portion of fees that result from trades, even with the presence of JIT.
Conversely, according to Greg Vardy, CTO of research symposium Nethermind, most liquidity providers, while still profiting, are earning at a slower rate overall due to MEV bots. As JIT liquidity provision continued to benefit Defi traders, passive liquidity provision becomes more challenging, and fewer traders become inclined to trade on DEXs where they are consistently sandwich-attacked and front-run by other traders capitalizing on MEV bots; in turn, liquidity providers would receive even fewer fees from the liquidity they provide.
According to Xin Wan & Austin Adams from Uniswap, the USD volume of JIT liquidity has not grown much since June 2021. In recent months, the total trading volume against JIT liquidity is under $100M, which is lower than the total trading volume of most months ($200M). Also, JIT has not grown significantly over the past 6 months, comprising a more slowly increasing proportion of the total USD trading volume on Uniswap.
According to their findings, JIT liquidity provisioning is much more concentrated in the top pools, made evident in the pools where, as shown above, blue bars (the % of total historical JIT liquidity supplied) are much greater than the pink bars (the % of total trading volume/liquidity supplied). This pattern does have insightful meanings. The profit of JIT liquidity is only noteworthy if a swap in the pool is large enough, and large trades are often focused on the top pools. Another essential consideration is that pairs in large pools have more liquidity on centralized exchange venues, which facilitates and reduces the cost of the hedging transaction.
To conclude, JIT liquidity does benefit traders to maximize their profits overall, but it does provide negative externalities to liquidity providers since their revenue might get reduced continuously over time. Despite this, as shown above, JIT liquidity is only concentrated in the top pools and the growth rate of JIT liquidity is fairly slow relative to the greater platform; this indicates that JIT liquidity has played a minimal role in damaging LP performance while providing generally positive effects for traders within the Uniswap Protocol.