๐ชDebit
#[instruction(params: DebitParams)] // only for documentation
pub struct Debit<'info> {
pub debit_authority: Signer<'info>,
pub mint: InterfaceAccount<'info, Mint>,
#[account(mut)]
pub token_account: InterfaceAccount<'info, TokenAccount>,
#[account(mut)]
pub destination_token_account: InterfaceAccount<'info, TokenAccount>,
#[account(
seeds = [
b"smart-delegate"
],
bump = smart_delegate.bump
)]
pub smart_delegate: Account<'info, SmartDelegate>,
#[account(
mut,
seeds = [
b"pre-authorization",
token_account.key().as_ref(),
debit_authority.key().as_ref(),
],
bump = pre_authorization.bump,
has_one = debit_authority @ CustomProgramError::DebitUnauthorized,
has_one = token_account @ CustomProgramError::PreAuthorizationTokenAccountMismatch
)]
pub pre_authorization: Account<'info, PreAuthorization>,
pub token_program: Interface<'info, TokenInterface>,
}
pub struct DebitParams {
pub amount: u64,
}Last updated