diff --git a/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol b/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol index 62361d024..f41b2845b 100644 --- a/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +++ b/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol @@ -2,11 +2,14 @@ pragma solidity ^0.8.4; /** - * @title Interface of the LSP14 - Ownable 2-step standard, an extension of the EIP173 (Ownable) standard with 2-step process to transfer or renounce ownership. + * @title Interface of the LSP14 - Ownable 2-step standard, an extension of the [EIP173] (Ownable) standard with 2-step process to transfer or renounce ownership. */ interface ILSP14Ownable2Step { /** - * @dev emitted when starting the `transferOwnership(..)` 2-step process. + * @dev Emitted when {transferOwnership(..)} was called and the first step of transferring ownership completed successfully which leads to {pendingOwner} being updated. + * @notice The transfer of ownership of the contract was initiated. Pending new owner set to: `newOwner`. + * @param previousOwner The address of the previous owner. + * @param newOwner The address of the new owner. */ event OwnershipTransferStarted( address indexed previousOwner, @@ -19,59 +22,57 @@ interface ILSP14Ownable2Step { */ /** - * @dev emitted when starting the `renounceOwnership(..)` 2-step process. + * @dev Emitted when starting the {renounceOwnership(..)} 2-step process. + * @notice Ownership renouncement initiated. */ event RenounceOwnershipStarted(); /** - * @dev emitted when the ownership of the contract has been renounced. + * @dev Emitted when the ownership of the contract has been renounced. + * @notice Successfully renounced ownership of the contract. This contract is now owned by anyone, it's owner is `address(0)`. */ event OwnershipRenounced(); /** * @inheritdoc OwnableUnset - * function owner() external view returns (address); + * function {owner()} external view returns (address); */ /** * @dev The address that ownership of the contract is transferred to. * This address may use {acceptOwnership()} to gain ownership of the contract. - * - * @custom:info If no ownership transfer is in progress, the pendingOwner will be `address(0)`. */ function pendingOwner() external view returns (address); /** * @dev Initiate the process of transferring ownership of the contract by setting the new owner as the pending owner. * - * If the new owner is a contract that supports + implements LSP1, this will also attempt to notify the new owner that - * ownership has been transferred to them by calling the {`universalReceiver()`} function on the `newOwner` contract. + * If the new owner is a contract that supports + implements LSP1, this will also attempt to notify the new owner that ownership has been transferred to them by calling the {universalReceiver()} function on the `newOwner` contract. * - * @param newOwner the address of the new owner. + * @notice Transfer ownership initiated by `newOwner`. * - * @custom:requirements `newOwner` MUST NOT accept ownership of the contract in the same transaction. + * @param newOwner The address of the new owner. */ function transferOwnership(address newOwner) external; /** - * @dev Transfer ownership of the contract from the current {`owner()`} to the {`pendingOwner()`}. + * @dev Transfer ownership of the contract from the current {owner()} to the {pendingOwner()}. * * Once this function is called: - * - the current {`owner()`} will loose access to the functions restricted to the {`owner()`} only. - * - the {`pendingOwner()`} will gain access to the functions restricted to the {`owner()`} only. + * - The current {owner()} will loose access to the functions restricted to the {owner()} only. + * - The {pendingOwner()} will gain access to the functions restricted to the {owner()} only. * - * @custom:requirements - * - MUST be called by the {`pendingOwner`}. + * @notice `msg.sender` is accepting ownership of contract: `address(this)`. */ function acceptOwnership() external; /** - * @dev Renounce ownership of the contract in a two step process. + * @dev Renounce ownership of the contract in a 2-step process. * - * 1. the first call will initiate the process of renouncing ownership. - * 2. the second is used as a confirmation and will leave the contract without an owner. + * 1. The first call will initiate the process of renouncing ownership. + * 2. The second call is used as a confirmation and will leave the contract without an owner. * - * @custom:danger Leaves the contract without an owner. Once ownership of the contract has been renounced, any functions that are restricted to be called by the owner will be permanently inaccessible, making these functions not callable anymore and unusable. + * @notice `msg.sender` is renouncing ownership of contract `address(this)`. */ function renounceOwnership() external; } diff --git a/contracts/LSP14Ownable2Step/LSP14Errors.sol b/contracts/LSP14Ownable2Step/LSP14Errors.sol index 4f6333dd4..45c8526c5 100644 --- a/contracts/LSP14Ownable2Step/LSP14Errors.sol +++ b/contracts/LSP14Ownable2Step/LSP14Errors.sol @@ -2,7 +2,11 @@ pragma solidity ^0.8.4; /** - * @dev reverts when trying to renounce ownership before the initial confirmation delay + * @dev Reverts when trying to renounce ownership before the initial confirmation delay. + * @notice Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`. + * + * @param renounceOwnershipStart The start timestamp when one can confirm the renouncement of ownership. + * @param renounceOwnershipEnd The end timestamp when one can confirm the renouncement of ownership. */ error NotInRenounceOwnershipInterval( uint256 renounceOwnershipStart, @@ -10,11 +14,13 @@ error NotInRenounceOwnershipInterval( ); /** - * @dev reverts when trying to transfer ownership to the address(this) + * @dev Reverts when trying to transfer ownership to the `address(this)`. + * @notice Cannot transfer ownership to the address of the contract itself. */ error CannotTransferOwnershipToSelf(); /** - * @dev reverts when pending owner accept ownership in the same transaction of transferring ownership + * @dev Reverts when pending owner accept ownership in the same transaction of transferring ownership. + * @notice Cannot accept ownership in the same transaction with {transferOwnership(...)}. */ error LSP14MustAcceptOwnershipInSeparateTransaction(); diff --git a/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol b/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol index 4bfdaeb2f..3a798e092 100644 --- a/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +++ b/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol @@ -25,31 +25,30 @@ import { /** * @title LSP14Ownable2Step * @author Fabian Vogelsteller , Jean Cavallera (CJ42), Yamen Merhi (YamenMerhi), Daniel Afteni (B00ste) - * @dev This contract is a modified version of the OwnableUnset implementation, where transferring and renouncing ownership - * works as a 2 steps process. This can be used as a confirmation mechanism to prevent potential mistakes when - * transferring ownership of the contract, where the control of the contract could be lost forever. + * @dev This contract is a modified version of the [`OwnableUnset.sol`] implementation, where transferring and renouncing ownership works as a 2-step process. This can be used as a confirmation mechanism to prevent potential mistakes when transferring ownership of the contract, where the control of the contract could be lost forever. (_e.g: providing the wrong address as a parameter to the function, transferring ownership to an EOA for which the user lost its private key, etc..._) */ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset { using LSP1Utils for address; /** - * @dev The number of block that MUST pass before one is able to - * confirm renouncing ownership + * @dev The number of block that MUST pass before one is able to confirm renouncing ownership. + * @return Number of blocks. */ uint256 public constant RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY = 200; /** - * @dev The number of blocks during which one can renounce ownership + * @dev The number of blocks during which one can renounce ownership. + * @return Number of blocks. */ uint256 public constant RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD = 200; /** - * @dev The block number saved when initiating the process of renouncing ownerhsip + * @dev The block number saved when initiating the process of renouncing ownerhsip. */ uint256 private _renounceOwnershipStartedAt; /** - * @dev see `pendingOwner()` + * @dev see {pendingOwner()} */ address private _pendingOwner; @@ -70,6 +69,8 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset { /** * @inheritdoc ILSP14Ownable2Step + * + * @custom:info If no ownership transfer is in progress, the pendingOwner will be `address(0).`. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; @@ -77,6 +78,8 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset { /** * @inheritdoc ILSP14Ownable2Step + * + * @custom:requirements `newOwner` cannot accept ownership of the contract in the same transaction. (For instance, via a callback from its {universalReceiver(...)} function). */ function transferOwnership( address newOwner @@ -100,6 +103,8 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset { /** * @inheritdoc ILSP14Ownable2Step + * + * @custom:requirements This function can only be called by the {pendingOwner()}. */ function acceptOwnership() public virtual NotInTransferOwnership { address previousOwner = owner(); @@ -119,6 +124,8 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset { /** * @inheritdoc ILSP14Ownable2Step + * + * @custom:danger Leaves the contract without an owner. Once ownership of the contract has been renounced, any function that is restricted to be called only by the owner will be permanently inaccessible, making these functions not callable anymore and unusable. */ function renounceOwnership() public @@ -132,13 +139,11 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset { // --- Internal methods /** - * @dev set the pending owner of the contract and cancel any renounce ownership - * process that was previously started. + * @dev Set the pending owner of the contract and cancel any renounce ownership process that was previously started. * * @param newOwner The address of the new pending owner. * - * Requirements: - * - `newOwner` cannot be the address of the contract itself. + * @custom:requirements `newOwner` cannot be the address of the contract itself. */ function _transferOwnership(address newOwner) internal virtual { if (newOwner == address(this)) revert CannotTransferOwnershipToSelf(); @@ -148,7 +153,7 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset { } /** - * @dev set the pending owner of the contract as the new owner. + * @dev Set the pending owner of the contract as the new owner. */ function _acceptOwnership() internal virtual { require( @@ -161,8 +166,7 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset { } /** - * @dev initiate or confirm the process of renouncing ownership - * after a specific delay of blocks have passed. + * @dev Initiate or confirm the process of renouncing ownership after a specific delay of blocks have passed. */ function _renounceOwnership() internal virtual { uint256 currentBlock = block.number; diff --git a/docs/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md b/docs/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md new file mode 100644 index 000000000..a6e0464f0 --- /dev/null +++ b/docs/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md @@ -0,0 +1,477 @@ + + + +# LSP14Ownable2Step + +:::info Standard Specifications + +[`LSP-14-Ownable2Step`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md) + +::: +:::info Solidity implementation + +[`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) + +::: + +> LSP14Ownable2Step + +This contract is a modified version of the [`OwnableUnset.sol`] implementation, where transferring and renouncing ownership works as a 2-step process. This can be used as a confirmation mechanism to prevent potential mistakes when transferring ownership of the contract, where the control of the contract could be lost forever. (_e.g: providing the wrong address as a parameter to the function, transferring ownership to an EOA for which the user lost its private key, etc..._) + +## Public Methods + +Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. +When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally. + +### RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#renounce_ownership_confirmation_delay) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY()` +- Function selector: `0xead3fbdf` + +::: + +```solidity +function RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY() + external + view + returns (uint256); +``` + +The number of block that MUST pass before one is able to confirm renouncing ownership. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------- | +| `0` | `uint256` | Number of blocks. | + +
+ +### RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#renounce_ownership_confirmation_period) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD()` +- Function selector: `0x01bfba61` + +::: + +```solidity +function RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD() + external + view + returns (uint256); +``` + +The number of blocks during which one can renounce ownership. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------- | +| `0` | `uint256` | Number of blocks. | + +
+ +### acceptOwnership + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#acceptownership) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Function signature: `acceptOwnership()` +- Function selector: `0x79ba5097` + +::: + +```solidity +function acceptOwnership() external nonpayable; +``` + +_`msg.sender` is accepting ownership of contract: `address(this)`._ + +Transfer ownership of the contract from the current [`owner()`](#owner) to the [`pendingOwner()`](#pendingowner). Once this function is called: + +- The current [`owner()`](#owner) will loose access to the functions restricted to the [`owner()`](#owner) only. + +- The [`pendingOwner()`](#pendingowner) will gain access to the functions restricted to the [`owner()`](#owner) only. + +
+ +**Requirements:** + +- This function can only be called by the [`pendingOwner()`](#pendingowner). + +
+ +
+ +### owner + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#owner) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### pendingOwner + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#pendingowner) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Function signature: `pendingOwner()` +- Function selector: `0xe30c3978` + +::: + +:::info + +If no ownership transfer is in progress, the pendingOwner will be `address(0).`. + +::: + +```solidity +function pendingOwner() external view returns (address); +``` + +The address that ownership of the contract is transferred to. This address may use [`acceptOwnership()`](#acceptownership) to gain ownership of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### renounceOwnership + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#renounceownership) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +:::danger + +Leaves the contract without an owner. Once ownership of the contract has been renounced, any function that is restricted to be called only by the owner will be permanently inaccessible, making these functions not callable anymore and unusable. + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +_`msg.sender` is renouncing ownership of contract `address(this)`._ + +Renounce ownership of the contract in a 2-step process. + +1. The first call will initiate the process of renouncing ownership. + +2. The second call is used as a confirmation and will leave the contract without an owner. + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#transferownership) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +_Transfer ownership initiated by `newOwner`._ + +Initiate the process of transferring ownership of the contract by setting the new owner as the pending owner. If the new owner is a contract that supports + implements LSP1, this will also attempt to notify the new owner that ownership has been transferred to them by calling the [`universalReceiver()`](#universalreceiver) function on the `newOwner` contract. + +
+ +**Requirements:** + +- `newOwner` cannot accept ownership of the contract in the same transaction. (For instance, via a callback from its [`universalReceiver(...)`](#universalreceiver) function). + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------------------------- | +| `newOwner` | `address` | The address of the new owner. | + +
+ +## Internal Methods + +Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. + +Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities. + +### \_checkOwner + +```solidity +function _checkOwner() internal view; +``` + +Throws if the sender is not the owner. + +
+ +### \_setOwner + +```solidity +function _setOwner(address newOwner) internal nonpayable; +``` + +Changes the owner if `newOwner` and oldOwner are different +This pattern is useful in inheritance. + +
+ +### \_transferOwnership + +```solidity +function _transferOwnership(address newOwner) internal nonpayable; +``` + +Set the pending owner of the contract and cancel any renounce ownership process that was previously started. + +
+ +**Requirements:** + +- `newOwner` cannot be the address of the contract itself. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `newOwner` | `address` | The address of the new pending owner. | + +
+ +### \_acceptOwnership + +```solidity +function _acceptOwnership() internal nonpayable; +``` + +Set the pending owner of the contract as the new owner. + +
+ +### \_renounceOwnership + +```solidity +function _renounceOwnership() internal nonpayable; +``` + +Initiate or confirm the process of renouncing ownership after a specific delay of blocks have passed. + +
+ +## Events + +### OwnershipRenounced + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#ownershiprenounced) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Event signature: `OwnershipRenounced()` +- Event topic hash: `0xd1f66c3d2bc1993a86be5e3d33709d98f0442381befcedd29f578b9b2506b1ce` + +::: + +```solidity +event OwnershipRenounced(); +``` + +_Successfully renounced ownership of the contract. This contract is now owned by anyone, it's owner is `address(0)`._ + +Emitted when the ownership of the contract has been renounced. + +
+ +### OwnershipTransferStarted + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#ownershiptransferstarted) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Event signature: `OwnershipTransferStarted(address,address)` +- Event topic hash: `0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700` + +::: + +```solidity +event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); +``` + +_The transfer of ownership of the contract was initiated. Pending new owner set to: `newOwner`._ + +Emitted when [`transferOwnership(..)`](#transferownership) was called and the first step of transferring ownership completed successfully which leads to [`pendingOwner`](#pendingowner) being updated. + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ---------------------------------- | +| `previousOwner` **`indexed`** | `address` | The address of the previous owner. | +| `newOwner` **`indexed`** | `address` | The address of the new owner. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#ownershiptransferred) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Event signature: `OwnershipTransferred(address,address)` +- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +
+ +### RenounceOwnershipStarted + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#renounceownershipstarted) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Event signature: `RenounceOwnershipStarted()` +- Event topic hash: `0x81b7f830f1f0084db6497c486cbe6974c86488dcc4e3738eab94ab6d6b1653e7` + +::: + +```solidity +event RenounceOwnershipStarted(); +``` + +_Ownership renouncement initiated._ + +Emitted when starting the [`renounceOwnership(..)`](#renounceownership) 2-step process. + +
+ +## Errors + +### CannotTransferOwnershipToSelf + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#cannottransferownershiptoself) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Error signature: `CannotTransferOwnershipToSelf()` +- Error hash: `0x43b248cd` + +::: + +```solidity +error CannotTransferOwnershipToSelf(); +``` + +_Cannot transfer ownership to the address of the contract itself._ + +Reverts when trying to transfer ownership to the `address(this)`. + +
+ +### LSP14MustAcceptOwnershipInSeparateTransaction + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#lsp14mustacceptownershipinseparatetransaction) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Error signature: `LSP14MustAcceptOwnershipInSeparateTransaction()` +- Error hash: `0x5758dd07` + +::: + +```solidity +error LSP14MustAcceptOwnershipInSeparateTransaction(); +``` + +_Cannot accept ownership in the same transaction with [`transferOwnership(...)`](#transferownership)._ + +Reverts when pending owner accept ownership in the same transaction of transferring ownership. + +
+ +### NotInRenounceOwnershipInterval + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#notinrenounceownershipinterval) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Error signature: `NotInRenounceOwnershipInterval(uint256,uint256)` +- Error hash: `0x8b9bf507` + +::: + +```solidity +error NotInRenounceOwnershipInterval( + uint256 renounceOwnershipStart, + uint256 renounceOwnershipEnd +); +``` + +_Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`._ + +Reverts when trying to renounce ownership before the initial confirmation delay. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ----------------------------------------------------------------------- | +| `renounceOwnershipStart` | `uint256` | The start timestamp when one can confirm the renouncement of ownership. | +| `renounceOwnershipEnd` | `uint256` | The end timestamp when one can confirm the renouncement of ownership. | + +