ProgramInstructions

Program Instructions

On-chain instructions exposed by the Veil program.

Admin Instructions

init_config

Initialize global protocol configuration.

Accounts:

  • admin - signer creating the config
  • config - config PDA (["veil_config"])
  • system_program

Parameters:

  • governance: Pubkey
  • er_authority: Pubkey
  • allowed_mints: Vec<Pubkey>
  • whitelist_enabled: bool
  • max_recipients: u16
  • batch_timeout_secs: u64

update_mint_whitelist

Update whitelist mode and the set of allowed mints.

Accounts:

  • governance
  • config

Parameters:

  • whitelist_enabled: bool
  • allowed_mints: Vec<Pubkey>

set_er_authority

Rotate the ER authority.

Accounts:

  • governance
  • config

Parameters:

  • new_er_authority: Pubkey

pause

Pause the protocol.

Accounts:

  • governance
  • config

unpause

Unpause the protocol.

Accounts:

  • governance
  • config

Vault Instructions

init_vault

Initialize a token-specific vault for an employer.

Accounts:

  • employer
  • config
  • token_mint
  • vault - PDA ["vault", employer, token_mint]
  • vault_ata - PDA ["vault_ata", vault]
  • token_program
  • system_program

Parameters: none

deposit

Deposit tokens into a vault.

Accounts:

  • employer
  • vault
  • vault_ata
  • employer_ata
  • token_mint
  • token_program

Parameters:

  • amount: u64

withdraw

Withdraw available tokens from a vault.

Accounts:

  • employer
  • vault
  • vault_ata
  • employer_ata
  • token_mint
  • token_program

Parameters:

  • amount: u64

delegate_vault

Delegate vault state to the ER flow.

undelegate_vault

Undelegate vault state from the ER flow.

Schedule Instructions

create_schedule

Create a recurring payout schedule.

Accounts:

  • employer
  • config
  • vault
  • schedule - PDA ["schedule", vault, schedule_id]
  • system_program

Parameters:

  • schedule_id: [u8; 32]
  • interval_secs: u64
  • reserved_amount: u64
  • per_execution_amount: u64
  • merkle_root: [u8; 32]
  • total_recipients: u16
  • er_job_id: [u8; 32]

Validation highlights:

  • interval must be between 1 hour and 31 days
  • reserved_amount must not exceed vault available
  • per_execution_amount must be positive and not exceed reserved_amount
  • total_recipients must be within config and hard protocol limits

pause_schedule

Pause or resume a schedule.

Accounts:

  • employer
  • config
  • schedule

Parameters:

  • pause: bool

update_schedule

Update a paused schedule.

This instruction replaces the schedule cadence, reserve amount, per-execution amount, Merkle root, and recipient count. It is intentionally paused-only so an active payout cycle cannot change underneath the coordinator.

Accounts:

  • employer - Signer, vault owner
  • config - Global config PDA
  • vault - Vault PDA
  • schedule - Schedule PDA

Parameters:

  • interval_secs - Seconds between executions (u64)
  • reserved_amount - New total reserved amount (u64)
  • per_execution_amount - New amount paid per execution cycle (u64)
  • merkle_root - New Merkle root ([u8; 32])
  • total_recipients - New number of recipients (u16)

Rules:

  • The schedule must be Paused
  • No payout batch can be in progress
  • per_execution_amount must be greater than zero and cannot exceed reserved_amount
  • Increasing reserved_amount pulls from vault available balance
  • Decreasing reserved_amount releases funds back to vault available balance
  • next_execution is reset to the current timestamp plus interval_secs

cancel_schedule

Cancel a schedule and release reserved funds back into the vault’s available balance.

Accounts:

  • employer
  • config
  • vault
  • schedule

Parameters: none

delegate_schedule

Delegate a schedule into the ER execution flow.

Accounts: ER flow accounts

Parameters:

  • schedule_id: [u8; 32]

undelegate_schedule

Undelegate a schedule from the ER execution flow.

Accounts: ER flow accounts

Parameters:

  • schedule_id: [u8; 32]

claim_payment

Execute a Merkle-proof-backed claim.

Accounts:

  • er_authority
  • config
  • vault
  • vault_ata
  • schedule
  • recipient_ata
  • token_mint
  • token_program

Parameters:

  • schedule_id: [u8; 32]
  • recipient: Pubkey
  • amount: u64
  • leaf_index: u16
  • proof: Vec<[u8; 32]>

Commit Instruction

commit

Commit ER execution state back to Solana.

Accounts: commit context accounts

Parameters: none