Skip to main content

createWrapperProvideLiquidityBaseInstruction

Provides liquidity to a CLMM market using base assets with an external PT purchase to reach the optimal ratio. This instruction mints SY from the base asset and buys additional PT from the market to achieve the correct SY/PT balance for the specified tick range, then deposits the liquidity.

Usage

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

const ix = createWrapperProvideLiquidityBaseInstruction({
  depositor: depositorKeypair.publicKey,
  market: new PublicKey("market..."),
  ticks: new PublicKey("ticks..."),
  tokenPtEscrow: new PublicKey("tokenPtEscrow..."),
  tokenSyEscrow: new PublicKey("tokenSyEscrow..."),
  tokenSyDepositor: new PublicKey("tokenSyDepositor..."),
  tokenPtDepositor: new PublicKey("tokenPtDepositor..."),
  tokenFeeTreasurySy: new PublicKey("tokenFeeTreasurySy..."),
  tokenFeeTreasuryPt: new PublicKey("tokenFeeTreasuryPt..."),
  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..."),
  lowerTickKey: 0,
  upperTickKey: 100,
  minLpOut: 900_000n,
  mintSyAccountsUntil: 3,
  externalPtToBuy: 500_000n,
  externalSyConstraint: 600_000n,
});

Accounts

NameTypeSignerWritableDescription
depositorPublicKeyYesYesWallet providing liquidity
marketPublicKeyNoYesThe CLMM market account
ticksPublicKeyNoYesThe market tick array account
tokenPtEscrowPublicKeyNoYesMarket PT escrow account
tokenSyEscrowPublicKeyNoYesMarket SY escrow account
tokenSyDepositorPublicKeyNoYesDepositor’s SY token account
tokenPtDepositorPublicKeyNoYesDepositor’s PT token account
tokenFeeTreasurySyPublicKeyNoYesSY fee treasury account
tokenFeeTreasuryPtPublicKeyNoYesPT fee treasury account
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
lowerTickKeyu32The lower tick boundary for the liquidity position
upperTickKeyu32The upper tick boundary for the liquidity position
minLpOutu64The minimum amount of LP tokens to receive
mintSyAccountsUntilu8The number of CPI remaining accounts used for SY minting
externalPtToBuyu64The amount of additional PT to purchase from the market
externalSyConstraintu64The maximum amount of SY to use for the PT purchase

Returns

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