-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
142064c
commit 507d442
Showing
8 changed files
with
83 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.21; | ||
|
||
// @dev this is base on the solady implementation | ||
// https://github.com/Vectorized/solady/blob/main/src/auth/Ownable.sol | ||
|
||
abstract contract Ownable { | ||
address public owner; | ||
|
||
/// @dev The caller is not authorized to call the function. | ||
error Unauthorized(); | ||
|
||
constructor() { | ||
owner = msg.sender; | ||
} | ||
|
||
/// @dev Marks a function as only callable by the owner. | ||
modifier onlyOwner() { | ||
_checkOwner(); | ||
_; | ||
} | ||
|
||
/// @dev Throws if the sender is not the owner. | ||
function _checkOwner() internal view { | ||
if (msg.sender != owner) { | ||
revert Unauthorized(); | ||
} | ||
} | ||
|
||
function transferOwnership(address newOwner) external payable onlyOwner() { | ||
owner = newOwner; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters