Deploying a contract with missing constructor args

Hi I’m trying to understand something about the scenario of when a contract has a constructor, and that constructor takes args, but you deploy the contract without submitting any.

I went and tried this in remix and was surprised to see that remix still deployed the contract. I was expecting some kind of error, but did not see one. Can anyone explain this behavior?

I am guessing that since the constructor is optional, that the contract simply ignores the constructor since it is incomplete and deploys anyway. I also wonder what if the constructor asks for 3 args and I only give it 2. Does it take the 2 or just skip the constructor?

And in any case, if args are missing, then I suppose the contract is just deployed but essentially worthless and broken? Seems odd this would be allowed to occur by the EVM.

Anyone light that can be shed on this would be great.

Hi @CryptoEatsTheWorld

The constructor arguments are mandatory and cannot be omitted.
Remix is just sending empty arguments if you do not provide any. It won’t be the same once you start using Truffle and Ganache :slight_smile:

1 Like

Ah OK, that makes more sense! Thanks.