Owner Two Step Transfer Facet
Two-step ERC-173 ownership transfer for Compose diamonds
Key Features
- Two-step handoff: the owner calls
transferOwnership; the nominated address callsacceptOwnershipto become owner. - Storage uses
erc8042:erc173.owneranderc8042:erc173.owner.pending, shared with the two-step transfer module.
Storage
State Variables
| Property | Type | Description |
|---|---|---|
OWNER_STORAGE_POSITION | bytes32 | Owner storage position within the diamond (Value: keccak256("erc173.owner")) |
PENDING_OWNER_STORAGE_POSITION | bytes32 | Pending owner storage position within the diamond (Value: keccak256("erc173.owner.pending")) |
OwnerStorage
PendingOwnerStorage
Functions
transferOwnership
Callable only when msg.sender is the current owner; otherwise reverts OwnerUnauthorizedAccount. Sets pendingOwner to _newOwner and emits OwnershipTransferStarted(owner, _newOwner). The on-chain owner does not change until acceptOwnership.
Parameters:
| Property | Type | Description |
|---|---|---|
_newOwner | address | Address that will become owner after a successful acceptOwnership from that address. |
acceptOwnership
Callable only when msg.sender is the pending owner; otherwise reverts OwnerUnauthorizedAccount. Assigns owner to the pending address, sets pendingOwner to address(0), and emits OwnershipTransferred(previousOwner, newOwner).
Events
Errors
Best Practices
- Initialize
OwnerStorage.ownerduring deployment before relying on owner-only behavior elsewhere. - After
transferOwnership, ensure the nominated_newOwnercan and will callacceptOwnership; until then, the previous owner remains owner.
Was this helpful?
Last updated: