discover-dapps/contracts/common/Controlled.sol

23 lines
640 B
Solidity
Raw Normal View History

2019-04-09 22:24:40 +00:00
pragma solidity ^0.5.2;
2019-04-08 17:28:36 +00:00
2019-04-08 17:28:36 +00:00
contract Controlled {
/// @notice The address of the controller is the only address that can call
/// a function with this modifier
modifier onlyController {
require(msg.sender == controller, "Unauthorized");
_;
}
address payable public controller;
constructor() internal {
controller = msg.sender;
}
/// @notice Changes the controller of the contract
/// @param _newController The new controller of the contract
2019-04-09 22:24:40 +00:00
function changeController(address payable _newController) external onlyController {
2019-04-08 17:28:36 +00:00
controller = _newController;
}
}