Check Position & NAV
How to read your ksUSD balance, the current share price, and the total value of what the vault holds (its NAV).
Your balance never changes on its own. What changes is the share price, so the same balance is worth more over time.
Your position
import { PublicKey } from "@solana/web3.js";
import { getAccount, getAssociatedTokenAddressSync } from "@solana/spl-token";
const [vaultPda] = PublicKey.findProgramAddressSync(
[Buffer.from("vault")],
PROGRAM_ID
);
const vault = await program.account.vault.fetch(vaultPda);
const userKsusdAta = getAssociatedTokenAddressSync(vault.ksusdMint, user.publicKey);
const ksusdAccount = await getAccount(connection, userKsusdAta);
const shares = BigInt(ksusdAccount.amount.toString());
console.log("Your ksUSD:", Number(shares) / 1e6); // 6 decimalsCurrent share price
The price is stored as dollars × 1e9, so 1_030_000_000 is $1.03. Everything above is one division — the dollars the vault holds for shareholders, divided by the ksUSD outstanding. See NAV & share pricing for why three items come out of NAV before that division.
The share price starts at 1.000000 and rises as carry accrues. It only goes down in a drawdown.
Performance fees apply only to new gains above the highest price the vault has previously reached, tracked as hwm_share_price_1e9. So recovering from a dip is free.
Your USDC-equivalent value
Your balance times the price — the same arithmetic withdraw_instant runs:
Vault-level NAV
cached_nav_usdc refreshes on every deposit, withdrawal, and fee collection, and whenever someone runs settle or attest_nav. In between it holds the last recorded snapshot, so any profit or loss sitting open on the perp venue shows up at the next refresh rather than in real time.
Pending queued withdrawal (if any)
The request account closes once process_withdrawal runs, and its rent deposit comes back to you.
Related
Account structure — full
VaultandWithdrawalRequestlayoutsEvents — programmatic subscription to NAV-changing events
Last updated