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 ?
Badr Bellaj
  • 18,780
  • 4
  • 58
  • 75
jfjobidon
  • 763
  • 2
  • 11
  • 25

2 Answers2

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.

Qkyrie
  • 562
  • 3
  • 7
1

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