Skip to main content

Owner Two Step Transfer Facet

@perfect-abstractions/compose/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferFacet.sol

Two-step ownership transfer for your diamond

Key Features
  • Two-step handoff: the owner calls transferOwnership; the nominated address calls acceptOwnership to become owner.
  • Storage uses erc8042:erc173.owner and erc8042:erc173.owner.pending, shared with the two-step transfer module.

Storage

State Variables

PropertyTypeDescription
OWNER_STORAGE_POSITIONbytes32Owner storage position within the diamond (Value: keccak256("erc173.owner"))
PENDING_OWNER_STORAGE_POSITIONbytes32Pending owner storage position within the diamond (Value: keccak256("erc173.owner.pending"))

OwnerStorage

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

PendingOwnerStorage

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

Functions

transferOwnership

Callable only when msg.sender is the current owner. Sets pendingOwner to _newOwner and emits OwnershipTransferStarted(owner, _newOwner). The on-chain owner does not change until acceptOwnership is call.

function transferOwnership(address _newOwner) external;

Parameters:

PropertyTypeDescription
_newOwneraddressAddress that will become the new owner

acceptOwnership

Callable only when msg.sender is the pending owner. Assigns owner to the pending address, sets pendingOwner to address(0), and emits OwnershipTransferred(previousOwner, newOwner).

function acceptOwnership() external;

Events

Errors

Best Practices

  • Initialize OwnerStorage.owner during deployment before relying on owner behavior elsewhere.
  • After transferOwnership, ensure the nominated _newOwner can and will call acceptOwnership; until then, the previous owner remains owner.
Last updated:

Newsletter

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

No spam. Unsubscribe anytime.