In the code below if I don't have token_program defined, I get compile time error. However, I am only initializing the ATA but not minting, transferring, approving, or burning the token mint which is handled by token program.
#[account(
init_if_needed,
payer = buyer,
associated_token::mint = mint,
associated_token::authority = buyer
)]
pub buyer_mint: InterfaceAccount<'info,TokenAccount>,
pub associated_token_program: Program<'info, AssociatedToken>
pub token_program: Interface<'info, TokenInterface>,
But if I assume the ATA is already initialized below, I don't get any compile time errors if I omit both token program and atp which makes sense because the program assumes its an existing ata.
#[account(
mut,
associated_token::mint = mint,
associated_token::authority = buyer
)]
pub buyer_mint: InterfaceAccount<'info,TokenAccount>,
My question is what does token_program
has to do in the first code base ?