embark/test_dapps/contracts_app/contracts/ownable.sol

43 lines
898 B
Solidity
Raw Normal View History

2017-10-22 13:38:54 +00:00
pragma solidity ^0.4.17;
2017-07-16 18:11:37 +00:00
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
2017-07-16 18:11:37 +00:00
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
if (msg.sender != owner) {
2017-10-21 19:01:09 +00:00
revert();
2017-07-16 18:11:37 +00:00
}
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
2017-10-21 19:01:09 +00:00
function transferOwnership(address newOwner) public onlyOwner {
2017-07-16 18:11:37 +00:00
if (newOwner != address(0)) {
owner = newOwner;
}
}
}