AccessControlEnumerable
Inherits: AccessControl, IAccessControlEnumerable
Title: AccessControlEnumerable
Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/extensions/AccessControlEnumerable.sol)
Diamond facet exposing AccessControl + per-role address enumeration.
Notes:
- lattice-version: 0.1.0
- lattice-source: OpenZeppelin v5.1.0
Functions
getRoleMember
Returns the index-th address holding role.
Reverts (Solidity array OOB) if index >= getRoleMemberCount(role).
function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address);Parameters
| Name | Type | Description |
|---|---|---|
| role | bytes32 | |
| index | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
getRoleMemberCount
Returns the number of addresses holding role.
function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| role | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
getRoleMembers
Returns all addresses holding role. Gas-heavy for large sets.
function getRoleMembers(bytes32 role) public view virtual override returns (address[] memory);Parameters
| Name | Type | Description |
|---|---|---|
| role | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address[] |
hasRole
Checks whether an account has been granted a specific role.
function hasRole(bytes32 _role, address _account)
public
view
virtual
override(AccessControl, IAccessControl)
returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| _role | bytes32 | The role identifier to verify. |
| _account | address | The account address to check. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool | bool True if the account has the role, false otherwise. |
getRoleAdmin
Retrieves the admin role that controls access to a specific role.
function getRoleAdmin(bytes32 _role) public view virtual override(AccessControl, IAccessControl) returns (bytes32);Parameters
| Name | Type | Description |
|---|---|---|
| _role | bytes32 | The role identifier to query. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 | bytes32 The admin role that can grant or revoke the specified role. To change a role's admin, use AccessControl. |
grantRole
Grants a role to an account.
Emits a RoleGranted event if the account didn't already hold the role. Requirements:
- the caller must have the admin role for the target role.
function grantRole(bytes32 _role, address _account) public virtual override(AccessControl, IAccessControl);Parameters
| Name | Type | Description |
|---|---|---|
| _role | bytes32 | The role identifier to grant. |
| _account | address | The account address to grant the role to. |
revokeRole
Revokes a role from an account.
Emits a RoleRevoked event if the account currently holds the role. Requirements:
- the caller must have the admin role for the target role.
function revokeRole(bytes32 _role, address _account) public virtual override(AccessControl, IAccessControl);Parameters
| Name | Type | Description |
|---|---|---|
| _role | bytes32 | The role identifier to revoke. |
| _account | address | The account address to revoke the role from. |
renounceRole
Renounces a role from the calling account.
Allows accounts to lose privileges if compromised (e.g., misplaced keys or compromised devices). Emits a RoleRevoked event if the caller currently holds the role. Requirements:
- the caller's actual address must match the callerConfirmation parameter for security.
function renounceRole(bytes32 _role, address _callerConfirmation)
public
virtual
override(AccessControl, IAccessControl);Parameters
| Name | Type | Description |
|---|---|---|
| _role | bytes32 | The role identifier to renounce. |
| _callerConfirmation | address | The caller's address as a confirmation parameter. |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches
forge inspect AccessControlEnumerable methodIdentifiers (alphabetical by signature); kept in exact parity by
ExportSelectorsParityTest. Chunks:
getRoleAdmin(bytes32) 0x248a9ca3
getRoleMember(bytes32,uint256) 0x9010d07c
getRoleMemberCount(bytes32) 0xca15c873
getRoleMembers(bytes32) 0xa3246ad3
grantRole(bytes32,address) 0x2f2ff15d
hasRole(bytes32,address) 0x91d14854
renounceRole(bytes32,address) 0x36568abe
revokeRole(bytes32,address) 0xd547741f
function exportSelectors() external pure virtual override returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |