For the complete documentation index, see llms.txt. This page is also available as Markdown.

Events Reference

The ksUSD vault emits an event for nearly every state-changing instruction. Subscribe via program.addEventListener("EventName", cb) or parse logs from confirmed transactions.

Sources: programs/keystone-finance/src/instructions/*.rs (search for #[event]).

Event
Emitted by
Notable fields

DepositEvent

deposit

user, usdc_amount, shares_minted, share_price_1e9, new_total_shares, timestamp

WithdrawEvent

withdraw_instant

user, shares_burned, usdc_paid, share_price_1e9, new_total_shares, timestamp

WithdrawalRequested

request_withdrawal

user, request_id, shares_burned, usdc_owed, timestamp

WithdrawalProcessed

process_withdrawal

user, request_id, usdc_paid, cranker, timestamp

MarginAdded

add_margin

amount, new posted total, the health ratio that triggered it

PositionOpened

open_position

mode (Normal), usdc_in, jitosol_purchased, perp_base_amount, timestamp

PositionClosed

close_position

usdc_out, realized_pnl_signed, timestamp

OraclesSet

set_oracles

sol_oracle, jitosol_oracle, timestamp

PhoenixEnabled

enable_phoenix

trader, market, canonical_ata, timestamp

LendingEnabled

enable_lending

kamino_lend_reserve, vault_lend_collateral_ata, reserve_lend_collateral_ata, timestamp

IdleLent

lend_idle_usdc

usdc_amount, new_usdc_lent_kamino, timestamp

IdleUnlent

unlend_usdc

collateral_amount, usdc_received, new_usdc_lent_kamino, timestamp

ReserveLent

lend_reserve

usdc_amount, new_reserve_lent_kamino, timestamp

ReserveUnlent

unlend_reserve

collateral_amount, usdc_received, new_reserve_lent_kamino, timestamp

NavAttested

attest_nav

old_nav_usdc, new_nav_usdc, change_bps, last_nav_attest_ts, timestamp

WindDownInitiated

init_wind_down

cached_nav_usdc, total_shares, timestamp

WindDownClaimed

claim_wind_down

user, shares_burned, usdc_paid, timestamp

PauseToggled

set_pause

paused, timestamp

PeakReset

reset_peak

new_peak_share_price_1e9, timestamp

ReservePaidOut

pay_from_reserve

amount_usdc, new_reserve_fund_usdc, new_cached_nav_usdc, timestamp

FeesCollected

collect_fees

perf_fee_usdc, admin_share_usdc, reserve_share_usdc, new_hwm_share_price_1e9, timestamp

DepegAutoPaused

settle

timestamp — emitted when a jitoSOL depeg auto-pauses the vault

ParamsUpdated

update_params

every configurable parameter plus authorized_keeper, max_oi_fraction_bps, max_position_base_lots, timestamp

AdminTransferProposed

transfer_admin

current_admin, pending_admin, timestamp

AdminTransferred

accept_admin

previous_admin, new_admin, timestamp

settle and emergency_close log via msg! rather than #[event]; subscribe to program logs if you need them programmatically.


Subscribing in TypeScript

For historical events, parse transaction logs with EventParser:


Last updated