Skip to main content

Owner Renounce Module

Renounces contract ownership to address(0)

Key Features
  • 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.
Module Usage

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

Definition
struct OwnerStorage {
address owner;
}

State Variables

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

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

Returns:

PropertyTypeDescription
sOwnerStorageThe OwnerStorage struct in storage.

renounceOwnership

Renounce ownership of the contract. Sets the owner to address(0), disabling all functions restricted to the owner.

function renounceOwnership() ;

Events

Errors

Best Practices

Best Practice
  • Call renounceOwnership only 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

Shared Storage

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.

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.