Owner Renounce Module
ERC-173 renounce ownership for diamond facets
- Helper functions for renouncing ownership and storage access.
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 |
|---|---|---|
STORAGE_POSITION | bytes32 | Owner storage position within the diamond (Value: keccak256("erc173.owner")) |
OwnerStorage
Functions
getStorage
Returns a pointer to the ERC-173 OwnerStorage struct. Uses inline assembly to bind the slot to STORAGE_POSITION.
Returns:
| Property | Type | Description |
|---|---|---|
s | OwnerStorage storage | The struct in storage. |
renounceOwnership
Internal renounce path: requires msg.sender == s.owner, then sets owner to address(0) and emits OwnershipTransferred(previousOwner, address(0)). Reverts OwnerUnauthorizedAccount if the caller is not the current owner.
Events
Errors
Best Practices
- Call
renounceOwnershiponly from a trustedexternalwrapper after you intend to give up owner control permanently. - Keep the same
STORAGE_POSITIONandOwnerStoragelayout as other owner modules; do not fork a second owner slot.
Integration Notes
OwnerStorage lives at keccak256("erc173.owner") inside the diamond—the same slot as OwnerDataMod, OwnerDataFacet, and OwnerRenounceFacet. Renouncing here updates what owner() reads elsewhere.