Skip to main content

Owner Two Step Renounce Module

Two-step ownership renouncement with ERC-173 logic

Key Features
  • Helper functions for renouncing ownership and clearing pending-owner state.
  • 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
OWNER_STORAGE_POSITIONbytes32Owner storage position within the diamond (Value: keccak256("erc173.owner"))
PENDING_OWNER_STORAGE_POSITIONbytes32Pending owner storage position within the diamond (Value: keccak256("erc173.owner.pending"))

OwnerStorage

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

PendingOwnerStorage

Definition
/** storage-location erc8042:erc173.owner.pending */
struct PendingOwnerStorage {
address pendingOwner;
}

Functions

getOwnerStorage

Returns a pointer to the ERC-173 storage struct. Uses inline assembly to access the storage slot defined by OWNER_STORAGE_POSITION.

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

Returns:

PropertyTypeDescription
sOwnerStorageThe 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.

function getPendingOwnerStorage() pure returns (PendingOwnerStorage storage s);

Returns:

PropertyTypeDescription
sPendingOwnerStorageThe 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.

function renounceOwnership() ;

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.

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.