convert Secondary to initializers

This commit is contained in:
Francisco Giordano
2018-09-25 19:31:59 -03:00
parent 0962b9e5e6
commit 6ac45333fe
2 changed files with 9 additions and 3 deletions

View File

@ -1,9 +1,14 @@
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../ownership/Secondary.sol";
contract SecondaryMock is Secondary {
contract SecondaryMock is Initializable, Secondary {
constructor() public {
Secondary.initialize();
}
function onlyPrimaryMock() public view onlyPrimary {
}
}

View File

@ -1,17 +1,18 @@
pragma solidity ^0.4.24;
import "../Initializable.sol";
/**
* @title Secondary
* @dev A Secondary contract can only be used by its primary account (the one that created it)
*/
contract Secondary {
contract Secondary is Initializable {
address private _primary;
/**
* @dev Sets the primary account to the one that is creating the Secondary contract.
*/
constructor() public {
function initialize() public initializer {
_primary = msg.sender;
}