Access Control Batch Grant Facet
Exposes an external function to grant a specific role to multiple accounts efficiently within a single transaction.
Key Features
- Grants roles to multiple accounts in a single atomic operation.
- Emits
RoleGrantedevents for each account granted a role. - Uses diamond storage for role management, ensuring state consistency across facets.
- Provides
exportSelectorsfor easy integration into diamond upgrade processes.
Storage
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("compose.accesscontrol")) |
AccessControlStorage
Functions
grantRoleBatch
Grants a role to multiple accounts in a single transaction. Emits a RoleGranted event for each newly granted account. Reverts with AccessControlUnauthorizedAccount if the caller is not the admin of the role.
Parameters:
| Property | Type | Description |
|---|---|---|
_role | bytes32 | The role to grant. |
_accounts | address[] | The accounts to grant the role to. |
Events
Errors
Best Practices
- Ensure the caller has the necessary admin privileges to grant the specified role.
- Consider the gas implications for very large
_accountsarrays; for extremely large lists, multiple calls might be more gas-efficient.
Was this helpful?
Last updated: