Skip to main content

Owner Renounce Module

ERC-173 renounce ownership for diamond facets

Key Features
  • Helper functions for renouncing ownership and storage access.
  • renounceOwnership guards by requiring msg.sender is the stored owner.
  • Emits OwnershipTransferred with newOwner == address(0).
Module Usage

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

PropertyTypeDescription
STORAGE_POSITIONbytes32Owner storage position within the diamond (Value: keccak256("erc173.owner"))

OwnerStorage

Definition
/** @custom:storage-location erc8042:erc173.owner */
struct OwnerStorage {
address owner;
}

Functions

getStorage

Returns a pointer to the ERC-173 OwnerStorage struct. Uses inline assembly to bind the slot to STORAGE_POSITION.

function getStorage() pure returns (OwnerStorage storage s);

Returns:

PropertyTypeDescription
sOwnerStorage storageThe 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.

function renounceOwnership();

Events

Errors

Best Practices

  • Call renounceOwnership only from a trusted external wrapper after you intend to give up owner control permanently.
  • Keep the same STORAGE_POSITION and OwnerStorage layout 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.

Was this helpful?
Last updated:

Newsletter

Get notified about releases, feature announcements, and technical deep-dives on building smart contracts with Compose.

No spam. Unsubscribe anytime.