solhint icon indicating copy to clipboard operation
solhint copied to clipboard

mark-callable-contracts notified when creating instances of a struct

Open mdnorman opened this issue 5 years ago • 0 comments

I have a struct in a base class, eg MyStruct:

pragma solidity ^0.5.0;


contract BaseContract {
  struct MyStruct {
    string myField;
  }
}

Which I want to construct in an inherited contract:

pragma solidity ^0.5.0;

import 'BaseContract.sol';


contract SubContract is BaseContract {
  MyStruct private _data;

  function initialize() public {
    _data = MyStruct({myField: 'the data'});
  }
}

Error:

contracts/SubContract.sol
  10:13  error  Explicitly mark all external contracts as trusted or untrusted  mark-callable-contracts

NOTE: I also tested when the struct was in the same file:

pragma solidity ^0.5.0;


contract SubContract {
  struct MyStruct {
    string myField;
  }

  MyStruct private _data;

  function initialize() public {
    _data = MyStruct({myField: 'the data'});
  }
}

Error:

contracts/base/SubContract.sol
  12:13  error  Explicitly mark all external contracts as trusted or untrusted  mark-callable-contracts

mdnorman avatar Mar 01 '20 19:03 mdnorman