Trade
Accounts

Program

Accounts

Config and Trader, field by field.

Both accounts are Anchor accounts: the data starts with an 8-byte discriminator, then the fields in order, Borsh-encoded. USDC amounts are u64 base units with 6 decimals.

Config

PDA ["config"], discriminator 9b0caae01efacc82.

Config
FieldTypeDescription
adminpubkeyMay change the sequencer and the fee recipient.
sequencerpubkeyThe engine key that posts batches and co-signs withdrawals.
fee_recipientpubkeyThe launch wallet. Protocol fees go to its USDC associated token account.
usdc_mintpubkeyThe collateral mint.
vaultpubkeyThe USDC token account the program holds collateral in.
escape_slotsu64Slots without a batch after which escape_withdraw opens.
last_batchu64Number of the last batch posted; 0 before the first.
last_batch_slotu64Slot the last batch landed in (the initialize slot before the first). The escape window counts from it.
last_state_hash[u8; 32]State hash of the last batch.
fees_reportedu64Cumulative protocol fees the engine has reported.
fees_sweptu64Cumulative protocol fees paid to the fee recipient.
bumpu8Config PDA bump.
vault_bumpu8Vault PDA bump.

Trader

PDA ["trader", owner], discriminator 4a8520692f3205ee.

Trader
FieldTypeDescription
ownerpubkeyThe trader wallet.
session_keypubkeyPubkey::default() when no session key is registered.
session_expiryi64Unix seconds.
settled_equityu64Equity the engine posted in the last batch that touched this account.
depositedu64Cumulative USDC deposited into the vault.
withdrawnu64Cumulative USDC paid out by withdraw.
deposits_creditedu64deposited as the engine had credited it at last_batch.
withdrawals_creditedu64withdrawn as the engine had credited it at last_batch.
last_batchu64Number of the last batch that carried this account.
bumpu8Trader PDA bump.

The trader's available equity is computed from settled_equity, deposited, deposits_credited, withdrawn and withdrawals_credited.