beforeTokenTransfer
beforeTokenTransfer is a hook used in token contracts to run custom logic before a token transfer occurs. It is part of the transfer workflow in common standards such as ERC20 and ERC721, and its purpose is to give developers a point of extension to enforce rules or trigger side effects without altering the core transfer code.
In OpenZeppelin’s implementations, the hook is a virtual internal function that can be overridden in derived
The default implementations are empty, meaning there is no behavior added unless a contract overrides the function.
Common use cases include pausing transfers by combining with a Pausable mechanism, restricting transfers to approved
Developers should be mindful of interactions with other hooks, such as _afterTokenTransfer, and ensure that overriding