Skip to main content

Owner Two Step Data Module

Provides data for ERC-173 two-step ownership transfers

Key Features
  • Exposes internal functions for managing ownership data.
  • Utilizes diamond storage at a specific STORAGE_POSITION for shared state.
  • Provides access to the PendingOwnerStorage struct.
  • No external dependencies, allowing for straightforward integration into any diamond.
Module Usage

This module provides internal functions for use in your custom facets. Import it to access shared logic and storage.

Overview

This module exposes internal functions to manage the data for ERC-173 two-step ownership transfers. Facets can import this module to access and modify pending ownership states using shared diamond storage. Changes made through this module are immediately visible to all facets using the same storage pattern, ensuring consistent ownership state across the diamond.

Storage

PendingOwnerStorage

storage-location: erc8042:erc173.owner.pending

Definition
struct PendingOwnerStorage {
address pendingOwner;
}

State Variables

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

Functions

getStorage

Returns a pointer to the PendingOwner storage struct. Uses inline assembly to access the storage slot defined by STORAGE_POSITION.

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

Returns:

PropertyTypeDescription
sPendingOwnerStorageThe PendingOwnerStorage struct in storage.

pendingOwner

Get the address of the pending owner

function pendingOwner() view returns (address);

Returns:

PropertyTypeDescription
-addressThe address of the pending owner.

Best Practices

Best Practice
  • Ensure that ownership-related facets correctly initialize this module's storage slot.
  • Always call pendingOwner() to retrieve the current pending owner address for read operations.
  • When implementing ownership transfer logic, coordinate with OwnerTransferMod and OwnerRenounceMod to manage the complete two-step process.

Integration Notes

Shared Storage

This module interacts with diamond storage at the slot identified by STORAGE_POSITION, which is deterministically set using keccak256(\"erc173.owner.pending\"). The getStorage() function returns a pointer to the PendingOwnerStorage struct, allowing other facets to read or write to this shared state. The pendingOwner() function directly accesses this storage to return the address of the pending owner. All state changes made via this module are immediately visible to any other facet that references the same storage position.

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.