Access Control Batch Grant Module
Provides an internal function for granting roles to multiple accounts in a single transaction
Key Features
- Internal functions for composability within facets.
- Efficient batch granting of roles to multiple accounts.
- Utilizes diamond storage for shared state management.
- No external dependencies, promoting a self-contained design.
Storage
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("compose.accesscontrol")) |
Access Control Storage
Functions
getStorage
Returns the storage for the Access Control.
Returns:
| Property | Type | Description |
|---|---|---|
_s | AccessControlStorage | The storage for the AccessControl. |
grantRoleBatch
function to grant 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 permissions to grant roles before invoking
grantRoleBatch. - Consider the gas implications for very large
_accountsarrays; for extremely large lists, multiple calls might be more gas-efficient.
Was this helpful?
Last updated: