Owner Renounce Module
Renounces contract ownership to address(0)
- Provides ERC-173 ownership renouncement functionality.
- Sets owner to address(0) to disable owner-specific access.
- Uses diamond storage pattern via
STORAGE_POSITION. - Internal functions for facet integration.
This module provides internal functions for use in your custom facets. Import it to access shared logic and storage.
Overview
This module provides logic to renounce ownership of a contract, setting the owner to address(0). This action disables all functions restricted to the owner. Facets import this module to manage ownership transitions within the diamond's shared storage.
Storage
OwnerStorage
storage-location: erc8042:erc173.owner
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("erc173.owner")) |
Functions
getStorage
Returns a pointer to the ERC-173 storage struct. Uses inline assembly to access the storage slot defined by STORAGE_POSITION.
Returns:
| Property | Type | Description |
|---|---|---|
s | OwnerStorage | The OwnerStorage struct in storage. |
renounceOwnership
Renounce ownership of the contract. Sets the owner to address(0), disabling all functions restricted to the owner.
Events
Errors
Best Practices
- Call
renounceOwnershiponly when a permanent transfer of control is intended. - Ensure all critical owner-only functions are migrated or disabled before renouncing.
- Verify that the diamond's storage layout for ownership is compatible with ERC-173 semantics.
Integration Notes
This module interacts with diamond storage at the STORAGE_POSITION defined for ERC-173 ownership. It reads and writes the owner field within the OwnerStorage struct. When renounceOwnership is called, the owner state variable in this storage slot is updated to address(0), making it immediately visible to all facets accessing the same storage slot. This action effectively revokes all owner privileges.