GLAMIDL Reference

Phoenix Integration Staging

Integration adapter for Phoenix. Lets a GLAM vault register trader accounts under GLAM authorization and, after separate delegated activation, deposit or withdraw funds, place or cancel Phoenix orders, move collateral between trader accounts, and sync trader state. This staging deployment exposes additional or pre-release functionality for review.

Accounts owned or controlled

AccountOwner / authorityPurpose
Integration authority PDAPhoenix Integration StagingProgram-derived authority used for integration-level signing during Phoenix CPI calls.
Phoenix trader accountsPhoenixTrader accounts registered to, refreshed for, and priced as GLAM vault-controlled positions.

Integration notes

  • For now, use glam-cli phoenix onboard or client.phoenix.onboardTrader(...) to idempotently run the complete two-phase delegated-onboarding flow for the active vault's default Phoenix 0/0 trader.
  • When the Eternal trader is missing, these helpers first execute the GLAM-wrapped register_trader instruction so GLAM's onchain permission check remains enforceable.
  • register_trader is phase one only; registration does not activate the delegated capabilities required for deposit, withdraw, order, or cancel operations.
  • When needed, delegated activation then uses Phoenix's no-referral build-register-ixs / send-register-ixs flow, including Eternal OnboardTraderDelegated.
  • A fully onboarded trader is an idempotent no-op; no onboarding transaction is required.
  • Deprecated sponsored invite/referral activation routes are not part of the supported flow.

Instructions

16 total
InstructionDescription
cancel_allCancels all of the trader's resting orders on the market identified by the orderbook account.
cancel_orders_by_idCancels specific resting orders by their order IDs.
cancel_up_toCancels orders on one side of the book up to an optional count and/or tick limit.
depositEmber deposit: converts the vault's input mint into the Phoenix-side output mint.
deposit_fundsDeposits base or quote mint tokens from the vault's token account into the Phoenix trader account.
place_limit_orderPlaces a limit order; the unfilled portion rests on the orderbook.
place_market_orderPlaces an immediate-or-cancel market order; unfilled size is dropped rather than rested.
place_multi_limit_orderPlaces multiple limit orders (bids and/or asks) on a single market in one CPI.
register_traderCreates an Eternal/Phoenix trader account with the GLAM vault PDA as its authority; registration alone does not activate delegated capabilities.
set_phoenix_policySets the GLAM Phoenix policy (market allowlist, order types, and price-deviation limits) on the vault state.
sync_parent_to_childSyncs collateral and state from a parent trader account down to a child subaccount.
transfer_collateralTransfers collateral from a source trader subaccount to a destination trader subaccount.
transfer_collateral_child_to_parentTransfers collateral from a child subaccount back to its parent trader account.
update_trader_stateRefreshes the trader account's cached state (PnL, funding, margin) against current market data.
withdrawEmber withdraw: converts the Phoenix-side output mint back to the input mint; `None` = full balance.
withdraw_fundsWithdraws base or quote mint tokens from the Phoenix trader account back to the vault's token account.