MCPcopy Create free account
hub / github.com/Lightprotocol/light-protocol-v1 / token_transfer

Function token_transfer

program/src/instructions.rs:99–137  ·  view source on GitHub ↗
(
    token_program: &'b AccountInfo<'a>,
    source: &'b AccountInfo<'a>,
    destination: &'b AccountInfo<'a>,
    authority: &'b AccountInfo<'a>,
    seed: &[u8],
    bump_seed: &[u8],
    amount: 

Source from the content-addressed store, hash-verified

97}
98
99pub fn token_transfer<'a, 'b>(
100 token_program: &'b AccountInfo<'a>,
101 source: &'b AccountInfo<'a>,
102 destination: &'b AccountInfo<'a>,
103 authority: &'b AccountInfo<'a>,
104 seed: &[u8],
105 bump_seed: &[u8],
106 amount: u64,
107) -> Result<(), ProgramError> {
108 let authority_signature_seeds = [seed, bump_seed];
109
110 let signers = &[&authority_signature_seeds[..]];
111 // msg!(
112 // "Transferring {} from {:?} to {:?}",
113 // amount,
114 // source.key,
115 // destination.key
116 // );
117
118 let ix = spl_token::instruction::transfer(
119 token_program.key,
120 source.key,
121 destination.key,
122 authority.key,
123 &[],
124 amount,
125 )?;
126 invoke_signed(
127 &ix,
128 &[
129 source.clone(),
130 destination.clone(),
131 authority.clone(),
132 token_program.clone(),
133 ],
134 signers,
135 )?;
136 Ok(())
137}
138
139#[allow(clippy::clone_double_ref)]
140pub fn create_and_try_initialize_tmp_storage_pda(

Callers 1

process_instructionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected