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
| Field | Type | Description |
|---|---|---|
admin | pubkey | May change the sequencer and the fee recipient. |
sequencer | pubkey | The engine key that posts batches and co-signs withdrawals. |
fee_recipient | pubkey | The launch wallet. Protocol fees go to its USDC associated token account. |
usdc_mint | pubkey | The collateral mint. |
vault | pubkey | The USDC token account the program holds collateral in. |
escape_slots | u64 | Slots without a batch after which escape_withdraw opens. |
last_batch | u64 | Number of the last batch posted; 0 before the first. |
last_batch_slot | u64 | Slot 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_reported | u64 | Cumulative protocol fees the engine has reported. |
fees_swept | u64 | Cumulative protocol fees paid to the fee recipient. |
bump | u8 | Config PDA bump. |
vault_bump | u8 | Vault PDA bump. |
Trader
PDA ["trader", owner], discriminator 4a8520692f3205ee.
Trader
| Field | Type | Description |
|---|---|---|
owner | pubkey | The trader wallet. |
session_key | pubkey | Pubkey::default() when no session key is registered. |
session_expiry | i64 | Unix seconds. |
settled_equity | u64 | Equity the engine posted in the last batch that touched this account. |
deposited | u64 | Cumulative USDC deposited into the vault. |
withdrawn | u64 | Cumulative USDC paid out by withdraw. |
deposits_credited | u64 | deposited as the engine had credited it at last_batch. |
withdrawals_credited | u64 | withdrawn as the engine had credited it at last_batch. |
last_batch | u64 | Number of the last batch that carried this account. |
bump | u8 | Trader PDA bump. |
The trader's available equity is computed from settled_equity, deposited, deposits_credited, withdrawn and withdrawals_credited.