|
@@ -48,11 +48,11 @@ import {ERC165} from "../utils/introspection/ERC165.sol";
|
|
|
*/
|
|
|
abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
|
|
struct RoleData {
|
|
|
- mapping(address => bool) members;
|
|
|
+ mapping(address account => bool) hasRole;
|
|
|
bytes32 adminRole;
|
|
|
}
|
|
|
|
|
|
- mapping(bytes32 => RoleData) private _roles;
|
|
|
+ mapping(bytes32 role => RoleData) private _roles;
|
|
|
|
|
|
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
|
|
|
|
|
@@ -76,7 +76,7 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
|
|
* @dev Returns `true` if `account` has been granted `role`.
|
|
|
*/
|
|
|
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
|
|
|
- return _roles[role].members[account];
|
|
|
+ return _roles[role].hasRole[account];
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -182,7 +182,7 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
|
|
*/
|
|
|
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
|
|
|
if (!hasRole(role, account)) {
|
|
|
- _roles[role].members[account] = true;
|
|
|
+ _roles[role].hasRole[account] = true;
|
|
|
emit RoleGranted(role, account, _msgSender());
|
|
|
return true;
|
|
|
} else {
|
|
@@ -199,7 +199,7 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
|
|
*/
|
|
|
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
|
|
|
if (hasRole(role, account)) {
|
|
|
- _roles[role].members[account] = false;
|
|
|
+ _roles[role].hasRole[account] = false;
|
|
|
emit RoleRevoked(role, account, _msgSender());
|
|
|
return true;
|
|
|
} else {
|