liquid-funding/contracts/Owned.sol

42 lines
1.3 KiB
Solidity
Raw Normal View History

2017-06-26 17:54:28 +00:00
pragma solidity ^0.4.11;
/// @dev `Owned` is a base level contract that assigns an `owner` that can be
/// later changed
contract Owned {
/// @dev `owner` is the only address that can call a function with this
/// modifier
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
address public owner;
2017-09-26 08:58:31 +00:00
/// @notice The Constructor assigns the account deploying the contract to be
/// the `owner`
2017-06-26 17:54:28 +00:00
function Owned() {
owner = msg.sender;
}
address public newOwner;
/// @notice `owner` can step down and assign some other address to this role
2017-09-26 08:58:31 +00:00
/// but after this function is called the current owner still has ownership
/// powers in this contract; change of ownership is a 2 step process
/// @param _newOwner The address of the new owner. A simple contract with
2017-09-29 10:18:07 +00:00
/// the ability to accept ownership but the inability to do anything else
2017-09-26 08:58:31 +00:00
/// can be used to create an unowned contract to achieve decentralization
2017-06-26 17:54:28 +00:00
function changeOwner(address _newOwner) onlyOwner {
newOwner = _newOwner;
}
2017-09-26 08:58:31 +00:00
/// @notice `newOwner` can accept ownership over this contract
2017-06-26 17:54:28 +00:00
function acceptOwnership() {
if (msg.sender == newOwner) {
owner = newOwner;
}
}
}