RBACWithAdmin now has an initialize function instead of a constructor.

This commit is contained in:
Nicolás Venturo
2018-05-19 00:58:52 -03:00
parent dd6054efeb
commit fc07f7a0ff
2 changed files with 8 additions and 5 deletions

View File

@ -19,6 +19,8 @@ contract RBACMock is RBACWithAdmin {
function RBACMock(address[] _advisors) function RBACMock(address[] _advisors)
public public
{ {
RBACWithAdmin.initialize(msg.sender);
addRole(msg.sender, ROLE_ADVISOR); addRole(msg.sender, ROLE_ADVISOR);
for (uint256 i = 0; i < _advisors.length; i++) { for (uint256 i = 0; i < _advisors.length; i++) {

View File

@ -1,7 +1,7 @@
pragma solidity ^0.4.21; pragma solidity ^0.4.21;
import "./RBAC.sol"; import "./RBAC.sol";
import 'zos-lib/contracts/migrations/Migratable.sol';
/** /**
* @title RBACWithAdmin * @title RBACWithAdmin
@ -9,7 +9,7 @@ import "./RBAC.sol";
* @dev It's recommended that you define constants in the contract, * @dev It's recommended that you define constants in the contract,
* @dev like ROLE_ADMIN below, to avoid typos. * @dev like ROLE_ADMIN below, to avoid typos.
*/ */
contract RBACWithAdmin is RBAC { contract RBACWithAdmin is RBAC, Migratable {
/** /**
* A constant role name for indicating admins. * A constant role name for indicating admins.
*/ */
@ -26,12 +26,13 @@ contract RBACWithAdmin is RBAC {
} }
/** /**
* @dev constructor. Sets msg.sender as admin by default * @dev constructor. Sets initialAdmin as admin.
*/ */
function RBACWithAdmin() function initialize(address initialAdmin)
isInitializer("RBACWithAdmin", "1.9.0-beta")
public public
{ {
addRole(msg.sender, ROLE_ADMIN); addRole(initialAdmin, ROLE_ADMIN);
} }
/** /**