(
token_program: &'b AccountInfo<'a>,
source: &'b AccountInfo<'a>,
destination: &'b AccountInfo<'a>,
authority: &'b AccountInfo<'a>,
seed: &[u8],
bump_seed: &[u8],
amount:
| 97 | } |
| 98 | |
| 99 | pub 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)] |
| 140 | pub fn create_and_try_initialize_tmp_storage_pda( |
no outgoing calls
no test coverage detected