I have the following Interaction contract which should deploy a new DataStorage contract in the constructor, but when I run my test dataStorage is undefined. What am I doing wrong?

contract Interaction is Owned {
  DataStorage dataStorage;

  function Interaction() public {
    dataStorage = new DataStorage();

The test (contract.dataStorage is undefined)

it('should deploy an initial DataStorage contract', async () => {
  const contract = await create();
  const dataStorage = await contract.dataStorage.call();

When defining the dataStorage type in my contract I forgot to set it to public. Needs to be updated to:

DataStorage public dataStorage;

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.