Access Control Revoke Batch Facet
Revoke roles from multiple accounts efficiently
- Enables batch revocation of roles for improved gas efficiency.
- Integrates with diamond storage via
STORAGE_POSITION. - Emits
RoleRevokedevent for each revoked account. - Includes
exportSelectorsfor facet discovery.
Overview
This facet provides an efficient way to revoke a specified role from multiple accounts in a single transaction. It integrates with the diamond's shared storage to manage access control state. Developers can add this facet to their diamond to streamline batch role revocations.
Storage
AccessControlStorage
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("compose.accesscontrol")) |
Functions
revokeRoleBatch
Revokes a role from multiple accounts in a single transaction. Emits a RoleRevoked event for each account the role is revoked from. Reverts with AccessControlUnauthorizedAccount If the caller is not the admin of the role.
Parameters:
| Property | Type | Description |
|---|---|---|
_role | bytes32 | The role to revoke. |
_accounts | address[] | The accounts to revoke the role from. |
exportSelectors
Exports the selectors that are exposed by the facet.
Returns:
| Property | Type | Description |
|---|---|---|
- | bytes | Selectors that are exported by the facet. |
Events
Errors
Best Practices
- Ensure the caller has the necessary administrative privileges to revoke the specified role.
- Verify the
AccessControlStoragestruct in diamond storage is correctly initialized before using this facet. - Use
exportSelectorsto discover the facet's capabilities during diamond upgrades.
Security Considerations
Access to revokeRoleBatch is restricted to authorized callers, enforced by the AccessControlUnauthorizedAccount error. Ensure the caller possesses the administrative rights for the target role. The function operates on shared diamond storage; maintain invariants of the AccessControlStorage struct. Follow standard Solidity security practices for input validation and reentrancy.