Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit e0e46e0

Browse files
mvinesmergify[bot]
authored andcommitted
Add better logging during program execution
1 parent 694a03e commit e0e46e0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

associated-token-account/program/src/processor.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ pub fn process_instruction(
5454
.saturating_sub(associated_token_account_info.lamports());
5555

5656
if required_lamports > 0 {
57+
info!(&format!(
58+
"Transfer {} lamports to the associated token account",
59+
required_lamports
60+
));
5761
invoke(
5862
&system_instruction::transfer(
5963
&funder_info.key,
@@ -68,7 +72,7 @@ pub fn process_instruction(
6872
)?;
6973
}
7074

71-
// Allocate space for the associated token account
75+
info!("Allocate space for the associated token account");
7276
invoke_signed(
7377
&system_instruction::allocate(
7478
associated_token_account_info.key,
@@ -81,7 +85,7 @@ pub fn process_instruction(
8185
&[&associated_token_account_signer_seeds],
8286
)?;
8387

84-
// Assign the associated token account to the SPL Token program
88+
info!("Assign the associated token account to the SPL Token program");
8589
invoke_signed(
8690
&system_instruction::assign(associated_token_account_info.key, &spl_token::id()),
8791
&[
@@ -91,7 +95,7 @@ pub fn process_instruction(
9195
&[&associated_token_account_signer_seeds],
9296
)?;
9397

94-
// Initialize the associated token account
98+
info!("Initialize the associated token account");
9599
invoke(
96100
&spl_token::instruction::initialize_account(
97101
&spl_token::id(),

0 commit comments

Comments
 (0)