Introducing xAssetCLR: Our Efficient Exchange Framework, Built on Uniswap V3

michael j. cohen
xToken
Published in
5 min readSep 10, 2021

At xToken, we offer a variety of native staking and liquidity provision products. For our native staking products in particular (e.g., xAAVE, xBNT), we often run liquidity incentive programs where we reward users who provide liquidity on an xAsset pool — xAAVE/AAVE/WETH for example.

For most of our products, these incentive programs are more than just promotional. By facilitating secondary liquidity, we’re augmenting the utility of our product offering.

Easy Liquidity

First — continuing with our AAVE example — direct AAVE stakers must wait through a 10 day cooldown period before they’re able to unstake and retrieve their investment. xAAVE itself partially solves for this, as we target a 5% “buffer balance” of unstaked capital to be made available for redemption liquidity. However, sometimes this buffer balance is exhausted and thus no xAAVE redemption liquidity is available.

This happens frequently enough, so we’ve incentivized external liquidity pools to provide investors with easy and instantaneous exit liquidity.

Accessibility

Second, while we strive to make xToken as user-friendly as possible, many investors are already very comfortable with a typical DEX interface. In the same vein, many smart contracts and protocols are already integrated with DEXes and DEX aggregators. Adding another integration is a big ask.

These reasons among others are why we’ve been incentivizing xAsset liquidity pools across a variety of DEXes. Users don’t need to understand our mint and burn UI or worry about buffer balance. All they need to do is swap.

However, up until this point, a major challenge we’ve faced is that these external liquidity pools are quite inefficient, requiring significant liquidity for less than impressive depth. Additionally, we’re limited by the feature sets of the DEXes themselves.

Enter Uniswap V3.

While we were working on our xU3LP product, we realized that we could apply much of the same code and logic to a flexible, efficient exchange framework for our xAssets, or really any other Uni V3 pair we’d like to manage. So we built it and we’re excited to begin launching shortly on a variety of pools.

What is xAssetCLR?

xAssetCLR (“concentrated liquidity range”) is the audited smart contract that we will be using going forward for all xToken-related Uniswap V3 pools. For now, we’ll be using CLR as a vehicle for incentivizing Uni pools. However, over time, CLR may serve as the foundation for an exchange framework that drives value back to the XTK token as a module in our Multi-Staking complex.

xAssetCLR allows us to:

  • set a liquidity price range on a pair for all LPs
  • target a certain asset allocation between each asset in a pool
  • rebalance to a new price range as price or information changes
  • generate an ERC20 for a dynamic Uni V3 LP position

Setting a Uni V3 Price Range

For those who are less familiar with Uniswap, V3 liquidity pools allow you to set a price range within which you’d like to provide liquidity. This is a contrast to Uniswap V2 and most other DEXes, where LPs are required to provide liquidity within the whole range.

The important rule of thumb for Uni V3 is that as you tighten your price range, the more efficient your capital becomes. In other words, you’ll earn more fees on less capital. On the flipside, the tighter your range, the greater your potential for impermanent loss (more on this in the Risks section below).

With xAssetCLR, we have the ability to customize these price ranges as best fits the asset pair.

Targeting an Asset Allocation

One of the reasons we were using Balancer V1 and V2 for many of our pools is that Balancer allows you to set a custom asset allocation. For example, we were incentivizing a 50/25/25 xAAVE/AAVE/ETH Balancer V1 pool for a long time, because we liked the way this allowed investors to swap (in only one hop) into and out of xAAVE from the same input/output assets we support directly on the contract (ETH and AAVE).

Powered by Uniswap V3, we can target our desired composition for xAsset pools by offsetting the price ranges slightly to our needs. For our upcoming xAAVEa/AAVE pool, we’ll be targeting 75% xAAVEa and 25% AAVE. Our CLR pool will hold exactly that asset composition when xAAVEa is trading at its “true” NAV price.

Now, this isn’t a hard target in the sense that you can configure Balancer to always hold 75% of value in one asset. However, our xAsset pairs move predictably in value relative to their base tokens (xAsset = xAAVE; base token = AAVE), so while there may be some short term volatility, we are well-equipped to maintain our target allocations.

On more volatile pairs like XTK-WETH, asset compositions are more likely to oscillate. This higher level of unpredictability is part of the reason why our price ranges will be much wider for this pair than a typical xAsset pool.

Rebalancing to New Ranges

The ability to specify price ranges in Uniswap V3 comes with the challenge of migrating those price ranges when necessary. When depositing liquidity directly to V3, LPs receive an NFT that must be burned in order to mint a new NFT to deposit at a different price range.

Prompting our LPs to burn, migrate and mint semi-frequently would be very poor UX. With xAssetCLR, however, we can migrate on behalf of the whole pool. This is a useful and convenient abstraction for our users and will help make our liquidity program more effective.

Generating an ERC20 for LPs

Just as xU3LP mints a fungible ERC20 token to represent investor holdings, xAssetCLR turns non-fungible Uniswap V3 positions into conventional ERC20 tokens that users can transfer, stake for rewards or use as collateral. Most importantly, as the pool is rebalanced and price ranges change, we do not need to mint a new token. The same token continues to function dynamically.

In the short term, this ERC20 will be most important for our rewards programs, but we see the potential design space as much larger than it would be with an NFT.

Risks

Our xAssetCLR contract has been audited by an external firm and has undergone several internal reviews. We’ve also performed a stress test scenario analysis, given that crypto markets are often highly volatile.

Even considering this, we want to be upfront about potential risks. We are on the cutting edge of a highly experimental industry and there are risks all LPs should consider:

  • smart contract risk: loss of funds due to code vulnerabilities or unintended behavior
  • impermanent loss: given that we are concentrating liquidity, impermanent loss is amplified. We will be rebalancing as needed but in certain market conditions, LPs may be left with 100% of one asset or the other
  • slippage risk: volatile market conditions may necessitate frequent rebalances and rebalances come with fees and slippage that can impact performance

Launch Pools

We’re currently preparing two pools for our initial incentivized CLR launch: XTK/WETH and xAAVEa/AAVE. We’ll have more details shortly!

--

--