Locking Liquidity & Incentives UniswapV4 Hook

Brokkr Finance
5 min readNov 17, 2023

The first hook of our Hook POC Uniswap Foundation grant is the Liquidity Locking Hook. Here we explain our design choices and illustrate the possibilities.

This hook POC enables locking liquidity in the pool, provides additional rewards to those who locked their funds, and enables early withdrawals. It should help pool deployers sustain consistent liquidity levels and let them create advanced features through locking liquidity.

Disclaimer: This article is for protocol builders who understand V3 & V4 mechanisms and are interested in building their own hooks, or using them in their pools. We recommend checking the V4 documentation for a general introduction and exact implementation of v4 and hooks.

⚙️Why Enable Liquidity Locking

For pool deployers, locking liquidity enables sustaining deeper pool depth over longer periods. That makes the pool more stable and reliable, which can attract more volume from traders. And combining it with an incentive program can convince LPs to deposit and lock the liquidity in their pool.

The main reason why liquidity providers might want to lock liquidity is bonus rewards they wouldn’t receive otherwise. The most common ones are increased LP rewards that outweigh the risk of being unable to manage the liquidity. This can be combined with other features like governance or other “VIP” benefits.

The Features Of A Locking Hook Proof of Concept

This hook lets pool deployers reward liquidity providers who lock their liquidity with additional token rewards by minting new ERC20 tokens. It also lets them withdraw the liquidity before the locking period is over for a fee that is distributed among other LPs.

The liquidity is deposited in the hook so it can store user information for additional features like rewards, or governance. It deposits the liquidity in a full range and mimics the V2 pool mechanism without the concentrated liquidity system which reduces the complexity of the POC. Using custom ranges complicates things because V4 lacks the NonFungiblePositonManager which takes care of proper position management and fee accounting in V3 pools.

Locking liquidity

🔒Locking Liquidity

Users can lock the liquidity between 1 to ²⁵⁶ seconds, and after that period passes, they can withdraw all deposited assets. While their liquidity is locked, they receive token rewards on top of the regular Uniswap trading fees based on the amount deposited. Users can withdraw the liquidity early for a preset withdrawal fee, which is distributed among other liquidity providers via the hook’s donate function (can be disabled by the pool deployer).

When the user wants to deposit assets but already has an open position, the new liquidity will be merged with the existing position and the user has a choice to either extend the locking period or keep the original one. Important is, that the new locking period can’t be shorter than the locking period of the original position so it can’t be exploited. Having only one position makes it more gas-efficient than having multiple ones. But there are ways how to handle multiple positions, for example by storing the positions in an array or by combining an LP Management hook with the Liquidity Locking hook. Both options could let the users open multiple positions but would be more complex and gas-intensive.

Locking liquidity in the hook mechanism

An interesting idea might be to force all liquidity in one locking period and a full range. This would mint a standardized LP token which could enable trading on secondary markets.

🏆 Rewards For Locking

Rewards are the main motivation for LPs to lock assets in the pool as they can outweigh the risks involved with locking. In our case, users lock their funds for a selected period, accumulate rewards continuously, and receive them when they withdraw the liquidity.

The rewards are based on the locked amount of funds and scale linearly but the distribution curve can be easily adjusted, and it is also possible to include other factors than just the locked amount. However, the distribution system should be thought out carefully because some may contain hidden risks. For example, in a system with an uncapped maximum locking period and immediate rewards, the user could lock a small number of assets to an “infinite” amount of time and receive the “infinite” reward immediately.

The current implementation requires the hook to be able to mint new ERC20 tokens for the additional rewards as it allows testing indefinitely without having to worry about the rewards supply. This can be modified by depositing additional tokens to the hook or by allowing 3rd party tokens or NFTs as rewards.

🔓 Withdrawals & Penalizing Early Withdrawals

Users can withdraw tokens after the locking period has passed, and they receive their position and all acquired rewards from fees and locking incentives.

They can withdraw the liquidity before the locking period has passed, but they have to pay a fee that gets donated to other liquidity providers. The penalty is set as a fixed percentage of the withdrawn amount but could also decay over time or change based on the withdrawn amount. The gathered penalties could be used as POL or protocol revenue, instead of distributing them among other LPs.

Penalty fee: 10% on withdrawals
Deposit: $1,000
Withdrawal: $500
$ Penalty: $50

The user locked $1,000 but wants to withdraw $500 before the locking period is over so they have to pay a 10% fee on the withdrawn amount. So withdrawing $500 will donate $50 to other LPs and $450 will go to the user.

The liquidity withdrawal process
Core withdrawal

💡 Further use cases

Token rewards are likely the main reason to lock liquidity in the pool, but governance rights, or completely different mechanisms like lending and borrowing are also an option. With hooks, there are countless ways in which locking could be used.

Locking liquidity is just one cool thing you can do. V4 opens up new possibilities for every part of DeFi. This is our first hook, and there are at least 3 more coming! 🟢

Follow Brokkr on:
🌎 BRO Website
🐦 BRO Twitter
🎮 BRO Discord