Owner Data Facet
@perfect-abstractions/compose/access/Owner/Data/OwnerDataFacet.solRead-only Owner data access for diamonds
Key Features
- Exposes the contract owner via external
owner(). - Shares
OwnerStorageaterc8042:erc173.ownerwithOwnerDataModand other Ownership facets. - Read-Only facet
Storage
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Owner storage position within the diamond (Value: keccak256("erc173.owner")) |
OwnerStorage
Functions
owner
Returns the address of the diamond owner
Returns:
| Property | Type | Description |
|---|---|---|
- | address | The current owner, or address(0) if unset or renounced. |
Best Practices
- Transfer ownership with a facet that uses
OwnerDataMod(for exampleOwnerTransferFacet) soowner()always reflects the real owner. - Avoid defining a second facet that writes to a different owner slot; keep all -owner state at
erc173.owner - Use
setContractOwner()inOwnerDataModto initialize the owner when constructing your diamond.
Last updated: