Skip to main content

createDepositInstruction

Builds a raw instruction that deposits SY into the selected tranche and mints Senior or Junior LP shares.

Usage

import {
  TrancheSide,
  createDepositInstruction,
} from "@exponent-labs/exponent-sdk/client/tranching";

const ix = createDepositInstruction(
  {
    user: wallet.publicKey,
    market: marketAddress,
    returnModelStorage,
    addressLookupTable,
    syProgram,
    syMint,
    tokenSrc: userSyTokenAccount,
    tokenSyEscrow,
    tokenLpDst: userLpTokenAccount,
    mintLp: mintLpSenior,
    tokenProgram,
    eventAuthority,
    program: tranchingProgram,
  },
  {
    trancheSide: TrancheSide.Senior,
    amountIn: 1_000_000_000n, // raw SY units
    minLpOut: 0n,             // raw Senior LP units
  }
);

Accounts

NameTypeSignerWritableDescription
userPublicKeyYesYesDepositor
marketPublicKeyNoYesTranching market account
returnModelStoragePublicKeyNoYesReturn model storage account
addressLookupTablePublicKeyNoNoMarket address lookup table
syProgramPublicKeyNoNoLinked SY program
syMintPublicKeyNoYesSY mint
tokenSrcPublicKeyNoYesUser SY source account
tokenSyEscrowPublicKeyNoYesMarket SY escrow
tokenLpDstPublicKeyNoYesDestination LP token account
mintLpPublicKeyNoYesSenior or Junior LP mint
tokenProgramPublicKeyNoNoSPL Token program
eventAuthorityPublicKeyNoNoEvent authority PDA
programPublicKeyNoNoExponent Tranching program

Args

NameTypeDescription
trancheSideTrancheSideSenior or Junior
amountInu64SY amount to deposit, in raw SY token units
minLpOutu64Minimum selected-tranche LP shares to mint, in raw LP units

Remaining accounts

Append the market’s getSyState and depositSy CPI remaining accounts after the generated keys.

Returns

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