Details
// In verify_token_payment(), after extracting amount:
let effective_amount = if *is_2022 {
// Fetch the mint to check for TransferFeeConfig
let mint_account = CacheUtil::get_account(
rpc_client,
&token_mint,
false,
).await?;
let mint_info = Token2022MintInfo::from_account_data(&mint_account.data)?;
if let Ok(Some(fee)) = mint_info.calculate_transfer_fee(
*amount,
rpc_client.get_epoch_info().await?.epoch,
) {
amount.saturating_sub(fee)
} else {
*amount
}
} else {
*amount
};
let lamport_value = TokenUtil::calculate_token_value_in_lamports(
effective_amount, // Use post-fee amount
&token_mint,
config.validation.price_source.clone(),
rpc_client,
)
.await?;
References
crates/lib/src/token/token.rs:529-654—verify_token_payment()using raw amountcrates/lib/src/token/spl_token_2022.rs:165-198—calculate_transfer_fee()(exists but not called in verification)crates/lib/src/fee/fee.rs:174-204—analyze_payment_instructions()(correctly accounts for transfer fee in estimation)- SPL Token-2022 specification: transfer fees are deducted from the transfer amount by the on-chain program