I have a very strange problem. Many solidity contract examples use address
struct types as state variables. But my smart contract:
pragma solidity ^0.4.0;
contract ProductItem {
address[] _owners;
address _currentOwner;
address _nextOwner;
string _productDigest;
function ProductItem(string productDigest) {
_currentOwner = msg.sender;
_productDigest = productDigest;
}
function setNextOwner(address nextOwner) returns(bool set) {
if (_currentOwner != msg.sender) {
return false;
}
_nextOwner = nextOwner;
return true;
}
function confirmOwnership() returns(bool confirmed) {
if (_nextOwner != msg.sender) {
return false;
}
_owners.push(_nextOwner);
_currentOwner = _nextOwner;
_nextOwner = address(0);
return true;
}
function getOwner() constant returns(address owner) {
return _currentOwner;
}
function getOwners() constant returns(address[] owners) {
return _owners;
}
function getProduct() returns (string product) {
return _productDigest;
}
}
gives me error in web ide:
Untitled:4:5: Error: Type "address[]" not supported for state variable.
address[] _owners;
^---------------^"
If i ignore this error and try to deploy and call function, e.g. getProduct()
it results with null.
solc
npm package, just for one address, not even an array. Compiles fine in browser-solidity.