Skip to main content

ExponentVault.ixInitializeVault

Creates a new Strategy Vault. This is a static method since the vault doesn’t exist yet at call time. It sets up the vault PDA, mints the initial LP tokens, creates the Squads smart account for policy-gated execution, and registers the vault’s token entries.

Usage

import { ExponentVault } from "@exponent-labs/exponent-sdk";
import { PublicKey, Transaction, sendAndConfirmTransaction } from "@solana/web3.js";

const ix = ExponentVault.ixInitializeVault({
  payer: wallet.publicKey,
  mint: new PublicKey("So11111111111111111111111111111111111111112"), // Underlying mint
  manager: wallet.publicKey,
  seedId: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]), // 8-byte unique seed
  feeTreasury: feeTreasuryAddress,
  feeTreasuryLpBps: 200, // 2% management fee
  tokenEntries: [
    {
      mint: usdcMint,
      priceId: { simple: { id: 0 } },
      tokenSquadsAccount: usdcSquadsAccount,
    },
  ],
  maxLpSupply: 1_000_000_000_000n,
  initialLpAmount: 1_000_000n,
  lpDecimals: 6,
  vaultType: { generic: {} },
  roles: {
    manager: [wallet.publicKey],
    curator: [],
    allocator: [],
    sentinel: [],
  },
  addressLookupTable: lookupTableAddress,
  squadsProgram: squadsV4ProgramId,
  squadsProgramConfig: squadsProgramConfigAddress,
  squadsTreasury: squadsTreasuryAddress,
  squadsSettings: squadsSettingsAddress,
  squadsVault: squadsVaultAddress,
}, env);

const tx = new Transaction().add(ix);
await sendAndConfirmTransaction(connection, tx, [wallet]);

Parameters

NameTypeRequiredDescription
payerPublicKeyYesTransaction payer and initial LP token recipient
mintPublicKeyYesUnderlying mint used for vault-level price validation
managerPublicKeyYesManager of the vault (can differ from payer)
seedIdSeedId (8 bytes)YesUnique 8-byte seed for the vault PDA
feeTreasuryPublicKeyYesFee treasury account that receives management fees
feeTreasuryLpBpsnumberYesManagement fee in basis points
tokenEntriesTokenEntryInput[]YesInitial set of accepted deposit tokens
maxLpSupplybigintYesMaximum LP token supply (deposit cap)
initialLpAmountbigintYesInitial LP tokens to mint
lpDecimalsnumberYesDecimal places for the LP token
vaultTypeVaultTypeYes{ orderbook: {} } or { generic: {} }
rolesVaultRolesYesRole membership lists (manager, curator, allocator, sentinel)
proposalVoteConfigProposalVoteConfigNoGovernance voting configuration
addressLookupTablePublicKeyYesAddress lookup table for the vault
squadsProgramPublicKeyYesSquads v4 program ID
squadsProgramConfigPublicKeyYesSquads program config account
squadsTreasuryPublicKeyYesSquads treasury account
squadsSettingsPublicKeyYesSquads settings account
squadsVaultPublicKeyYesSquads vault account
tokenProgramPublicKeyNoSPL Token program. Defaults to TOKEN_PROGRAM_ID
The second argument is an Environment object that specifies the program ID.

Returns

TransactionInstruction — a single instruction that creates the vault, mints LP tokens, and sets up the Squads smart account.

TokenEntryInput

interface TokenEntryInput {
  mint: PublicKey;
  priceId: PriceId;
  tokenSquadsAccount: PublicKey;
  forceDeallocatePolicyIds?: bigint[];
}

Deriving the Vault Address

After initialization, you can derive the vault PDA from its seed:
const [vaultAddress] = ExponentVault.deriveVaultAddress(seedId);