Cointime

Download App
iOS & Android

Uniswap V4 hook: LVR-minimization with Per-block conversion vs. Futures contracts

From ethresear.ch by sm-stack 3 & chris 2.Many thanks to Sang Kim 7 & WonJ 4 & Brynn 6 & Sangwon Moon 4 for discussions and reviews!.This research was inspired by the research “LVR-minimization in Uniswap V4” by @The-CTra1n, and the opinions expressed in this article are our own and not affiliated with the original author.

We conducted various simulations based on the research “LVR-minimization in Uniswap V4 2” and the paper 1 which utilizes Diamond Protocol to address LVR, and found that implementing LVR minimization through “Per-block conversion vs. Futures contract” rather than “Low Impact Re-add”, the solution presented in the paper, is more profitable in terms of profitability and slippage. In this research, we will describe the “Per-block conversion vs. Futures contracts” solution, share and analyze the simulation results, discuss what needs to be considered further, and finally describe the pseudo code for this solution.

High Level Overview: Diamond protocol

The Diamond Protocol refers to a liquidity pool that requires arbitrageur to pledge collateral to arbitrage against that liquidity pool, and reduces LVR, the liquidity provider’s loss, by sharing a portion of the arbitrage profits with the pool. This type of liquidity pool can be implemented using the Uniswap V4 Hook. Uniswap V4 Hooks run inside the initialize , swap , modifyPosition donate functions inside the PoolManager contract and allow you to execute specific logic before and after each action. Since LVR-minimization occurs when an arbitrageur makes a trade to gain arbitrage profits on the AMM, the main logic is executed in beforeSwap and afterSwap.

Before explaining the detailed logic, let’s see how it is implemented at a high level. The first swap opportunity in a given block is given to the arbitrageur who pledged collateral. Arbitrage beyond the value of the collateral pledged to the liquidity pool is not allowed, in order to maintain the price of the tokens in the liquidity pool, which is set by the first swap, even after subsequent swaps.

The first swap in a block gives arbitrageur an exclusive arbitrage opportunity, and the liquidity pool’s token price is arbitraged to equal the market price. (The pool’s token price remains at the market price until the end of the block.) At that point, arbitrageur will distribute a portion of the arbitrage profits to the pool, and the free tokens generated to bring the pool’s token price to the market price will be placed in the Vault. The second swap in a given block will be executed by the general public, and any change in the pool’s token price due to the swap will be matched using collateral held by arbitrageur.

Diamond-protocol-logic1718×908 124 KB

According to the above logic, as the block progresses, the vault will continue to accumulate tokens and the liquidity pool itself will become increasingly scarce. Therefore, unless you change the price of the liquidity pool’s tokens, you need to redistribute the vault’s tokens to the liquidity pool. Depending on the logic of this process, the return and slippage impact of the liquidity pool will vary. “LVR-mimization in Uniswap V4” simulated and proposed pseudo code using the Low Impact Re-adding method. In simple terms, this method moves a certain percentage(1 - 5%) of the tokens in the vault to the liquidity pool for the first swap of every block. We use a different method, Per-block Conversion vs. Futures Contracts, presented in the paper “An Automated Market Maker Minimizing Loss-Versus-Rebalancing”. The idea is to borrow tokens from arbitrageur using futures contracts, and then move as much of the tokens in the vault as possible into the liquidity pool.

Existing Solutions: Periodic Conversion, Low Impact Re-adding

Before we talk about the method we used, let’s briefly explain the Periodic Conversion and Low Impact Re-adding method.

The first is the Periodic Conversion method. The Periodic Conversion method was presented in the paper “An Automated Market Maker Minimizing Loss-Versus-Rebalancing” along with the Per-block Conversion vs. Futures Contracts method, where every τ block, η worth of tokens, equal to half of the tokens in the vault, are auctioned to all users in the system, and the winner of the auction swaps the tokens in the vault into a liquidity pool.

The second is the Low Impact Re-adding method presented in the “LVR Minimization in Uniswap V4” research, as described above, involves putting a certain percentage of the tokens in the vault directly into the pool without any conversion process. The percentage of tokens that go back into the pool in this case is called the Vault Re-deposit Ratio, and prior research(“An Automated Market Maker Minimizing Loss-Versus-Rebalancing”) has shown that a ratio of 1-5% is optimal.

We’ll get a little more specific about the approach we used below.

The Solution: Per-block conversion vs. Futures contracts methodolgy of retained LVR into the liquidity pool

As mentioned earlier, there will be free tokens in the vault after arbitrageur executes an arbitrage trade. If we immediately put all the free tokens back into the liquidity pool, the price of the tokens in the liquidity pool will not match the market price. Therefore, at the market price pc, arbitrageur will swap half of the tokens in the vault and put all the tokens into the liquidity pool to match the market price to token ratio. Since this is a risky situation for arbitrageur to simply swap tokens at the market price pc, arbitrageur creates a futures contract to sell half of the swapped tokens at the same price. This has the same effect as if arbitrageur were lending tokens to the pool.

These futures contracts are executed every τ blocks, at which point the pool either loses or gains. If the pool price after τ blocks is pT and arbitrageur sends (sx,sy) to the liquidity pool by executing a futures contract, the pool’s PnL will be:

PnL=sx+sy∗pT

Let’s look at an example to illustrate.

If the vault currently contains 10X tokens and the token price is X = 10Y, arbitrageur will exchange 5X tokens for 50Y tokens and create a futures contract to sell the resulting 5X tokens at 50Y. It then re-adds all the tokens in the vault directly to the liquidity pool.

And let’s say the token price at the time of the auction for the futures contract, which is “every τ block,” is X = 20Y. People will flock to the futures contract because it’s an opportunity to buy token X at a lower price, and the futures contract will be filled. The arbitrageur that created the original futures contract will then give 5X to the winning bidder and receive 50Y, and the liquidity pool will receive the difference, 50Y.

Conversely, suppose the price of the token drops to X = 5Y. Then the liquidity pool has to step in because no one will participate in the auction to buy the futures contract, or rather, the liquidity pool will have to sell the futures contract to the auction participants with additional tokens on top of it. In this case, we will receive a negative bid like the one below.

Person 1Person 2Person 3
Bid-26Y-27Y-25Y

If Person 1 wins the auction, Person 1 will arbitrage a total gain of 1Y, since 5X = 25Y at the current external market price. However, in the example in the table above, Person 3 wins because he has the lowest absolute value bid.

The detailed algorithm can be found in the pseudo code provided at the bottom of this post.

Simulation Result (HODL / Periodic Conversion / Low Impact Re-adding / Per-block Conversion vs. Futures Contracts)

All simulation code can be found here 1.

sim-result-13200×2400 229 KB

In the graph above, the y-axis represents the return and the x-axis is the final price, with greater price volatility at the two extremes, and higher returns for Per-block Conversion vs. Futures Contracts than Periodic Conversion. This is because Per-block Conversion vs. Futures Contracts empties the vault every block, whereas Periodic Conversion empties the vault every τ blocks, so it is less exposed to price changes, resulting in a larger LVR.

Next, let’s compare the simulation results of the Low Impact Re-adding and Per-block Conversion vs. Futures Contracts approaches.

sim-result-2823×608 42.7 KB

You can see that Low Impact Re-adding is more profitable when the price continues to rise or fall, and Per-block Conversions vs. Futures Contracts is more profitable when the price is moving sideways based on the market price. In the event of successive price increases or decreases, the Low Impact Re-adding method will only move a fraction of the tokens into the liquidity pool, resulting in a continuous accumulation of one type of token in the vault. If you HODL your tokens without placing them in a liquidity pool, the higher the final price, the higher the return. We can speculate that the tokens in the vault are more profitable because they are not used for swaps and have a similar effect to HODLs that are just held.

Finally, let’s compare the slippage of Low Impact Re-adding and Per-block Conversion vs. Futures Contracts, where the graph is a token1 → token0 swap(price is token0/token1).

sim-result-3776×590 32.8 KB

You can see that slippage is significantly better with Per-block Conversion vs. Futures Contracts in situations with large price changes. Slippage is the difference between the theoretical number of tokens a user wants to swap and the actual number of tokens swapped; the more liquid the liquidity pool, the less slippage. Since Per-block Conversion vs. Futures Contracts puts all the tokens in the vault into the liquidity pool every block, it produces better results in terms of slippage than Low Impact Re-add, which only puts a certain percentage of tokens back into the liquidity pool every block.

Trade-off between “Conversion Frequency τ ” and “Cost and Quality of auction”

The simulation results based on the Conversion Freqeuncy τ, a constant that can be adjusted in Per-block Conversion vs. Futures Contracts, are as follows.

sim-result-4

sim-result-5

(From left to right, Conversion Frequency = 5, 10, 20)

In conclusion, we can see that the more frequently you hold auctions, the more profitable they are. We can see that this result is achieved because the shorter the auction cycle, the less exposed the token is to price volatility. One question might arise here. "Shouldn’t I just open an auction every block?”

However, opening an auction every block may reduce participation in the auction and result in contracts being settled at a price that is somewhat off the market price. The liquidity pool loses money and LPs lose revenue. In other words, there is a tradeoff between auction frequency and minimizing the impact of price volatility. This tradeoff is characterized by the importance of setting the appropriate duration of the auction by referring to several existing auctions.

For CoWSwap auctions, they use an auction matching system called Autopilot to manage the auction. This system does not specify the frequency of auctions, but rather determines the frequency of auctions based on the participation of bidders in the auction. This ensures the profitability of the protocol and the user experience. As you can see, auction matching systems are a very important area and there is a lot of prior research in this area.

We are currently implementing a Uniswap V4 Diamond Hook that implements Per-block Conversion vs. Futures Contracts based on the pseudo code below. We always welcome comments related to our work.

Pseudo code

pseudo-1

pseudo-3

Comments

All Comments

Recommended for you

  • ETH Trading Volume on Hyperliquid Exceeds BTC, Reaching Approximately $1.1 Billion in 24 Hours

    On October 11, the trading volume of ETH on the Hyperliquid platform reached approximately $1.1 billion in the last 24 hours, surpassing BTC's $805 million. Market analysts believe that the increase in ETH trading volume is related to suspected exploitation of the PaperTrade mechanism. Earlier today, reports indicated that PaperTrade was allegedly manipulated by two addresses, revealing a significant vulnerability in the protocol: the two wallet addresses executed trades on Hyperliquid with a single transaction size of about $20 million, causing ETH prices to fluctuate by approximately 10 to 20 basis points, and establishing long positions with a notional value of several hundred million dollars on PaperTrade.

  • Ledger Confirms Unauthorized Hardware Implant in Devices, Losses May Exceed $86 Million

    On October 11, Cointelegraph reported that hardware wallet manufacturer Ledger confirmed the presence of unauthorized hardware implants in the devices of an affected user. The incident involves losses related to devices purchased from its Southeast Asian distributor, CryptoBilis. Investigator Specter estimates that the losses may exceed $86 million, involving Bitcoin, Ethereum, and Tron. Ledger stated that it is in contact with the affected users; CryptoBilis has confirmed the suspension of all hardware wallet inventory sales until the investigation is complete. Ledger claims that the incident appears to be limited to this single distributor and its market, and that its own infrastructure, systems, and services have not been compromised. The company has not yet confirmed the number of affected customers or the total amount of losses. Ledger advises users who have not initialized their devices to refrain from doing so, while those who have already initialized their devices may consider transferring their assets to a new signer using a new mnemonic.

  • Anthropic Model Automatically Submits False Leads to Philadelphia Police

    On October 11, according to CCTV International News, the AI model 'Claude Haiku 4.5' from Anthropic automatically accessed the Philadelphia Police Department's webpage for unsolved homicide tips in July this year, filling out a form claiming to have 'potential information related to the case' but did not provide a name or contact information. The form was subsequently marked as spam by the police and did not trigger an investigation. Anthropic released a report on October 9 disclosing the incident and notified the Philadelphia police in advance. The police stated they were previously unaware of the situation, deemed it 'unacceptable,' and requested that technology companies take necessary measures to prevent their AI systems from submitting false information to law enforcement.

  • Industrial Fulian: US International Trade Commission Initiates 337 Investigation Against Company and Subsidiary

    On October 11, Industrial Fulian announced that it was informed the US International Trade Commission officially launched a 337 investigation on October 9 local time, regarding patent infringement claims made by Vicor Corporation. Vicor accuses the company and its subsidiary of infringing on a patent for a 'vertical power supply system.' After an internal review, the company stated that the products involved in this investigation are currently in the internal validation and evaluation stage, and this investigation does not have a substantial impact on the company's current production, operations, or performance.

  • CFTC Issues Two Proposals Clarifying Prediction Markets as Derivatives, Excluding Casino Gambling

    On October 11, Cointelegraph reported that the U.S. Commodity Futures Trading Commission (CFTC) has released two proposals to clarify its regulatory authority over prediction markets. The first proposal defines event contracts related to sports, politics, culture, and weather as 'swaps' products under federal law. CFTC Chairman Michael Selig stated that these products fall under the category of commodity derivatives as defined by the Commodity Exchange Act, and are fully within the exclusive jurisdiction of the CFTC. The second proposal establishes boundaries, explicitly stating that traditional casino-style gambling products—including sports betting and casino games—do not fall within the definition of 'swaps' and are not considered derivatives. This move comes in the context of prediction market operators like Kalshi and Polymarket facing joint lawsuits from multiple states, accused of operating illegal gambling businesses; the CFTC is counter-suing and issuing new regulations in an attempt to clarify the regulatory boundaries between federal and state authorities, paving the way for a potential Supreme Court ruling.

  • Houthi Forces Warn Airlines, Staff, and Passengers Again

    On October 11, the Houthi forces in Yemen issued another warning to airlines, staff, and passengers, advising them not to use airports within Saudi Arabia.

  • U.S. Spot Bitcoin ETF On-Chain Holdings Exceed 2 Million BTC

    As of October 11, data from Dune shows that the on-chain total holdings of the U.S. spot Bitcoin ETF have surpassed 2 million BTC, currently reaching approximately 2.013 million BTC, which accounts for 10.02% of the current BTC supply. The value of the on-chain holdings has reached approximately $227.6 billion.

  • Hedge Fund Net Exposure to US Tech Giants Reaches Record High of 22%

    On October 10, according to data from Goldman Sachs and The Kobeissi Letter, investor sentiment towards large tech stocks has reached an all-time high. Hedge fund net exposure to the 'Big Seven' tech giants in the US has risen to 22%, marking a historic peak; this figure has surged by 7 percentage points since July, representing the largest three-month increase in 2023, and surpassing the previous high of 21% set in June 2024 (compared to only 8% during the bear market low in 2022). During the same period, hedge fund net exposure to semiconductor stocks in the US has increased to 12%, slightly below the peak of 14% in June 2026, while this metric was only 2% at the beginning of 2025.

  • Anthropic Reveals Internal Issues: Out-of-Control AI Attempted to Access Multiple Government Websites, Reported to the White House

    Anthropic stated on Friday that its AI agents acted autonomously, attempting to access various federal, state, and local government websites. The company did not disclose which government agencies were involved but confirmed that it has reported these incidents to the White House. In a blog post, Anthropic mentioned that one of its AI models under testing had taken several unauthorized actions, including exploiting a vulnerability on a university website to download data and submitting a form to a government agency that it had been explicitly instructed not to submit. The company noted that it discovered these incidents after beginning a review of the AI's actions in July. Earlier on Friday, the Philadelphia Police Department stated that Anthropic had notified them that its technology had submitted a false homicide tip to the police website.

  • No Flights Departing or Arriving at Riyadh's King Khalid Airport Following Explosion Sounds

    On October 10, according to CCTV International News, witnesses reported that explosion sounds were heard at Terminal 3 of King Khalid International Airport in Riyadh, the capital of Saudi Arabia, this afternoon, leading to the evacuation of personnel from the airport. Flight tracking website 'FlightRadar24' indicates that there are currently no flights departing or arriving at the airport, and some flights heading to Riyadh have been diverted or returned. King Khalid International Airport has issued a traveler advisory, recommending that passengers contact their airlines to confirm flight status before heading to the airport.