Owner Two Step Renounce Module
Two-step ownership renouncement with ERC-173 logic
- Helper functions for renouncing ownership and clearing pending-owner state.
renounceOwnershipguards by requiringmsg.senderis the stored owner.- Emits
OwnershipTransferredwithnewOwner == address(0).
Import this module into facets or shared setup code. Its functions are internal (including Solidity file-level helpers). Use them through your facet’s external entrypoints.
Storage follows the diamond slot layout in this file; any code using the same STORAGE_POSITION or related positions reads and writes shared state.
See Facets & Modules for more information.
Storage
State Variables
| Property | Type | Description |
|---|---|---|
OWNER_STORAGE_POSITION | bytes32 | Owner storage position within the diamond (Value: keccak256("erc173.owner")) |
PENDING_OWNER_STORAGE_POSITION | bytes32 | Pending owner storage position within the diamond (Value: keccak256("erc173.owner.pending")) |
OwnerStorage
PendingOwnerStorage
Functions
getOwnerStorage
Returns a pointer to the ERC-173 storage struct. Uses inline assembly to access the storage slot defined by OWNER_STORAGE_POSITION.
Returns:
| Property | Type | Description |
|---|---|---|
s | OwnerStorage | The OwnerStorage struct in storage. |
getPendingOwnerStorage
Returns a pointer to the PendingOwner storage struct. Uses inline assembly to access the storage slot defined by PENDING_OWNER_STORAGE_POSITION.
Returns:
| Property | Type | Description |
|---|---|---|
s | PendingOwnerStorage | The PendingOwnerStorage struct in storage. |
renounceOwnership
Renounce ownership of the contract. Sets the owner to address(0) and clears any pending owner, disabling all functions restricted to the owner.
Events
Errors
Best Practices
- Ensure the caller is the owner before invoking state-changing functions.
Integration Notes
This module interacts with diamond storage at the slots defined by OWNER_STORAGE_POSITION and PENDING_OWNER_STORAGE_POSITION.
The renounceOwnership function directly modifies the owner & pendingOwner fields within the storage structs, setting it to address(0). These changes are immediately visible to all facets that access the same storage slots.