spl_transfer_hook_example/lib.rs
1//! Crate defining an example program for performing a hook on transfer, where
2//! the token program calls into a separate program with additional accounts
3//! after all other logic, to be sure that a transfer has accomplished all
4//! required preconditions.
5
6#![allow(clippy::arithmetic_side_effects)]
7#![deny(missing_docs)]
8#![cfg_attr(not(test), forbid(unsafe_code))]
9
10pub mod processor;
11pub mod state;
12
13#[cfg(not(feature = "no-entrypoint"))]
14mod entrypoint;
15
16// Export current sdk types for downstream users building with a different sdk
17// version
18pub use solana_program;
19
20/// Place the mint id that you want to target with your transfer hook program.
21/// Any other mint will fail to initialize, protecting the transfer hook program
22/// from rogue mints trying to get access to accounts.
23///
24/// There are many situations where it's reasonable to support multiple mints
25/// with one transfer-hook program, but because it's easy to make something
26/// unsafe, this simple example implementation only allows for one mint.
27#[cfg(feature = "forbid-additional-mints")]
28pub mod mint {
29 solana_program::declare_id!("Mint111111111111111111111111111111111111111");
30}