Owner Two Step Transfer Module
@perfect-abstractions/compose/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferMod.solHelpers for the two step handoff ownership for your diamonds
- Two-step handoff: current owner calls
transferOwnership; the nominated address callsacceptOwnershipto finalize (unlike single-stepOwnerTransferMod). - Uses same layout as Owner Two Step Transfer Facet.
Helpers modules for composing the library logic into your own facets. See Facets & Modules for more information.
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
getOwnerStorage
Returns a storage pointer to OwnerStorage.
Returns:
| Property | Type | Description |
|---|---|---|
s | OwnerStorage storage | The owner struct in diamond storage. |
getPendingOwnerStorage
Returns a storage pointer to PendingOwnerStorage.
Returns:
| Property | Type | Description |
|---|---|---|
s | PendingOwnerStorage storage | The pending-owner struct in diamond storage. |
transferOwnership
Requires msg.sender == owner; otherwise reverts OwnerUnauthorizedAccount. Sets pendingOwner to _newOwner and emits OwnershipTransferStarted(owner, _newOwner). Does not change owner until acceptOwnership.
Parameters:
| Property | Type | Description |
|---|---|---|
_newOwner | address | Address that must call acceptOwnership to become owner. |
acceptOwnership
Requires msg.sender == pendingOwner; otherwise reverts OwnerUnauthorizedAccount. Assigns owner to the pending address, clears pendingOwner, and emits OwnershipTransferred(previousOwner, newOwner).
Events
Errors
Best Practices
- Expose
transferOwnershipandacceptOwnershiponly through trustedexternalfacet entrypoints; confirm_newOwnerbefore initiating. - Keep the same
OwnerStorage/PendingOwnerStoragelayout as Owner Two Step Transfer Facet and Owner Two Step Data Module owneris shared withOwnerDataModand single-step owner code atkeccak256("erc173.owner").