0

Please Have a look at this contract

0x253b898233d2f29ed9c8d499789d651cf9d1818c created this contract,but if you check its source code,you will notice that the contract name is uppercased: enter image description here Yet the "construction function" is lowercased: enter image description here So this is a fake construction function.Below sentence will never run:

balanceOf[msg.sender] = totalSupply; 

So,the contraction creator will not get the whole tokens.And this is the truth,because if we check the whole transaction history of this contract,you will see that the first transaction is sent by 0x42050d23c77b4997b3dc6dca97a45b7b1fd8adaa,which is not the creator of this contract. So,why does 0x42050d23c77b4997b3dc6dca97a45b7b1fd8adaa has the whole supply tokens since it's not the contract creator?

1

By changing the contract name, they turned the luke function into a regular function instead of the constructor.

This means that anyone can invoke that function in a regular transaction.

The 0x42050d23c77b4997b3dc6dca97a45b7b1fd8adaa address did so, and was able to set the total supply and make itself the owner.

Now, the function is still public, and still very much accessible. If someone else calls luke, they can overwrite the previous settings, and set a new owner and total supply.

  • Well explained! – bo wen Aug 7 '18 at 8:10
  • @bo wen, if Raghav explained well, please accept the answer so people can see this has been solved. – Jaime Aug 7 '18 at 8:15

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.