Owner Two Step Data Module
Provides data for ERC-173 two-step ownership transfers
- Exposes
internalfunctions for managing ownership data. - Utilizes diamond storage at a specific
STORAGE_POSITIONfor shared state. - Provides access to the
PendingOwnerStoragestruct. - No external dependencies, allowing for straightforward integration into any diamond.
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
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Diamond 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.
Returns:
| Property | Type | Description |
|---|---|---|
s | PendingOwnerStorage | The PendingOwnerStorage struct in storage. |
pendingOwner
Get the address of the pending owner
Returns:
| Property | Type | Description |
|---|---|---|
- | address | The address of the pending owner. |
Best Practices
- 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
OwnerTransferModandOwnerRenounceModto manage the complete two-step process.
Integration Notes
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.