-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Description
The way to customize token transfers today is by overriding the hooks _beforeTokenTransfer and _afterTokenTransfer. This was designed this way because there are multiple related operations (mint, transfer, burn) that would generally be customized in a uniform way (e.g. "pause transfers" should also pause mints), and they are different functions all of which invoke the same hooks.
An alternative that we can consider is instead to have a single entry point for all of these operations, a _transfer function that mints if the "from" argument is 0, etc., as suggested in #3109 for ERC20 (the same applies to other tokens). Hooks can then be removed because customizing transfers can be done by overriding this single function instead of overriding the hooks.