Skip to main content

hopper_virtual

Macro hopper_virtual 

Source
macro_rules! hopper_virtual {
    (
        slots = $n:literal,
        map {
            $( $slot:literal => account_index: $idx:literal
                $(, owned $( = $owner:expr )? )?
                $(, writable )?
            ),+ $(,)?
        }
    ) => { ... };
}
Expand description

Declare a multi-account virtual state mapping.

let market = hopper_virtual! {
    slots = 3,
    map {
        0 => account_index: 1, owned, writable,
        1 => account_index: 2, owned,
        2 => account_index: 3,
    }
};

market.validate(accounts, program_id)?;
let core: &MarketCore = market.overlay::<MarketCore>(accounts, 0)?;