Skip to main content

Owner Two Step Renounce Facet

Two-step ownership renouncement for diamonds

Key Features
  • Implements a two-step ownership renouncement process.
  • Manages owner and pending owner state via diamond storage.
  • Provides exportSelectors for diamond integration.
  • No external dependencies beyond diamond storage access.

Overview

This facet provides a two-step process for renouncing ownership of a diamond contract. It interacts with shared diamond storage to manage the owner and pending owner states. Developers integrate this facet to enable secure ownership transfer management within a diamond.

Storage

OwnerStorage

Definition
struct OwnerStorage {
address owner;
}

PendingOwnerStorage

Definition
struct PendingOwnerStorage {
address pendingOwner;
}

State Variables

PropertyTypeDescription
OWNER_STORAGE_POSITIONbytes32Diamond storage slot position for this module (Value: keccak256("erc173.owner"))
PENDING_OWNER_STORAGE_POSITIONbytes32Diamond storage slot position for this module (Value: keccak256("erc173.owner.pending"))

Functions

renounceOwnership

function renounceOwnership() external;

exportSelectors

Exports the function selectors of the OwnerTwoStepRenounceFacet This function is use as a selector discovery mechanism for diamonds

function exportSelectors() external pure returns (bytes memory);

Returns:

PropertyTypeDescription
-bytesselectors The exported function selectors of the OwnerTwoStepRenounceFacet

Events

Errors

Best Practices

Best Practice
  • Ensure the OwnerTwoStepRenounceFacet is correctly deployed and added to the diamond before calling its functions.
  • The renounceOwnership function should only be called by the current owner.
  • Use exportSelectors to programmatically discover the facet's supported functions.

Security Considerations

Security

The renounceOwnership function is protected by an implicit access control mechanism tied to the diamond's owner. Calling renounceOwnership will transfer ownership to a zero address after a delay, making the contract effectively un-ownable. Ensure the current owner calls this function only when intended. Reentrancy is not a concern as there are no external calls. Input validation is minimal, relying on the EVM's address type. The function uses inline assembly to access specific storage slots for owner and pending owner data.

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.