triggr-program 0.1.1

Created with Anchor
Documentation
pub use crate::state::*;
pub use anchor_lang::prelude::*;

#[derive(Accounts)]
pub struct InitializeProgram<'info> {
    #[account(mut)]
    authority: Signer<'info>,

    #[account(init, seeds = ["program".as_bytes()], bump, space = 8 + ProgramState::SIZE, payer = authority)]
    program_account: Account<'info, ProgramState>,

    system_program: Program<'info, System>,
}

pub fn handler(ctx: Context<InitializeProgram>) -> Result<()> {
    msg!("Program initialized");
    *ctx.accounts.program_account = ProgramState::new(ctx.accounts.authority.key());

    Ok(())
}