AccessControlFacetStorage
Library that contains storage and functionality associated with AccessControlFacet.
AlreadyInitialized
Thrown when attempting to re-initialize.
RestrictedDefaultRole
Thrown when attempting to handle (grant or revoke) a default role (either OPEN_ROLE or ADMIN_ROLE).
UnauthorizedRoleHandling
Thrown when an account attempts to handle (grant or revoke) a role it is not permitted to manage.
AccountMissingRole
Thrown when an account attempts an action without the required role.
InvalidZeroAddressForAdmin
Thrown when attempting to assign the zero address as the admin.
InvalidCampaignIdZero
Thrown when a campaignId of 0 is provided, which is invalid for campaign-scoped role checks.
ZeroAccountsToGrant
Thrown when no accounts provided for role granting.
ZeroAccountsToRevoke
Thrown when no accounts provided for role revocation.
CannotHandleAdminRole
Thrown when an attempt is made to handle ADMIN_ROLE.
STORAGE_SLOT
================================================== STORAGE =================================================
Unique identifier for the storage slot where the Layout struct is stored. Derived from the ERC7201 formula. STORAGE_SLOT: 0xf38f18dbf28c638dc6bd2b4f1f6d9a444471db909c2346c79451042d2b750100
ADMIN_ROLE
OPEN_ROLE
Layout
onlyRoleHandler
Restricts function execution to designated role handlers for a specified role.
Checks that the specified role is not OPEN_ROLE or ADMIN_ROLE, and verifies whether
the caller is authorized to handle the specified role.
If the caller is neither a designated role handler nor the Admin, the function reverts.
Parameters
| Name | Type | Description |
|---|---|---|
| role | bytes32 | The identifier of the role for which the caller must be a designated handler. |
onlyRole
Rrestricts function execution to accounts with the specified role.
Checks whether the caller has the specified role, else it reverts.
If the specified role is the OPEN_ROLE then function proceeds with the execution.
Parameters
| Name | Type | Description |
|---|---|---|
| role | bytes32 | The identifier of the role that the caller must hold to proceed. |
layout
Retrieves a reference to the Layout struct stored at a specified storage slot
initAccessControlFacet
Initializes the AccessControlFacetStorage by setting the Admin of the tmi-fractions platform.
admin cannot be address(0).
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| account | address | The address to be the designated Admin of the platform, responsible for managing permissions. |
hasRole
Checks whether a specific account holds a specified role within the tmi-fractions platform.
This function verifies role-based permissions within a platform-scoped context.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| role | bytes32 | The role identifier to check. |
| account | address | The address to verify for the specified role. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | true if account holds role; false otherwise. |
hasRoleForId
Checks whether a specific account holds a specified role within a given campaign.
This function verifies role-based permissions within a campaign-scoped context.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| campaignId | uint256 | The unique identifier of the targeted campaign. |
| role | bytes32 | The role identifier to check. |
| account | address | The address to verify for the specified role in the given campaign. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | true if account holds role within campaignId; false otherwise. |
getRolesOf
Returns all the roles that a specified account holds within a platform-scoped context.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| account | address | The address to query for platform-scoped roles. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bytes32[] | An array of all the platform-scoped roles that account holds. |
getAccountsWithRole
Returns all the accounts that hold the specified role within a platform-scoped context.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| role | bytes32 | The role to check for. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | address[] | An array of all the accounts that hold the specified role. |
getRolesOfAccountForId
Returns all the roles that a specified account holds within a campaign-scoped context.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| campaignId | uint256 | The unique identifier of the targeted campaign. |
| account | address | The address to query for the targeted campaign-scoped roles. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bytes32[] | An array of all the roles held by account within campaignId. |
getAccountsWithRoleForId
Returns all the accounts that hold a specified role within a given campaign.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| campaignId | uint256 | The unique identifier of the targeted campaign. |
| role | bytes32 | The role to check for. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | address[] | An array of all the accounts that hold the specified role within campaignId. |
getHandledRolesOf
Returns all the roles that a specified account is a role handler for.
A role handler manages its role both in a platform-scoped and campaign-scoped context.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| account | address | The account to check. |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bytes32[] | An array of all the roles that account is a role handler for. |
grantRole
Grants role to account within a platform-scoped context.
Only callable by the Admin or a handler of role.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| role | bytes32 | The identifier of the role to grant. |
| account | address | The address to which role is granted. |
grantRoleForId
Grants role to account within a campaign-scoped context.
Only callable by the Admin or a handler of role.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| campaignId | uint256 | The unique identifier of the targeted campaign. |
| role | bytes32 | The identifier of the role to grant. |
| account | address | The address to which role is granted. |
grantRoleMultiple
Grants role to multiple accounts within a platform-scoped context.
Only callable by the Admin or a handler of role.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| role | bytes32 | The identifier of the role to grant. |
| accounts | address[] | An array of addresses to which role is granted. |
grantRoleMultipleForId
Grants role to multiple accounts within a campaign-scoped context.
Only callable by the Admin or a handler of role.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| campaignId | uint256 | The unique identifier of the targeted campaign. |
| role | bytes32 | The identifier of the role to grant. |
| accounts | address[] | An array of addresses to which role is granted. |
revokeRole
Revokes role from account within a platform-scoped context.
Only callable by the Admin or a handler of role.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| role | bytes32 | The identifier of the role to revoke. |
| account | address | The address from which role is revoked. |
revokeRoleForId
Revokes role from account within a campaign-scoped context.
Only callable by the Admin or a handler of role.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| campaignId | uint256 | The unique identifier of the targeted campaign. |
| role | bytes32 | The identifier of the role to revoke. |
| account | address | The address from which role is revoked. |
revokeRoleMultiple
Revokes role from multiple accounts within a platform-scoped context.
Only callable by the Admin or a handler of role.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| role | bytes32 | The identifier of the role to revoke. |
| accounts | address[] | An array of addresses from which role is revoked. |
revokeRoleMultipleForId
Revokes role from multiple accounts within a campaign-scoped context.
Only callable by the Admin or a handler of role.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| campaignId | uint256 | The unique identifier of the targeted campaign. |
| role | bytes32 | The identifier of the role to revoke. |
| accounts | address[] | An array of addresses from which role is revoked. |
addRoleHandler
Delegates the handling of role to the specified account, allowing account to manage
the granting and revocation of this role.
_Only callable by the Admin.
Designated role handlers can manage the associated roles both at the platform level (platform-scoped context) and within individual campaigns (campaign-scoped context)._
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| role | bytes32 | The identifier of the role to delegate handling for. |
| account | address | The address to be designated as a role handler for role. |
removeRoleHandler
Revokes role handling privileges from the specified account, preventing account from managing
the granting and revocation of this role.
Only callable by the Admin.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| role | bytes32 | The identifier of the role to revoke handling for. |
| account | address | The address to be removed as a role handler for role. |
changeAdmin
Replaces the current Admin with a new Admin.
Only callable by the (current) Admin. In this version, only one Admin is supported per platform.
Parameters
| Name | Type | Description |
|---|---|---|
| l | struct AccessControlFacetStorage.Layout | A reference to the Layout struct in storage. |
| account | address | The address of the new Admin. |

