-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlib.rs
More file actions
40 lines (35 loc) · 1.2 KB
/
lib.rs
File metadata and controls
40 lines (35 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#![allow(unexpected_cfgs, deprecated)]
use anchor_lang::prelude::*;
use light_token::instruction::MintToCpi;
declare_id!("8bXEVmHLtAVqDLJp1dYWAZ61WQmqQKoTQ8LpPbRoUDCp");
#[program]
pub mod light_token_anchor_mint_to {
use super::*;
pub fn mint_to(ctx: Context<MintToAccounts>, amount: u64) -> Result<()> {
MintToCpi {
mint: ctx.accounts.mint.to_account_info(),
destination: ctx.accounts.destination.to_account_info(),
amount,
authority: ctx.accounts.authority.to_account_info(),
system_program: ctx.accounts.system_program.to_account_info(),
fee_payer: ctx.accounts.fee_payer.to_account_info(),
}
.invoke()?;
Ok(())
}
}
#[derive(Accounts)]
pub struct MintToAccounts<'info> {
/// CHECK: Light token program for CPI
pub light_token_program: AccountInfo<'info>,
/// CHECK: Validated by light-token CPI
#[account(mut)]
pub mint: AccountInfo<'info>,
/// CHECK: Validated by light-token CPI
#[account(mut)]
pub destination: AccountInfo<'info>,
pub authority: Signer<'info>,
#[account(mut)]
pub fee_payer: Signer<'info>,
pub system_program: Program<'info, System>,
}