restruct contract repo
This commit is contained in:
@@ -17,6 +17,7 @@ pragma experimental ABIEncoderV2;
|
||||
contract InitializableOwnable {
|
||||
address public _OWNER_;
|
||||
address public _NEW_OWNER_;
|
||||
bool internal _INITIALIZED_;
|
||||
|
||||
// ============ Events ============
|
||||
|
||||
@@ -26,6 +27,11 @@ contract InitializableOwnable {
|
||||
|
||||
// ============ Modifiers ============
|
||||
|
||||
modifier notInitialized() {
|
||||
require(!_INITIALIZED_, "DODO_INITIALIZED");
|
||||
_;
|
||||
}
|
||||
|
||||
modifier onlyOwner() {
|
||||
require(msg.sender == _OWNER_, "NOT_OWNER");
|
||||
_;
|
||||
@@ -33,13 +39,18 @@ contract InitializableOwnable {
|
||||
|
||||
// ============ Functions ============
|
||||
|
||||
function transferOwnership(address newOwner) external onlyOwner {
|
||||
function initOwner(address newOwner) public notInitialized{
|
||||
_INITIALIZED_ = true;
|
||||
_OWNER_ = newOwner;
|
||||
}
|
||||
|
||||
function transferOwnership(address newOwner) public onlyOwner {
|
||||
require(newOwner != address(0), "INVALID_OWNER");
|
||||
emit OwnershipTransferPrepared(_OWNER_, newOwner);
|
||||
_NEW_OWNER_ = newOwner;
|
||||
}
|
||||
|
||||
function claimOwnership() external {
|
||||
function claimOwnership() public {
|
||||
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
|
||||
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
|
||||
_OWNER_ = _NEW_OWNER_;
|
||||
|
||||
Reference in New Issue
Block a user