mirror of https://github.com/vacp2p/minime.git
30 lines
886 B
Solidity
30 lines
886 B
Solidity
|
// SPDX-License-Identifier: GPL-3.0
|
||
|
pragma solidity ^0.8.0;
|
||
|
|
||
|
error NotAuthorized();
|
||
|
|
||
|
/// @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() {
|
||
|
if (msg.sender != owner) revert NotAuthorized();
|
||
|
_;
|
||
|
}
|
||
|
|
||
|
address public owner;
|
||
|
|
||
|
/// @notice The Constructor assigns the message sender to be `owner`
|
||
|
constructor() {
|
||
|
owner = msg.sender;
|
||
|
}
|
||
|
|
||
|
/// @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 ublock.timestampned neutral vault, however that cannot be undone
|
||
|
function changeOwner(address _newOwner) public onlyOwner {
|
||
|
owner = _newOwner;
|
||
|
}
|
||
|
}
|