Owner Two Step Renounce Facet
Two-step ownership renouncement for diamonds
- Implements a two-step ownership renouncement process.
- Manages owner and pending owner state via diamond storage.
- Provides
exportSelectorsfor 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
PendingOwnerStorage
State Variables
| Property | Type | Description |
|---|---|---|
OWNER_STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("erc173.owner")) |
PENDING_OWNER_STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("erc173.owner.pending")) |
Functions
renounceOwnership
exportSelectors
Exports the function selectors of the OwnerTwoStepRenounceFacet This function is use as a selector discovery mechanism for diamonds
Returns:
| Property | Type | Description |
|---|---|---|
- | bytes | selectors The exported function selectors of the OwnerTwoStepRenounceFacet |
Events
Errors
Best Practices
- Ensure the
OwnerTwoStepRenounceFacetis correctly deployed and added to the diamond before calling its functions. - The
renounceOwnershipfunction should only be called by the current owner. - Use
exportSelectorsto programmatically discover the facet's supported functions.
Security Considerations
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.