I have a smart contract with some constructor code that has a throw
statement in there, if certain conditions are satisfied.
But even with that, seems like contract is deployed and I get a transaction receipt and a contract address back, though when I look at the generated contract, it does not have all the properties and data.
Is there a way to stop the "Contract Deploy" transaction to be committed if the constructor code throws?
Here is the sample smart contract code I got:
pragma solidity ^0.4.8;
contract MyCoin {
function MyCoin(address _finalDestination, uint _contractGracePeriod, address _parentContract)
{
if(_parentContract == address(0))
{
hupCount = 0;
}
else
{
throw;
}
}
}
eth.getCode
. However, just like any other OOG transaction, you do still get a receipt.require()
here instead ofthrow
conditions as it is deprecated as of last updates. solidity.readthedocs.io/en/develop/…