ens-usernames/contracts/common/Controlled.sol

25 lines
681 B
Solidity
Raw Normal View History

// SPDX-License-Identifier: CC0-1.0
2024-06-07 04:58:07 -03:00
pragma solidity 0.8.25;
2018-04-23 01:58:58 -03:00
2024-06-07 04:57:35 -03:00
abstract contract Controlled {
2018-04-23 01:58:58 -03:00
/// @notice The address of the controller is the only address that can call
/// a function with this modifier
2024-06-07 04:58:07 -03:00
modifier onlyController() {
require(msg.sender == controller, "Unauthorized");
_;
2018-04-23 01:58:58 -03:00
}
address payable public controller;
2018-04-23 01:58:58 -03:00
2024-06-07 04:57:35 -03:00
constructor() {
controller = payable(msg.sender);
2018-04-23 01:58:58 -03:00
}
/// @notice Changes the controller of the contract
/// @param _newController The new controller of the contract
function changeController(address payable _newController) public onlyController {
2018-04-23 01:58:58 -03:00
controller = _newController;
}
}