Introducing the Rebalance CLI: Permissionless, Active Liquidity Management on Uniswap V3

michael j. cohen
xToken
Published in
4 min readJun 20, 2022

With the launch of xToken Terminal, we empowered any project in the space to deploy a Uniswap V3 liquidity mining program in just a few clicks. Instead of dedicating a month of developer time to deploy and configure contracts and build a custom frontend, DeFi and NFT projects can seamlessly bootstrap liquidity on any Uniswap pair, freeing up time and resources. On the supply side, LPs deposit liquidity directly via our platform, which abstracts the technical elements of Uniswap V3 liquidity provision. Once they deposit liquidity, LPs are immediately earning rewards.

For many projects running incentive programs, they simply need to set a Uniswap V3 price range once and may never need to change it. As such, the initial version of Terminal does not allow for projects to reposition the price range on their pools.

For some projects, however, making the most out of Uniswap V3’s powerful functionality requires the ability to reposition liquidity into a new price range as becomes necessary. In the current version of Terminal, this would require the pool creator to deploy a new pool and then ask LPs to manually migrate their liquidity. For many reasons, this is not an optimal solution.

With that in mind, we’re excited to introduce the Rebalance CLI. The CLI will allow pool managers to reposition liquidity into new price ranges, as needed. Participating LPs won’t have to do anything.

Xavier preparing to reposition his Uniswap V3 liquidity

Exploring a CLI Use Case

Over the following few paragraphs, we’re going to highlight what we think is one of the best use cases for the Rebalance CLI: anchored pairs (where one wrapped asset steadily increases in value relative to its base asset). As we put the final touches on the CLI, we recently submitted a proposal on the RocketPool forum laying out what a liquidity incentive program for rETH on Uniswap V3 could look like. We recommended focusing attention on the rETH<>WETH pair.

For the purposes of this example, we’re ignoring the recent issues with staked ETH pegs. Liquidity issues like these will of course factor into liquidity management but for simplicity in this example, we’ll set it aside.

When rETH was launched, it was backed by exactly 1 ETH, so the price was 1 WETH per rETH. At time of writing, the price has increased to 1.0272 WETH per rETH. This relative change has been smooth and predictable as ETH staking returns are roughly known. If the RocketPool team and community were to deploy a concentrated range liquidity program today, they might want to concentrate their liquidity around the price of 1.0272 WETH per rETH.

But, as we know, rETH will continue to gain on WETH. As rETH accrues value, the Uniswap V3 position would become a larger share WETH and a smaller share rETH. At some point, the position would move completely out of range and become 100% WETH. Assuming RocketPool was sponsoring a liquidity mining program, they’d have to ask all of their LPs to manually migrate their liquidity to a new pool with a new range. That’s because, currently, Terminal doesn’t support rebalances.

That will be changing soon. We’re in the final stages of development on the Rebalance CLI, which we will begin offering to pool managers soon. The CLI will allow projects to actively reposition liquidity into a new price range, on behalf of all LPs in the pool.

To protect LPs, we’ve implemented a number of safeguards on our contract’s rebalance functions. First, the NAV of the pool post-rebalance must be at least 99% of the NAV pre-rebalance, as calculated via Uniswap V3 TWAP oracle. Additionally, pool managers will only be able to rebalance once every 24 hours so as to avoid value churn.

In order to offer this feature safely, only whitelisted pools will have access to it. We need to ensure that 1) there is sufficient internal liquidity to use on-chain oracles as a safeguard and 2) there is sufficient external liquidity for the pool to rebalance against.

Note that we are absolutely not using oracles for on-chain valuation on deposit and withdraw of liquidity. We’re only using the Uniswap oracles as an added security measure for rebalances.

Wrapping Up

We’re getting close to the CLI launch! Be in touch in Discord if you feel like your pool is a good fit for our approach. We’re happy to answer any questions.

While we expect projects that are running incentive programs to be the first customers of the CLI, the new tool works for anyone trying to manage Uniswap V3 liquidity on a liquid pair. Reward programs are not necessary.

In fact, we’re looking for sophisticated liquidity managers to participate in the Polygon LM competition via our platform — powered by the Rebalance CLI. We’re still working out details but please join us in Discord in the #terminal-general channel if you’re interested.

--

--