-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: [hexsen-s3] update PoolManagerOwner to support 2 step poolM…
…anager ownership transfer
- Loading branch information
1 parent
60db3ff
commit b4bc2a0
Showing
6 changed files
with
147 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
// Copyright (C) 2024 PancakeSwap | ||
pragma solidity 0.8.26; | ||
|
||
import {IPoolManagerOwner} from "../interfaces/IPoolManagerOwner.sol"; | ||
|
||
/** | ||
* @notice dev This contract implements "Ownable2Step styled" poolManager ownership transfer | ||
* functionality. Namely an extra acceptance step is added to the ownership transfer process. | ||
* This is done to prevent accidental ownership transfer to a wrong address. | ||
*/ | ||
abstract contract PoolManagerOwnable2Step is IPoolManagerOwner { | ||
error NotPendingPoolManagerOwner(); | ||
|
||
address private _pendingPoolManagerOwner; | ||
|
||
modifier isFromPendingPoolManagerOwner() { | ||
if (_pendingPoolManagerOwner != msg.sender) { | ||
revert NotPendingPoolManagerOwner(); | ||
} | ||
|
||
_; | ||
} | ||
|
||
function _transferPoolManagerOwnership(address newPoolManagerOwner) internal { | ||
_pendingPoolManagerOwner = newPoolManagerOwner; | ||
} | ||
|
||
/// @inheritdoc IPoolManagerOwner | ||
function pendingPoolManagerOwner() public view override returns (address) { | ||
return _pendingPoolManagerOwner; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters