📖Tutorial

  • Deploy Vault: called on the TCVFactory this deploys a fresh vault instance (sets initial vault params).

const tx = await TCVFactory.deployVault(
        {
            feeTiers: feeTiers, // [500]
            token0: token0, // USDC token address
            token1: token1, // WETH token address
            owner: userAddr, // your address
            init0: init0, // 1 USDC
            init1: init1, // 0 WETH
            manager: userAddr, // your address
            routers: [], // no swap routers
        },
        true // isBeacon = true (beacon proxy)
);
  • Set Restricted Mint: called on the TCV vault contract by the vault owner this restricts who can call the vault's mint function to a single address (your EOA), rendering the vault "private" (without this, anyone can add liquidity into your vault and mint vault shares). If it is public vault, you do not to do that.

const tx2 = await vaultContract.setRestrictedMint(
    userAddr // your address
);
  • Transfer Tokens: simply transfer USDC and WETH directly to the vault address, ****in any proportion you like, and use the vault's rebalance method to deploy those funds in and out of Uniswap.

  • Set Vault Liquidity Positions: To set liquidity positions only one transaction was performed using the crucially important function and interface rebalance.

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

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,
            },
        ],
        swap: nullSwap, // null swap struct (not swapping)
        minBurn0: 0,
        minBurn1: 0,
        minDeposit0: min0, // minimum deposit token0
        minDeposit1: min1, // minimum deposit token1
});

Last updated