In the contract for EOS crowdsale:


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 ?
  • 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.

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.