Skip to main content

LP ERC20 Wrapper

Wrapping CLV LP Tokens as ERC-20​

To improve composability with ERC-20-based protocols, CLV LP tokens (ERC-6909) can be wrapped into standard ERC-20 tokens using the Wrapped6909Factory contract.

Factory & Deployment​

The factory contract is deployed at the addresses listed here.

Instantiate the factory in your Solidity code:

// Replace ADDRESS with the deployed Wrapped6909Factory address
Wrapped6909Factory factory = Wrapped6909Factory(ADDRESS);

Wrapping With Initial Deposit​

Wrap an existing CLV vault token into a new ERC-20 token:

(Optionally, you can deposit ERC-6909 tokens)

// Wrap and deposit `amount` of LP tokens
address wrappedTokenWithDeposit = factory.wrap6909(
liquidityVaultAddress, // CLV vault address
poolId, // vault’s pool ID
amount // initial deposit amount of ERC-6909 tokens
);
  • Idempotent: If a wrapper for (liquidityVaultAddress, poolId) already exists, calling wrap6909 again will not revert. The factory simply reuses the existing wrapper contract and processes the deposit.

Interacting with the Wrapped Token​

Once deployed, the wrapped token conforms to ERC-20 and exposes the following helper functions:

// You can get wrapped token's address with this view function
address wrappedToken = factory.getWrapped6909Address(
liquidityVaultAddress,
poolId
);

// Deposit ERC-6909 → mint equivalent ERC-20
IWrapped6909(wrappedToken).depositFor(
recipient, // address to receive wrapped tokens
amount // amount of ERC-6909 tokens to wrap
);

// Withdraw ERC-20 → burn wrapped tokens and redeem ERC-6909
IWrapped6909(wrappedToken).withdrawTo(
recipient, // address to receive original ERC-6909 tokens
amount // amount of wrapped ERC-20 tokens to burn
);
  • depositFor: Transfers amount of ERC-6909 LP tokens from the caller into the wrapper and mints the same amount of ERC-20 tokens to recipient.
  • withdrawTo: Burns amount of ERC-20 tokens from the caller and sends the same amount of original ERC-6909 LP tokens to recipient.

This wrapper enables seamless integration of CLV LP positions with any ERC-20 tooling—DEXes, lending protocols, yield aggregators, and more.

Using with TypeScript SDK (@clober/v2-sdk)​

You can also use the @clober/v2-sdk package to interact with the wrapping system directly from TypeScript environment.

Wrapping LP Token​

import { wrapToERC20 } from '@clober/v2-sdk'

const transaction = await wrapToERC20({
chainId: 421614,
userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
token0: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
token1: '0x0000000000000000000000000000000000000000',
salt: '0x0000000000000000000000000000000000000000000000000000000000000000',
amount: '1.1',
})

Unwrapping LP Token​

import { unwrapFromERC20 } from '@clober/v2-sdk'

const transaction = await unwrapFromERC20({
chainId: 421614,
userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
token0: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
token1: '0x0000000000000000000000000000000000000000',
salt: '0x0000000000000000000000000000000000000000000000000000000000000000',
amount: '1.1',
})

These SDK functions automatically generate the proper transaction object to wrap or unwrap LP tokens through the on-chain factory and wrapper contracts.