Add better logging during program execution

This commit is contained in:
Michael Vines 2020-11-03 11:33:37 -08:00 committed by mergify[bot]
parent 694a03efde
commit e0e46e0385
1 changed files with 7 additions and 3 deletions

View File

@ -54,6 +54,10 @@ pub fn process_instruction(
.saturating_sub(associated_token_account_info.lamports());
if required_lamports > 0 {
info!(&format!(
"Transfer {} lamports to the associated token account",
required_lamports
));
invoke(
&system_instruction::transfer(
&funder_info.key,
@ -68,7 +72,7 @@ pub fn process_instruction(
)?;
}
// Allocate space for the associated token account
info!("Allocate space for the associated token account");
invoke_signed(
&system_instruction::allocate(
associated_token_account_info.key,
@ -81,7 +85,7 @@ pub fn process_instruction(
&[&associated_token_account_signer_seeds],
)?;
// Assign the associated token account to the SPL Token program
info!("Assign the associated token account to the SPL Token program");
invoke_signed(
&system_instruction::assign(associated_token_account_info.key, &spl_token::id()),
&[
@ -91,7 +95,7 @@ pub fn process_instruction(
&[&associated_token_account_signer_seeds],
)?;
// Initialize the associated token account
info!("Initialize the associated token account");
invoke(
&spl_token::instruction::initialize_account(
&spl_token::id(),