Skip to main content

hopper_program

Attribute Macro hopper_program 

Source
#[hopper_program]
Expand description

Generate a dispatch table for a Hopper program module.

Maps instruction discriminator bytes to handler functions, generating a clean entrypoint with minimal branching.

§Example

#[hopper_program]
mod vault {
    pub fn deposit(ctx: &mut Context, amount: u64) -> ProgramResult { ... }
    pub fn withdraw(ctx: &mut Context, amount: u64) -> ProgramResult { ... }
}

// Generated:
// pub fn __hopper_dispatch(program_id, accounts, data) -> ProgramResult { ... }