triggr-program 0.1.1

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

#[derive(Accounts)]
pub struct CloseProgram<'info> {
    #[account(mut, constraint = program_account.authority == authority.key())]
    authority: Signer<'info>,

    #[account(mut,  seeds = ["program".as_bytes()], bump, close = authority)]
    program_account: Account<'info, ProgramState>,

    system_program: Program<'info, System>,
}

pub fn handler(_ctx: Context<CloseProgram>) -> Result<()> {
    msg!("Program account closed");
    Ok(())
}

#[account]
pub struct ProgramState {
    pub authority: Pubkey,
}