light_token_interface/state/extensions/transfer_hook.rs
1use light_zero_copy::{ZeroCopy, ZeroCopyMut};
2
3use crate::{AnchorDeserialize, AnchorSerialize};
4
5/// Extension indicating the account belongs to a mint with transfer hook.
6/// Contains a `transferring` flag used as a reentrancy guard during hook CPI.
7/// Consistent with SPL Token-2022 TransferHookAccount layout.
8#[derive(
9 Debug,
10 Clone,
11 Copy,
12 Hash,
13 PartialEq,
14 Eq,
15 Default,
16 AnchorSerialize,
17 AnchorDeserialize,
18 ZeroCopy,
19 ZeroCopyMut,
20)]
21#[repr(C)]
22pub struct TransferHookAccountExtension {
23 /// Flag to indicate that the account is in the middle of a transfer.
24 /// Used as reentrancy guard when transfer hook program is called via CPI.
25 /// Always false at rest since we only support nil program_id (no hook invoked).
26 pub transferring: u8,
27}