[Ethereum] Why Transfer(0x0, _to, _amount) after Minting Tokens

openzeppelinsoliditytokens

In https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20/MintableToken.sol#L38, why is it necessary to emit the event

Transfer(0x0, _to, _amount);

after minting some coins? Can someone please explain this line of code? Are you actually transferring coins from 0x0 to the address _to?

Best Answer

That is not a transfer operations but an event notification.

This is done that way so block explorer and wallets that only interpret the 'Transfer' event can show the operation to the user. There were some complaint from users that the transfer failed because it didn't show up in their wallet (or block explorer).

Only the 'Transfer' event is part of the ERC20 standard, and the events 'Mint' and 'Burn' are not. It is a workaround around that limitation to generate a tranfer from 0x0 to simulate a 'Mint' event and, a transfer to 0x0 to simulate a 'Burn' event.