ZepplinOS contracts do not use constructors in it's zos implementation, and instead uses an initialization function that it imports from zos-lib/contracts/Initializable.sol package.
In order for the contract to have upgradeable state, the state variables need to be declared within the initialization function like so:
bytes32[] public data;
function initialize(bytes32[] _data) initializer public {
data = _data;
}
If I want to set the owner of the contract, would I simply set an owner variable in the initialize function? Not sure what the best practice is here.
pragma solidity ^0.5.0;
import "zos-lib/contracts/Initializable.sol";
contract Verifications is Initializable {
mapping (bytes32 => bytes32) public data;
address public owner;
function initialize(bytes32[] _data) initializer public {
owner = msg.sender;
data = _data;
}
}
Thoughts? Is this ok?