Skip to content

DelegatedAccessControl

DelegatedAccessControl

__DelegatedAccessControl_init

function __DelegatedAccessControl_init() internal

__DelegatedAccessControl_init_unchained

function __DelegatedAccessControl_init_unchained() internal

RoleData

struct RoleData {
  mapping(address => bool) members;
  bytes32 adminRole;
}

_roles

mapping(address => mapping(bytes32 => struct DelegatedAccessControl.RoleData)) _roles

_roleNames

mapping(bytes32 => string) _roleNames

maps keccak256 hash to string representation

DELEGATED_ADMIN

string DELEGATED_ADMIN

_DELEGATED_ADMIN_HASH

bytes32 _DELEGATED_ADMIN_HASH

onlyRole

modifier onlyRole(address delegate, string role)

Modifier that checks that an account has a specific role. Reverts with a standardized message including the required role.

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

See {IERC165-supportsInterface}.

hasRole

function hasRole(address delegate, string role, address account) external view returns (bool)

Returns `true` if `account` has been granted `role`.

checkRole

function checkRole(address delegate, string role, address account) external view

revert if the `account` does not have the specified role.

Name Type Description
delegate address delegate to check
role string the role specifier.
account address the address to check the role for.

getRoleAdmin

function getRoleAdmin(address delegate, string role) public view returns (string)

_Returns the admin role that controls `role`. See {grantRole} and {revokeRole}.

To change a role's admin, use {AccessControl-setRoleAdmin}.

grantRole

function grantRole(address delegate, string role, address account) external

_Grants `role` to `account`.

If `account` had not been already granted `role`, emits a {RoleGranted} event.

Requirements:

  • the caller must have ``role``'s admin role._

revokeRole

function revokeRole(address delegate, string role, address account) external

_Revokes `role` from `account`.

If `account` had been granted `role`, emits a {RoleRevoked} event.

Requirements:

  • the caller must have ``role``'s admin role._

renounceRole

function renounceRole(address delegate, string role, address account) external

_Revokes `role` from the calling account.

Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced).

If the calling account had been granted `role`, emits a {RoleRevoked} event.

Requirements:

  • the caller must be `account`._

_setRoleAdmin

function _setRoleAdmin(address delegate, string role, string adminRole) internal virtual

_Sets `adminRole` as ``role``'s admin role.

Emits a {RoleAdminChanged} event._

_hasRole

function _hasRole(address delegate, string role, address account) internal view returns (bool)

_grantRole

function _grantRole(address delegate, string role, address account) internal virtual

_Grants `role` to `account`.

Internal function without access restriction._

_revokeRole

function _revokeRole(address delegate, string role, address account) internal virtual

_Revokes `role` from `account`.

Internal function without access restriction._

_checkRole

function _checkRole(address delegate, string role) internal view virtual

Revert with a standard message if `_msgSender()` is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.

_checkRole

function _checkRole(address delegate, string role, address account) internal view virtual

Revert with a standard message if `account` is missing `role`.

_hash

function _hash(string str) internal pure returns (bytes32)

__gap

uint256[48] __gap

This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps