Tax Hook
TransferHook program for automated transfer fees with Permanent Delegate collection
Overview
The Tax Hook validates and logs transfers during the TransferHook CPI, then collects taxes in a separate instruction using the Permanent Delegate PDA. This two-step design keeps the transfer CPI within compute limits.
Program ID: ACJXvcH4uaBfBwSwcVG48zJ177ydEvtCqGRMKXv53goZ
Tax Collection Flow
- During
execute(TransferHook CPI): validates the transfer and logs the amount - During
collect_tax(separate call): uses the Permanent Delegate to transfer tax to the vault
Accounts
TaxConfig PDA
Seeds: ["tax-config", mint]
| Field | Type | Description |
|---|---|---|
authority | Pubkey | Admin who can update settings |
mint | Pubkey | The token mint |
tax_vault | Pubkey | Destination for collected taxes |
tax_bps | u16 | Current tax rate in basis points |
max_tax_bps | u16 | Hard cap (immutable after creation) |
is_active | bool | Kill switch |
exempt_count | u32 | Number of exempt wallets |
exempt_wallets | Vec<Pubkey> | Tax-exempt addresses |
TaxDelegate PDA
Seeds: ["tax-delegate", mint]
The Permanent Delegate authority used to collect taxes post-transfer.
ExtraAccountMetas PDA
Seeds: ["extra-account-metas", mint]
Instructions
| Instruction | Description |
|---|---|
initialize | Create the tax config PDA |
initialize_extra_account_metas | Create the ExtraAccountMetas PDA |
update_tax_rate | Change tax rate (capped by max_tax_bps) |
update_tax_vault | Change tax collection wallet |
add_exempt_wallets | Exempt wallets from tax |
remove_exempt_wallets | Remove exemptions |
update_authority | Transfer admin rights |
toggle_active | Emergency kill switch |
execute | TransferHook entry point |
collect_tax | Collect taxes via Permanent Delegate |