I have a Contract Template (Say contract ABC). The constructor takes in 3 fields to initialize a contract. I built in logic within the constructor to return a bool based on data checks. The constructor should fail and not create a valid Contract if the data fields fails validation. The return is a bool.
function ABC(bytes32 _field1, bytes32 _field2, bytes32 _field3) returns (bool isSuccess);
Now when I try to create a new contract (from another contract): How do I check for the bool (Success).
I create an instance of the contract as:
ABC local = new ABC(_field1, _field2, _field3);
Is there a way to check if this was success - based on the bool return from the Constructor.
Alternative 1: I can do the data checks before I send the request to the Constructor. I was trying to avoid rewriting the same code in multiple locations.
Alternative 2: I can initialize a field isValue within the constructor and check for it when validating an instance.
Any advise? Thanks,