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

PropertyTypeDescriptionOWNER_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

Last updated:

Newsletter

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

No spam. Unsubscribe anytime.