2

Reading through the Bancor code I see this:

function SmartToken(string _name, string _symbol, uint8 _decimals)
    public
    ERC20Token(_name, _symbol, _decimals)
{
    NewSmartToken(address(this));
}

What is the purpose of raising an event in the constructor? What value could it be adding to a client? Is it just an easy way to get the block the contract was created at? I imagine this is doable in any case.

Elie Steinbock
  • 564
  • 1
  • 4
  • 11

1 Answers1

1

As you point out, it's not useful for the entity creating the contract, so I imagine it's for something else that wants to know about all the SmartTokens that exist. (E.g. a central directory.)

user19510
  • 27,999
  • 2
  • 30
  • 48
  • Shouldn't the central directory be raising the event in that case? If I have web3 listening to the central directory for events, does that even let me listen for events that child contracts raise? – Elie Steinbock Mar 20 '18 at 20:27
  • I think you're assuming the directory does the deploying, but I'm assuming they want to be notified when anyone deploys the contract. – user19510 Mar 20 '18 at 21:02
  • 1
    Hmmm. I see. So it's possible to listen for a general event on the blockchain not listening to a specific smart contract for the event? – Elie Steinbock Mar 20 '18 at 21:03
  • 2
    Yes. You don't need to listen to events from a specific address. – user19510 Mar 20 '18 at 21:03