Owner Two Step Data Facet
Manages pending owner state for two-step ownership transfers
- Exposes external
pendingOwnerfunction for read-only access to ownership state. - Provides internal
getStoragefunction for facets to access shared storage. - Includes
exportSelectorsfor diamond discovery and management. - Operates within the Compose diamond standard, utilizing shared diamond storage.
Overview
This facet provides access to the pending owner state within a diamond. It exposes functions to retrieve the pending owner address and access internal storage structures. Developers integrate this facet to manage ownership transitions in a two-step process, ensuring clarity and security.
Storage
PendingOwnerStorage
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("erc173.owner.pending")) |
Functions
pendingOwner
Get the address of the pending owner
Returns:
| Property | Type | Description |
|---|---|---|
- | address | The address of the pending owner. |
exportSelectors
Exports the function selectors of the OwnerTwoStepDataFacet This function is use as a selector discovery mechanism for diamonds
Returns:
| Property | Type | Description |
|---|---|---|
- | bytes | selectors The exported function selectors of the OwnerTwoStepDataFacet |
Best Practices
- Initialize the
pendingOwnerto the zero address before the first transfer. - Ensure other facets that manage ownership (e.g., transfer or renounce) properly interact with the state managed by this facet.
- When upgrading, verify that the
STORAGE_POSITIONforPendingOwnerStorageremains consistent or is handled correctly during the upgrade process.
Security Considerations
The pendingOwner function is a view function and poses no direct reentrancy risk. The exportSelectors function is pure and also poses no risk. The getStorage function uses inline assembly to access storage; ensure the STORAGE_POSITION defined for PendingOwnerStorage is correctly managed and does not conflict with other storage slots within the diamond.