10

In the contract for EOS crowdsale:

https://etherscan.io/address/0xd0a6e6c54dbc68db5db3a091b171a77407ff7ccf#code

line 469:

assert(address(EOS) == address(0));

"assert" will test if both sides of the expression are equals, but:

  • 1) address(EOS) is the address of the contract, right ?
  • 2) what is address(0) ?
  • 3) why to compare those values ?

2 Answers 2

12
  • address(EOS) will return the address of the contract with variable name EOS.
  • address(0) is the same as "0x0", an uninitialized address.
  • The two get compared to assert that the code that follows will only be ran if the contract that points to the EOS token (so the reference saved in variable EOS) is not yet set. If it's initialized, it will point to something else than "0x0", and the assertion will fail.

  • why? To make sure you can only initialize it once.

1

Typically, address(0) indicates an unknown/anonymous address where you would send to burn the tokens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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