Owner Transfer Module
@perfect-abstractions/compose/access/Owner/Transfer/OwnerTransferMod.solHelper functions for ownership transfer and storage access.
transferOwnershipguards by requiringmsg.senderis the current owner.- Emits
OwnershipTransferredon successful transfers.
Use helper functions from Compose using your own custom facets. See Facets & Modules for more information.
Storage
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Owner storage position within the diamond (Value: keccak256("erc173.owner")) |
OwnerStorage
Functions
getStorage
Returns a pointer to the OwnerStorage struct.
Returns:
| Property | Type | Description |
|---|---|---|
s | OwnerStorage storage | The struct in storage. |
transferOwnership
Transfer the diamond ownership from the current owner to the next one. Caller must be the current owner.
_newOwner may be address(0) to clear ownership (same storage effect as renounceOwnership() in OwnerRenounceMod).
Parameters:
| Property | Type | Description |
|---|---|---|
_newOwner | address | Next owner, or address(0) to clear ownership. |
Events
Errors
Best Practices
- Call
transferOwnershiponly from trustedexternalwrappers; confirm_newOwnerbefore sending a transaction. - Keep the same
STORAGE_POSITIONandOwnerStoragelayout as other owner modules; do not introduce a second owner slot. - If you want a dedicated renounce entrypoint in Solidity, prefer
OwnerRenounceModor passaddress(0)here. Both target the same storage field.
Integration Notes
OwnerStorage lives at keccak256("erc173.owner") inside the diamond. The same slot as OwnerDataMod, OwnerTransferFacet, and related owner code. Transferring here updates what owner() reads on OwnerDataFacet.