-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add master/owner tokens to erc20 token
- Loading branch information
1 parent
ff7de4a
commit 5763d7d
Showing
9 changed files
with
136 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: Mozilla Public License 2.0 | ||
|
||
pragma solidity ^0.8.17; | ||
|
||
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; | ||
|
||
contract CommunityOwnable { | ||
error CommunityOwnable_InvalidTokenAddress(); | ||
error CommunityOwnable_NotAuthorized(); | ||
|
||
address public immutable ownerToken; | ||
address public immutable masterToken; | ||
|
||
constructor(address _ownerToken, address _masterToken) { | ||
ownerToken = _ownerToken; | ||
masterToken = _masterToken; | ||
|
||
if (ownerToken == address(0) && masterToken == address(0)) { | ||
revert CommunityOwnable_InvalidTokenAddress(); | ||
} | ||
} | ||
|
||
/// @dev Reverts if the msg.sender does not possess either an OwnerToken or a MasterToken. | ||
modifier onlyCommunityOwnerOrTokenMaster() { | ||
if ( | ||
(ownerToken != address(0) && IERC721(ownerToken).balanceOf(msg.sender) == 0) | ||
&& (masterToken != address(0) && IERC721(masterToken).balanceOf(msg.sender) == 0) | ||
) { | ||
revert CommunityOwnable_NotAuthorized(); | ||
} | ||
_; | ||
} | ||
} |
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
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
Oops, something went wrong.