Program Instructions
Program ID: 8A3VegJ9k5mcXr1AeXgGD4Zr6XrAdyWnNiCK1AUTidey (mainnet)
Account management
Section titled “Account management”initialize
Section titled “initialize”Sets up the global ProgramConfig with the protocol fee rate. Admin-only.
| Parameter | Type | Description |
|---|---|---|
fee_bps | u16 | Protocol fee in basis points (max 100) |
Signer: Admin
createAdvisoryAccount
Section titled “createAdvisoryAccount”Creates a new advisory account linking an owner to an advisor.
| Parameter | Type | Description |
|---|---|---|
owner_encryption_key | [u8; 32] | Owner’s x25519 public key |
Signer: Owner
PDA: ["advisory", owner_pubkey]
Initial status: Pending
acceptAdvisoryAccount
Section titled “acceptAdvisoryAccount”Advisor accepts a pending invitation and sets their fee.
| Parameter | Type | Description |
|---|---|---|
advisor_fee_bps | u16 | Advisor commission (0-100 bps) |
Signer: Advisor (must match advisory account’s advisor field)
Status transition: Pending -> Active
revokeAdvisor
Section titled “revokeAdvisor”Owner revokes the advisor relationship. No new proposals can be created.
Signer: Owner
Status transition: Active -> Revoked
closeAdvisoryAccount
Section titled “closeAdvisoryAccount”Closes the advisory account and returns rent to the owner.
Signer: Owner Prerequisite: All proposals must be in terminal state
setEncryptionKey
Section titled “setEncryptionKey”Updates the owner’s x25519 public key on-chain.
| Parameter | Type | Description |
|---|---|---|
owner_encryption_key | [u8; 32] | New x25519 public key |
Signer: Owner
Proposal lifecycle
Section titled “Proposal lifecycle”createProposal
Section titled “createProposal”Advisor creates an encrypted trade proposal.
| Parameter | Type | Description |
|---|---|---|
encrypted_data | Vec<u8> | Encrypted ProposalPayload (max 512 bytes) |
Signer: Advisor
PDA: ["proposal", advisory_account, proposal_count]
Prerequisite: Advisory account must be Active
Initial status: Pending
approveProposal
Section titled “approveProposal”Owner decrypts, reviews, and approves a proposal with execution parameters.
| Parameter | Type | Description |
|---|---|---|
execution_window_seconds | i64 | Time advisor has to execute (60-86400s) |
amount | u64 | Input token amount (before fees) |
other_amount_threshold | u64 | Slippage protection (min output) |
amount_specified_is_input | bool | True if amount is input |
a_to_b | bool | Swap direction |
pool | Pubkey | Raydium pool address |
token_mint_a | Pubkey | Token A mint |
token_mint_b | Pubkey | Token B mint |
pool_type | enum | Cpmm or Clmm |
Signer: Owner
Status transition: Pending -> Approved
rejectProposal
Section titled “rejectProposal”Owner rejects a proposal.
Signer: Owner
Status transition: Pending -> Rejected
closeProposal
Section titled “closeProposal”Closes a proposal and reclaims rent. Allowed when proposal is in a terminal state (Executed, Rejected, Expired, Cancelled) or past its execution deadline.
Signer: Owner or Advisor
Execution
Section titled “Execution”executeProposal
Section titled “executeProposal”Executes an approved swap via Raydium CP-Swap (CPMM).
Signer: Advisor
Prerequisite: Proposal status Approved, within execution deadline
Status transition: Approved -> Executed
Fee deduction:
program_fee = (amount * program_fee_bps) / 10_000advisor_fee = (amount * advisor_fee_bps) / 10_000swap_amount = amount - program_fee - advisor_feeexecuteProposalClmm
Section titled “executeProposalClmm”Same as executeProposal but routes through Raydium CLMM (concentrated liquidity).
Signer: Advisor Additional accounts: 3 tick array PDAs for the swap direction
Vault management
Section titled “Vault management”initVault
Section titled “initVault”Initializes a token vault for a specific mint under an advisory account.
Signer: Any (payer)
PDA: ["vault", advisory_account, token_mint]
deposit
Section titled “deposit”Owner deposits tokens into a vault. Creates the vault if it doesn’t exist.
| Parameter | Type | Description |
|---|---|---|
amount | u64 | Token amount (must be > 0) |
Signer: Owner
withdraw
Section titled “withdraw”Owner withdraws tokens from a vault.
| Parameter | Type | Description |
|---|---|---|
amount | u64 | Token amount |
Signer: Owner
withdrawFees
Section titled “withdrawFees”Advisor withdraws accumulated advisor fees.
Signer: Advisor