Skip to main content

Owner Data Facet

Manages owner address and facet selectors

Key Features
  • Exposes owner address via an external owner() function.
  • Provides exportSelectors() for facet function discovery.
  • Utilizes diamond storage for owner data.
  • Compliant with ERC-2535 diamond standard.

Overview

This facet provides external access to the owner's address and exposes its own function selectors. It interacts with diamond storage to retrieve owner information and uses the diamond pattern for selector discovery. Developers add this facet to expose owner management and facilitate diamond upgrades.

Storage

OwnerStorage

Definition
struct OwnerStorage {
address owner;
}

State Variables

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

Functions

owner

Get the address of the owner

function owner() external view returns (address);

Returns:

PropertyTypeDescription
-addressThe address of the owner.

exportSelectors

Exports the function selectors of the OwnerDataFacet This function is use as a selector discovery mechanism for diamonds

function exportSelectors() external pure returns (bytes memory);

Returns:

PropertyTypeDescription
-bytesselectors The exported function selectors of the OwnerDataFacet

Best Practices

Best Practice
  • Ensure the OwnerDataFacet is correctly initialized with an owner address during diamond deployment.
  • Access owner information only through the diamond proxy to maintain upgradeability.
  • Use exportSelectors to discover facet functions for integration or upgrade processes.

Security Considerations

Security

The owner() function is a view function and does not modify state. The exportSelectors() function is pure and does not access state. Access control to these functions is managed by the diamond proxy itself. Follow standard Solidity security practices.

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.