AccessControl
Title: AccessControl
Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/AccessControl.sol)
AccessControl is a contract module that allows children to implement role-based access control mechanisms. This is a lightweight version that doesn't include enumeration of role members.
See AccessControlEnumerable if you need to enumerate role members.
Notes:
- lattice-version: 0.1.0
- lattice-source: OpenZeppelin v5.1.0
Functions
hasRole
Checks whether an account has a specific role.
function hasRole(bytes32 _role, address _account) public view virtual returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| _role | bytes32 | The role identifier to check. |
| _account | address | The account address to verify. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool | bool True if the account has the role, false otherwise. |
getRoleAdmin
Gets the admin role that controls a specific role.
function getRoleAdmin(bytes32 _role) public view virtual 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. |
grantRole
Grants a role to an account.
Only callable by accounts holding the admin role for the target role. Emits a RoleGranted event if the role was not already held by the account.
function grantRole(bytes32 _role, address _account) public virtual;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.
Only callable by accounts holding the admin role for the target role. Emits a RoleRevoked event if the account currently holds the role.
function revokeRole(bytes32 _role, address _account) public virtual;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 caller's account.
This allows accounts to lose privileges if compromised (e.g., misplaced keys). Emits a RoleRevoked event if the caller currently holds the role. The _callerConfirmation parameter must match msg.sender for security.
function renounceRole(bytes32 _role, address _callerConfirmation) public virtual;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 AccessControl methodIdentifiers (alphabetical by signature); kept in exact parity by
ExportSelectorsParityTest. Chunks:
getRoleAdmin(bytes32) 0x248a9ca3
grantRole(bytes32,address) 0x2f2ff15d
hasRole(bytes32,address) 0x91d14854
renounceRole(bytes32,address) 0x36568abe
revokeRole(bytes32,address) 0xd547741f
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |