I have the following method in my contract:

function setup(address _fooAddress) external onlyOwner {
  require(_fooAddress.isContract(), "_fooAddress is not a contract"); 

And I am trying to test it with hardhat, I am passing _fooAddress as 0x0000000000000000000000000000000000000000 but I get the _fooAddress is not a contract error.

const { setup } = await contract();

await setup("0x0000000000000000000000000000000000000000");

Any idea why null address is not evaluated as a contract address?

  • What is you see is what you get. 0x0000000000000000000000000000000000000000 is not a contract in the Hardhat Network. Commented Aug 30, 2022 at 8:20

1 Answer 1


the way an isContract() works is that it tests for the size/amount of code at the address being more than 0. If no code at the address, isContract() returns false. To get it to return true, there must be some code deployed to the address.

There's no code deployed to the zero address

Your Answer

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

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