Vault Creation

This guide walks through creating and initializing a new vault using the Voltr SDK.

circle-info

Prefer the UI? You can create a vault without code at vaults.ranger.finance/createarrow-up-right. See Quick Start (UI).

Setup

Import the required dependencies:

import { BN } from "@coral-xyz/anchor";
import { VaultConfig, VaultParams, VoltrClient } from "@voltr/vault-sdk";
import {
  Connection,
  Keypair,
  PublicKey,
  sendAndConfirmTransaction,
} from "@solana/web3.js";
import fs from "fs";

Step-by-Step Guide

1. Prepare Vault Configuration

const vaultConfig: VaultConfig = {
  maxCap: new BN("18446744073709551615"),         // Uncapped (u64 max) — see warning below
  startAtTs: new BN(0),                           // Activation timestamp (0 = immediate)
  lockedProfitDegradationDuration: new BN(86400), // 24 hours in seconds
  managerPerformanceFee: 1000,                    // 10% in basis points
  adminPerformanceFee: 500,                       // 5% in basis points
  managerManagementFee: 50,                       // 0.5% in basis points
  adminManagementFee: 25,                         // 0.25% in basis points
  redemptionFee: 10,                              // 0.1% in basis points
  issuanceFee: 10,                                // 0.1% in basis points
  withdrawalWaitingPeriod: new BN(0),             // Waiting period in seconds (0 = immediate)
};

const vaultParams: VaultParams = {
  config: vaultConfig,
  name: "My Voltr Vault",                         // Max 32 characters
  description: "Short vault strategy description", // Max 64 characters
};
triangle-exclamation
circle-exclamation

2. Define Required Variables

3. Create Vault Initialization Instruction

4. Send and Confirm the Transaction

Save your vault public key — you'll need it for all subsequent operations.

Account Structure

The vault account contains the following data:

What's Next?

circle-exclamation

Important Considerations

Security Best Practices

  1. Key Management:

    • Keep admin and manager keys separate

    • Use different keypairs for different environments

    • Never commit private keys to version control

  2. Fee Configuration:

    • Management fees: typically 0.25% - 2% (25-200 basis points)

    • Performance fees: typically 5% - 20% (500-2000 basis points)

    • Consider the impact on user returns

  3. Asset Handling:

    • Validate token decimals match between asset and LP tokens

    • Set appropriate maxCap to manage risk

    • Account for minimum deposit requirements

Error Handling

Common error scenarios and solutions:

  1. Initialization Failures:

    • Verify account rent exemption

    • Check authority permissions

    • Ensure description is within 64 characters

  2. Transaction Failures:

    • Monitor for insufficient SOL

    • Handle RPC timeouts

    • Implement proper retry logic

For additional support or questions, refer to the Voltr SDK documentationarrow-up-right or example scriptsarrow-up-right.

Last updated