1

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.

0

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.)

  • 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? – Eliezer 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. – smarx 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? – Eliezer Steinbock Mar 20 '18 at 21:03
  • 2
    Yes. You don't need to listen to events from a specific address. – smarx Mar 20 '18 at 21:03

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.