2

This is going to be short question and may be silly, but I'm literally stuck with a problem, where I need to pass address(0) to function in Truffle Test in JS and don't really know how to do it. In solidity it's simply address(0), but in Truffle JS?

3

You can simply use 0, or 0x0000000000000000000000000000000000000000.

address(0) in Solidity is equivalent to 0x0000000000000000000000000000000000000000.

| improve this answer | |
  • 3
    I get invalid address error, with Truffle 5, Web3 1, Solidity .5 – ferit Jun 18 '19 at 20:11
  • To be clear, you have to use it as a String: zero_address = "0x0000000000000000000000000000000000000000"; this works for me. – almel Jun 10 at 1:09
1

You must put single quotes around it. '0x0000000000000000000000000000000000000000' worked for me Been hunting down that bug for some time ...

| improve this answer | |
  • this did not work for me :| – almel Jun 9 at 23:20

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.