Skip to main content

createStripInstruction

Builds a raw instruction to strip SY tokens into equal amounts of PT (Principal Token) and YT (Yield Token).

Usage

import { createStripInstruction } from "@exponent-labs/exponent-sdk/client/core";
import { PublicKey } from "@solana/web3.js";

const ix = createStripInstruction(
  {
    depositor: wallet.publicKey,
    authority: vaultAuthority,
    vault: vaultAddress,
    sySrc: userSyTokenAccount,
    escrowSy: vaultEscrowSy,
    ytDst: userYtTokenAccount,
    ptDst: userPtTokenAccount,
    mintYt: ytMint,
    mintPt: ptMint,
    tokenProgram: TOKEN_PROGRAM_ID,
    addressLookupTable: vaultLookupTable,
    syProgram: syProgramId,
    yieldPosition: vaultYieldPosition,
    eventAuthority: eventAuthorityPda,
    program: EXPONENT_CORE_PROGRAM_ID,
  },
  {
    amount: BigInt(1_000_000),
  }
);

Accounts

NameTypeSignerWritableDescription
depositorPublicKeyYesYesThe user stripping SY
authorityPublicKeyNoYesVault authority PDA
vaultPublicKeyNoYesVault account
sySrcPublicKeyNoYesSource SY token account
escrowSyPublicKeyNoYesVault SY escrow account
ytDstPublicKeyNoYesDestination YT token account
ptDstPublicKeyNoYesDestination PT token account
mintYtPublicKeyNoYesYT mint address
mintPtPublicKeyNoYesPT mint address
tokenProgramPublicKeyNoNoSPL Token program
addressLookupTablePublicKeyNoNoVault address lookup table
syProgramPublicKeyNoNoSY program
yieldPositionPublicKeyNoYesVault robot yield position
eventAuthorityPublicKeyNoNoEvent authority PDA
programPublicKeyNoNoExponent Core program

Args

NameTypeDescription
amountbigintAmount of SY to strip (in base units)

Returns

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