Account Layout
Advisory Account (126 bytes)
Section titled “Advisory Account (126 bytes)”PDA seeds: ["advisory", owner_pubkey]
| Offset | Size | Field | Type |
|---|---|---|---|
| 0 | 8 | Discriminator | [u8; 8] |
| 8 | 32 | owner | Pubkey |
| 40 | 32 | advisor | Pubkey |
| 72 | 8 | proposal_count | u64 (LE) |
| 80 | 2 | active_proposals | u16 (LE) |
| 82 | 8 | created_at | i64 (LE, Unix timestamp) |
| 90 | 2 | advisor_fee_bps | u16 (LE) |
| 92 | 1 | status | u8 (0=Pending, 1=Active, 2=Revoked) |
| 93 | 1 | bump | u8 |
| 94 | 32 | owner_encryption_key | [u8; 32] |
Proposal (variable length)
Section titled “Proposal (variable length)”PDA seeds: ["proposal", advisory_account_pubkey, proposal_count_le_bytes]
Fixed header
Section titled “Fixed header”| Offset | Size | Field | Type |
|---|---|---|---|
| 0 | 8 | Discriminator | [u8; 8] |
| 8 | 32 | advisory_account | Pubkey |
| 40 | 32 | advisor | Pubkey |
| 72 | 32 | owner | Pubkey |
| 104 | 8 | proposal_id | u64 (LE) |
| 112 | 1 | status | u8 |
| 113 | 4 | encrypted_data.len() | u32 (LE, Borsh Vec prefix) |
| 117 | N | encrypted_data | [u8; N] |
Proposal status values: 0=Pending, 1=Approved, 2=Executed, 3=Rejected, 4=Expired, 5=Cancelled
Dynamic fields
Section titled “Dynamic fields”All offsets below are relative to base = 117 + N where N is the encrypted_data length.
| Offset | Size | Field | Type |
|---|---|---|---|
| base+0 | 8 | amount | u64 (LE) |
| base+8 | 8 | other_amount_threshold | u64 (LE) |
| base+16 | 1 | amount_specified_is_input | bool |
| base+17 | 1 | a_to_b | bool |
| base+18 | 32 | pool | Pubkey |
| base+50 | 32 | token_mint_a | Pubkey |
| base+82 | 32 | token_mint_b | Pubkey |
| base+114 | 1 | pool_type | u8 (0=Cpmm, 1=Clmm) |
| base+115 | 8 | created_at | i64 (LE) |
| base+123 | 8 | approved_at | i64 (LE) |
| base+131 | 8 | execution_deadline | i64 (LE) |
| base+139 | 8 | executed_at | i64 (LE) |
| base+147 | 1 | bump | u8 |
Proposal Payload (encrypted)
Section titled “Proposal Payload (encrypted)”The encrypted_data field contains an encrypted JSON payload with this structure:
{ "rationale": "string — advisor's reasoning for the trade", "amount": 1000000, "other_amount_threshold": 5000000, "amount_specified_is_input": true, "a_to_b": true, "pool": "base58 Raydium pool address", "token_mint_a": "base58 mint address", "token_mint_b": "base58 mint address", "pool_type": "cpmm"}Encryption envelope
Section titled “Encryption envelope”| Offset | Size | Field |
|---|---|---|
| 0 | 1 | Version (0x01=v1, 0x02=v2) |
| 1 | 32 | Sender x25519 public key |
| 33 | 24 | NaCl nonce |
| 57 | N+16 | NaCl box ciphertext (plaintext + 16-byte MAC) |
Total overhead: 73 bytes. Max encrypted payload: 512 bytes.
PDA seeds: ["vault", advisory_account_pubkey, token_mint_pubkey]
A standard SPL Token Account owned by the program’s authority PDA (["authority"]). No custom data layout — uses the standard 165-byte token account structure.
Program Config
Section titled “Program Config”PDA seeds: ["program_config"]
| Offset | Size | Field | Type |
|---|---|---|---|
| 0 | 8 | Discriminator | [u8; 8] |
| 8 | 32 | admin | Pubkey |
| 40 | 2 | fee_bps | u16 (LE) |
| 42 | 1 | bump | u8 |
PDA Seeds Reference
Section titled “PDA Seeds Reference”| Account | Seeds |
|---|---|
| Advisory Account | ["advisory", owner_pubkey] |
| Proposal | ["proposal", advisory_account, proposal_count (8 bytes LE)] |
| Vault | ["vault", advisory_account, token_mint] |
| Authority | ["authority"] |
| Program Config | ["program_config"] |
| Fee Vault | ["fee_vault"] |