2019-06-05 17:35:01 +00:00
|
|
|
pragma solidity >=0.5.0 <0.6.0;
|
|
|
|
|
|
|
|
/// @dev `Owned` is a base level contract that assigns an `owner` that can be
|
|
|
|
/// later changed
|
|
|
|
contract Owned {
|
2019-07-06 23:40:22 +00:00
|
|
|
event OwnerChanged(address newOwner);
|
2019-06-05 17:35:01 +00:00
|
|
|
|
|
|
|
/// @dev `owner` is the only address that can call a function with this
|
|
|
|
/// modifier
|
|
|
|
modifier onlyOwner() {
|
|
|
|
require(msg.sender == owner, "Unauthorized");
|
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
address payable public owner;
|
|
|
|
|
|
|
|
/// @notice The Constructor assigns the message sender to be `owner`
|
|
|
|
constructor() internal {
|
|
|
|
owner = msg.sender;
|
|
|
|
}
|
|
|
|
|
|
|
|
address payable public newOwner;
|
|
|
|
|
|
|
|
/// @notice `owner` can step down and assign some other address to this role
|
|
|
|
/// @param _newOwner The address of the new owner. 0x0 can be used to create
|
|
|
|
/// an unowned neutral vault, however that cannot be undone
|
|
|
|
function changeOwner(address payable _newOwner) public onlyOwner {
|
2019-07-06 23:40:22 +00:00
|
|
|
emit OwnerChanged(_newOwner);
|
2019-06-05 17:35:01 +00:00
|
|
|
newOwner = _newOwner;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function acceptOwnership() public {
|
|
|
|
if (msg.sender == newOwner) {
|
|
|
|
owner = newOwner;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|