Initial commit

This commit is contained in:
2022-07-25 18:40:16 +03:00
commit 843daad632
21 changed files with 47507 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.14;
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
abstract contract RoleControl is AccessControlUpgradeable {
bytes32 OPERATOR_ROLE = bytes32("OPERATOR_ROLE");
function isAdmin(address account) public view returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, account);
}
modifier onlyAdmin() {
require(isAdmin(msg.sender));
_;
}
function grantOperator(address account) public onlyAdmin {
grantRole(OPERATOR_ROLE, account);
}
function isOperator(address account) public view returns(bool) {
return hasRole(OPERATOR_ROLE, account);
}
modifier onlyOperator() {
require(isAdmin(msg.sender));
_;
}
function grantAdminRole(address account) public onlyAdmin {
grantRole(DEFAULT_ADMIN_ROLE, account);
}
}