When writing ERC20 token, could I use a different event name? Or must I use Transfer as the token transfer event name?
You must use not only the exact event names (Transfer, Approve) but the exact canonical event signature if you want to comply with the standard.
Not only that, you must use the exact three functions (
approve) by name with the exact function signatures as well.
Otherwise, any tool that purports to support the ERC 20 standard (such as Etherscan) won't know what to do with your token. This is the exact reason why it's a standard--so tools that know nothing else about your ERC 20 token know how to deal with it.
Here's the actual page defining the standard. Pay particular attention to the MUST's, SHOULD's etc. They have precise meanings. You can see here that the Transfer event is a MUST.
You can use any event name of your choice. You need to declare it before use like:
event Transfer(address indexed from, address indexed to, uint256 value);
You can choose the event name of your choice. For eg,
event TokenTransfer(address indexed from, address indexed to, uint256 value);
Now in transfer you will emit the
TokenTransfer event instead of
Transfer event. And while listing to events your client must be aware about the name of event.
What's the need for changing for changing event name? Using
Transfer event for transfer function is just a standard which you may or may not follow, but ideally, you should follow.
For instance, if I want to develop a wallet or any client supporting your currency and I know this is erc-20 token, so I will expect that the code will have a
Transfer event which I can listen to. But this is just my openion else you can go by your choice of event name.