Set Vault Liquidity Positions

All the pieces are in place and it's finally time to start providing liquidity to Uniswap! To deposit liquidity into Uniswap V3 LP positions initially, run this command:

yarn tutorial1-setPosition --network goerli

Congrats! You just placed your first two DAI/WETH LP positions on two different fee tiers via your ArrakisV2 vault. If the script succeeded, you're ready to move on.

What Does This Script Do?

To set liquidity positions only one transaction was performed using the crucially important function and interface rebalance . It looks like this:

  const rangeA = {
    lowerTick: tickLowerA,
    upperTick: tickUpperA,
    feeTier: feeTiers[0], // e.g. 500

  const rangeB = {
    lowerTick: tickLowerB,
    upperTick: tickUpperB,
    feeTier: feeTiers[1], // e.g. 3000
  const tx = await vault.rebalance(
      burns: [], // not burning any liqudity
      mints: [ // minting liquidity on two ranges
          liquidity: liquidityA, // amount liquidity to add to rangeA
          range: rangeA,
          liquidity: liquidityB, // amount liquidity to add to rangeB
          range: rangeB,
      swap: nullSwap, // null swap struct (not swapping)
      minBurn0: 0,
      minBurn1: 0,
      minDeposit0: min0, // minimum deposit token0
      minDeposit1: min1, // minimum deposit token1

By configuring and funding your private vault in this way you can now wield the rebalance method to actually implement your liquidity provision strategy for the token pair.

In this case we have a dual fee tier strategy where we provide more concentrated 0.05% feeTier liquidity with roughly half of our funds, and less concentrated 0.3% feeTier liquidity with the rest. Both of these ranges are centered around their uniswap pool's current market price (note: on goerli testnet these market prices can sometimes be way off from reality).

Last updated