2023-09-12 14:22:43 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0
|
|
|
|
pragma solidity ^0.8.0;
|
2017-10-21 07:10:44 +00:00
|
|
|
|
2023-09-12 18:27:44 +00:00
|
|
|
error NotAuthorized();
|
|
|
|
|
2017-10-21 07:10:44 +00:00
|
|
|
contract Controlled {
|
|
|
|
/// @notice The address of the controller is the only address that can call
|
|
|
|
/// a function with this modifier
|
2023-09-12 15:08:59 +00:00
|
|
|
modifier onlyController() {
|
2023-09-12 18:27:44 +00:00
|
|
|
if (msg.sender != controller) revert NotAuthorized();
|
2023-09-12 15:08:59 +00:00
|
|
|
_;
|
|
|
|
}
|
2017-10-21 07:10:44 +00:00
|
|
|
|
2023-09-12 14:22:43 +00:00
|
|
|
address payable public controller;
|
2017-10-21 07:10:44 +00:00
|
|
|
|
2023-09-12 15:08:59 +00:00
|
|
|
constructor() {
|
|
|
|
controller = payable(msg.sender);
|
|
|
|
}
|
2017-10-21 07:10:44 +00:00
|
|
|
|
|
|
|
/// @notice Changes the controller of the contract
|
|
|
|
/// @param _newController The new controller of the contract
|
2023-09-12 14:22:43 +00:00
|
|
|
function changeController(address payable _newController) public onlyController {
|
2017-10-21 07:10:44 +00:00
|
|
|
controller = _newController;
|
|
|
|
}
|
|
|
|
}
|