34 lines
796 B
Solidity
34 lines
796 B
Solidity
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
pragma solidity >=0.5.4 <0.9.0;
|
|
|
|
contract Owned {
|
|
|
|
// The owner
|
|
address public owner;
|
|
|
|
event OwnerChanged(address indexed _newOwner);
|
|
|
|
/**
|
|
* @notice Throws if the sender is not the owner.
|
|
*/
|
|
modifier onlyOwner {
|
|
require(msg.sender == owner, "Must be owner");
|
|
_;
|
|
}
|
|
|
|
constructor() public {
|
|
owner = msg.sender;
|
|
}
|
|
|
|
/**
|
|
* @notice Lets the owner transfer ownership of the contract to a new owner.
|
|
* @param _newOwner The new owner.
|
|
*/
|
|
function changeOwner(address _newOwner) external onlyOwner {
|
|
require(_newOwner != address(0), "Address must not be null");
|
|
owner = _newOwner;
|
|
emit OwnerChanged(_newOwner);
|
|
}
|
|
} |