Withdraw

Burn your ksCORE share tokens to receive tokens proportional to the portfolio's current NAV. No admin approval, no lock-up period.


Supported Tokens

Token
Instruction
How it routes

USDC

withdraw

Direct — no swap

SOL

withdraw_with_swap

USDC → Jupiter swap → SOL

JupSOL

withdraw_with_swap

USDC → Jupiter swap → JupSOL

jitoSOL

withdraw_with_swap

USDC → Jupiter swap → jitoSOL

hSOL

withdraw_with_swap

USDC → Jupiter swap → hSOL

mSOL

withdraw_with_swap

USDC → Jupiter swap → mSOL

bSOL

withdraw_with_swap

USDC → Jupiter swap → bSOL


Quick Start

# Withdraw full position as USDC
npx tsx scripts/withdraw.ts balanced

# Withdraw a specific amount as USDC
npx tsx scripts/withdraw.ts balanced 2500

# Withdraw as SOL or any supported LST
npx tsx scripts/withdraw_with_swap.ts balanced --output SOL
npx tsx scripts/withdraw_with_swap.ts balanced --output JupSOL

How a Withdrawal Routes

Shares are valued at the moment ksCORE is burned — price is locked at call time. Core redeems proportionally from each fund into a USDC staging account. For withdraw_with_swap, the USDC is then swapped to the desired output token via Jupiter.

Internal burn chain (all atomic in one transaction):

You only hold and burn ksCORE. The ksALPHA / ksNEUTRAL / ksDEFENSE shares are held internally by Core and burned on your behalf — you never interact with them directly.

Settlement by fund:

Fund
State
Settlement

Alpha

Idle USDC

Immediate

Alpha

Deployed to Marginfi

Immediate — auto-recalled

Neutral

Idle USDC

Immediate

Neutral

Jupiter Perps position open

Queued ≤5 min — keeper unwinds

Defense

Idle JupSOL / USDC

Immediate

Defense

Crisis deployment

Queued — keeper completes

Most withdrawals are immediate. The queue path only triggers when Neutral has an active Jupiter Perps position and the withdrawal share exceeds idle USDC.


Code Example

See scripts/withdraw.tsarrow-up-right and scripts/withdraw_with_swap.tsarrow-up-right for full account derivation.


Errors

Error
Cause

PortfolioPaused

Portfolio is paused

InsufficientShares

Burn amount exceeds ksCORE balance

ZeroAmount

Amount is zero

InsufficientLiquidity

Fund cannot fulfill withdrawal immediately — will be queued

SwapFailed

Jupiter swap failed — check route

SlippageExceeded

Output below min_token_out — widen slippage or retry


Next: Deposit → · Check Your Position → · Keystone Core Overview →

Last updated