Skip to main content

Owner Data Module

@perfect-abstractions/compose/access/Owner/Data/OwnerDataMod.sol

Helper functions for owner storage, reads, and owner check based on ERC-173

Storage​

State Variables​

PropertyTypeDescriptionSTORAGE_POSITIONbytes32Owner storage position within the diamond (Value: keccak256("erc173.owner"))

OwnerStorage​

Definition
/** storage-location: erc8042:erc173.owner */
struct OwnerStorage {
address owner;
}

Functions​

getStorage​

Returns a pointer to the OwnerStorage struct.

function getStorage() pure returns (OwnerStorage storage s);

Returns:

PropertyTypeDescriptionsOwnerStorage storageThe struct in storage.

owner​

Get the address of the owner

function owner() view returns (address);

Returns:

PropertyTypeDescription-addressThe stored owner, or address(0) if never set or cleared.

requireOwner​

Verify if the message sender is the current diamond owner. Useful for gating specify logic inside your own facets.

function requireOwner() view;

Reverts:

PropertyTypeDescriptionOwnerUnauthorizedAccounterrorCaller is not the current owner.

setContractOwner​

Writes the inital owner address to storage and emits OwnershipTransferred(address(0), _initialOwner).

There is no msg.sender or role check performed. Use only from trusted initialization code, or wrap with your own checks in a facet.

function setContractOwner(address _initialOwner);

Parameters:

PropertyTypeDescription_initialOwneraddressThe address of the initial owner.

Events​

Errors​

Best Practices​

Integration Notes​

OwnerStorage is located at keccak256("erc173.owner") inside the diamond.

All Compose Owner contracts use that slot, so owner() and transfer logic observe the same address.

Last updated:

Newsletter

Get notified about releases, feature announcements, and technical deep-dives on building smart contracts with Compose.

No spam. Unsubscribe anytime.