Access Control Renounce Facet
Renounces roles for accounts within a diamond.
- Exposes an external
renounceRolefunction for role management. - Emits
RoleRevokedevent upon successful role renouncement. - Reverts with
AccessControlUnauthorizedSenderif the caller is not the target account. - Compatible with ERC-2535 diamond standard.
Overview
This facet provides functionality to renounce roles for accounts in a diamond. It exposes the renounceRole function, allowing authorized accounts to relinquish their assigned roles. Calls are routed through the diamond proxy, ensuring consistent access control and upgradeability.
Storage
AccessControlStorage
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("compose.accesscontrol")) |
Functions
renounceRole
Renounces a role from the caller. Emits a RoleRevoked event. Reverts with AccessControlUnauthorizedSender If the caller is not the account to renounce the role from.
Parameters:
| Property | Type | Description |
|---|---|---|
_role | bytes32 | The role to renounce. |
_account | address | The account to renounce 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
- Call
renounceRolethrough the diamond proxy to ensure proper access control checks. - Ensure the caller is the account from which the role is being renounced to prevent unauthorized revocations.
- Verify the
RoleRevokedevent is emitted and correctly interpreted by off-chain services.
Security Considerations
The renounceRole function is protected by access control, ensuring only the account itself can renounce its role. The facet does not perform external calls, mitigating reentrancy risks. Input validation is handled by the underlying access control logic within the diamond.