0

On ERC20 token implementation example on wiki they updated the code. And in constructor function of fixed token example they have used transfer function.

    function FixedSupplyToken() public {
    symbol = "FIXED";
    name = "Example Fixed Supply Token";
    decimals = 18;
    _totalSupply = 1000000 * 10**uint(decimals);
    balances[owner] = _totalSupply;
    Transfer(address(0), owner, _totalSupply);

}

Whats the significance of transfer function here and from where it is getting its parameters?

2

Transfer is an event, not a function.

It's used here to make sure that tools that monitor for token transfer events see that the new token went to owner. It indicates that all the tokens were sent from address 0 to owner. (This isn't exactly accurate, since the tokens were never owned by address 0, but it seems to be a convention that quite a few tokens follow to show token creation.)

1
  • +1 for the part about convention. Always wondered why they are written like that. – Lauri Peltonen Feb 21 '18 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.