Time-vesting with the Uniswap v3 staker
September 19th, 2022

While Uniswap v2 was prime farming land in the summer of 2020, incentivizing liquidity on Uniswap v3 has not yet taken off. In this article we will attempt to explain why that is the case and propose a solution.

Incentivizing liquidity on Uniswap v3 is indeed possible and currently happening at very modest scales. You can see the currently running programs on Revert and stake any position in the incentivized pools. The contract in use for this purpose is the canonical Uniswap v3 Staker, which was launched in October 2021 and was used to great expectation by Ribbon in a short lived incentive program.

It is undeniable that the Ribbon program did successfully incentivize liquidity, as the chart in the tweet shows. The liquidity was, however, quite skewed towards the active tick. The dominating strategy, pictured below, consisted of:

  1. Depositing liquidity into the minimum possible range.

  2. Exiting the position when it went out of range.

  3. Selling the received rewards.

  4. Swapping into a new minimum range position around the current price.

onetickdao.eth: 1,820,733 RBN claimed. 98% of positions at min range.
onetickdao.eth: 1,820,733 RBN claimed. 98% of positions at min range.

The program ended with 77% of the rewards going to just 14 accounts, all using this same strategy. It seems fair to say that the Ribbon community was not happy. We wrote about it at the time here.

We believe that the current staker design, while undoubtedly successful at attracting liquidity, might do so with effects that are not always aligned with other goals the program creators might have, like maintaining a significant fraction of the liquidity in the pool after the incentive programs finish, distributing the rewards among a wide set of token holders, and attracting liquidity that is more widely distributed along the possible price range. The constant sell pressure created by the ultra-concentrated liquidity players was an additional point of concern with the Ribbon community. The problem has been previously discussed in the Uniswap forum.

Some weeks ago the Polygon DeFi team reached out to us, aware of the issues with the staker, and looking for an alternative solution to incentivize liquidity via individual LPs instead of liquidity managers or automated strategy operators, which seemed like a worthwhile challenge so we got to work.

An idea that had been suggested previously by Gui Lambert and others is to add a minimum range for positions to be allowed to stake. Incentive program creators could set this parameter to a certain number of ticks and with this prevent ultra-concentrated positions from even participating in the incentives programs.

Another alternative, likely first suggested by Moody Salem in the v3 staker github, consists of time-vesting the rewards for the running incentive programs. They could be vested just over a few days, which would have been enough to prevent the 1-tick strategy in the RBN pool as these positions were usually out of range a few times per day. The vesting period could also be set for the full length of the incentives program, which should incentivize even wider liquidity across the price range.

We also liked this idea in that it does not set an all-or-nothing cutoff by range, nor by timeframe. As the diagrams below shows, rewards can be vested linearly, while the position is in range, from the block it was staked until the vesting period is complete, or the position is unstaked.

To better illustrate the concept let’s plot two positions that stake on an incentives program that lasts 10 time steps, and has a vesting period of 6 time steps.

A position's rewards vest while the price is within it's rage.
A position's rewards vest while the price is within it's rage.
A too narrow-range position would be forced to exit with only a small fraction of their accrued rewards having been vested
A too narrow-range position would be forced to exit with only a small fraction of their accrued rewards having been vested

While the incentive rewards accrue proportional to liquidity, in the same way that trading fees do, the vested fraction increases linearly while the position is in range, which serves as a disincentive to positions that would stay in range for only small portions of the vesting period.

We did a lil fork of the v3 staker implementing this idea which hopefully can be merged upstream. The most relevant section is perhaps the changes to RewardMath.sol’s computeRewardAmount function where we use the pool’s current secondsInside for the staked position’s range, as well as the at the time the position was staked, to compute the portion of the staking period the position has kept in-range.

forked CompouteRewardAmount
forked CompouteRewardAmount

The forked contract has gone through an audit process with PeckShield, which was generously sponsored by Polygon, and covered under the grant programme for building on top of Uniswap v3, of which this project is the first recipient. It has been deployed to the Polygon network and we are finishing up an open source UI for LPs stake/unstake positions and for DAOs to create incentives programs very easily.

We believe this new staker will provide DAOs, or any organization, a new way to incentivize liquidity on Uniswap v3, while allowing the rewards to be distributed more widely to LPing asset holders instead of to only a few automated strategy operators.

Our mission is to build powerful tools for LPs in AMM protocols while keeping them open and accessible by everyone. You can support us here.

Subscribe to Revert
Receive new entries directly to your inbox.
View collectors
This entry has been permanently stored on-chain and signed by its creator.