Skip to main content

createWrapperProvideLiquidityInstruction

Provides liquidity to a CLMM market starting from base assets in a single atomic operation. This instruction mints SY from the base asset, strips the SY into PT and YT via the Exponent core program, deposits the PT as liquidity into the specified tick range, and returns the YT tokens to the depositor.

Usage

import { createWrapperProvideLiquidityInstruction } from "@exponent-labs/exponent-sdk/client/clmm";
import { PublicKey, SystemProgram } from "@solana/web3.js";

const ix = createWrapperProvideLiquidityInstruction({
  depositor: depositorKeypair.publicKey,
  market: new PublicKey("market..."),
  ticks: new PublicKey("ticks..."),
  tokenPtEscrow: new PublicKey("tokenPtEscrow..."),
  tokenYtEscrow: new PublicKey("tokenYtEscrow..."),
  tokenSyEscrow: new PublicKey("tokenSyEscrow..."),
  tokenSyDepositor: new PublicKey("tokenSyDepositor..."),
  tokenYtDepositor: new PublicKey("tokenYtDepositor..."),
  tokenPtDepositor: new PublicKey("tokenPtDepositor..."),
  mintYt: new PublicKey("mintYt..."),
  mintPt: new PublicKey("mintPt..."),
  tokenProgram: new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
  marketAddressLookupTable: new PublicKey("lookupTable..."),
  syProgram: new PublicKey("syProgram..."),
  exponentCoreProgram: new PublicKey("exponentCoreProgram..."),
  lpPosition: new PublicKey("lpPosition..."),
  systemProgram: SystemProgram.programId,
  rent: new PublicKey("SysvarRent111111111111111111111111111111111"),
  eventAuthority: new PublicKey("eventAuthority..."),
  program: new PublicKey("program..."),
  lowerTick: 0,
  upperTick: 100,
  amountBase: 1_000_000n,
  minLpOut: 900_000n,
  mintSyRemAccountsUntil: 3,
  depositYtAccountsUntil: 5,
});

Accounts

NameTypeSignerWritableDescription
depositorPublicKeyYesYesWallet providing liquidity
marketPublicKeyNoYesThe CLMM market account
ticksPublicKeyNoYesThe market tick array account
tokenPtEscrowPublicKeyNoYesMarket PT escrow account
tokenYtEscrowPublicKeyNoYesMarket YT escrow account
tokenSyEscrowPublicKeyNoYesMarket SY escrow account
tokenSyDepositorPublicKeyNoYesDepositor’s SY token account
tokenYtDepositorPublicKeyNoYesDepositor’s YT token account
tokenPtDepositorPublicKeyNoYesDepositor’s PT token account
mintYtPublicKeyNoNoYT mint address
mintPtPublicKeyNoNoPT mint address
tokenProgramPublicKeyNoNoSPL Token program
marketAddressLookupTablePublicKeyNoNoMarket address lookup table
syProgramPublicKeyNoNoSY program
exponentCoreProgramPublicKeyNoNoExponent core program
lpPositionPublicKeyNoYesLP position account
systemProgramPublicKeyNoNoSystem program
rentPublicKeyNoNoRent sysvar
eventAuthorityPublicKeyNoNoEvent authority PDA
programPublicKeyNoNoCLMM program ID

Args

NameTypeDescription
lowerTicku32The lower tick boundary key for the liquidity position
upperTicku32The upper tick boundary key for the liquidity position
amountBaseu64The amount of base asset to provide
minLpOutu64The minimum amount of LP tokens to receive
mintSyRemAccountsUntilu8The number of CPI remaining accounts used for SY minting
depositYtAccountsUntilu8The number of CPI remaining accounts used for YT deposit

Returns

TransactionInstruction — a transaction instruction ready to be added to a transaction.