Deposit

Deposit USDC into the ksUSD vault and receive ksUSD share tokens at the current share price.

New here? Read What is ksUSD? first.


The instruction

deposit(usdc_amount: u64)

In one atomic transaction:

  • Transfers USDC from the user into the vault's USDC ATA

  • Mints ksUSD to the user at the current share price

  • Updates vault NAV accounting

Account
Mutability
Purpose

vault

mut

Vault PDA (seeds: [b"vault"])

vault_usdc_account

mut

Vault's USDC ATA — receives the deposit

ksusd_mint

mut

ksUSD share mint — vault PDA is authority

user_usdc_account

mut

Depositor's USDC source ATA

user_ksusd_account

mut

Depositor's ksUSD destination ATA

user

signer

Depositor

token_program

SPL token program


Share-price math

  • First deposit into an empty vault mints usdc_amount shares 1:1 at $1.00 (initial share_price_1e9 = 1_000_000_000)

  • Every subsequent deposit mints fewer shares as the share price drifts upward with accrued carry


Guardrails

  • Vault must not be paused. Admin can pause via set_pause for emergency response.

  • Deposit cap. New deposits revert if cached_nav_usdc + usdc_amount > deposit_cap_usdc (default: $1M cap on launch).

  • No zero deposits. usdc_amount > 0 required.


TypeScript example


Events

DepositEvent is emitted on success:


Last updated