Skip to main content

Owner Transfer Facet

@perfect-abstractions/compose/access/Owner/Transfer/OwnerTransferFacet.sol

Transfer your diamonds ownership

Key Features
  • transferOwnership writes into the OwnerStorage at erc8042:erc173.owner.
  • _newOwner may be address(0) to clear ownership. (Similar to renounceOwnership)
  • Transfers require the caller to be the curent owner

Storage

State Variables

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

OwnerStorage

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

Functions

transferOwnership

Change the contract ownership to the _newOwner address.

You can replicate the renouncement by setting the new owner to address(0). This action is irreversible.

function transferOwnership(address _newOwner) external;

Parameters:

PropertyTypeDescription_newOwneraddressThe next owner, or address(0) to clear ownership.

Events

Errors

Best Practices

Security Considerations

transferOwnership is restricted to the address currently stored as owner (msg.sender == s.owner). The facet does not implement any additional role system.

The main risks are social and operational: transferring to the wrong address, or setting _newOwner to address(0) when you did not intend to remove all owner control.

Last updated:

Newsletter

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

No spam. Unsubscribe anytime.