remove constructor because using proxy mode clone
This commit is contained in:
48
contracts/lib/InitializableOwnable.sol
Normal file
48
contracts/lib/InitializableOwnable.sol
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
|
||||
Copyright 2020 DODO ZOO.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.6.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
/**
|
||||
* @title Ownable
|
||||
* @author DODO Breeder
|
||||
*
|
||||
* @notice Ownership related functions
|
||||
*/
|
||||
contract InitializableOwnable {
|
||||
address public _OWNER_;
|
||||
address public _NEW_OWNER_;
|
||||
|
||||
// ============ Events ============
|
||||
|
||||
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
|
||||
|
||||
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
||||
|
||||
// ============ Modifiers ============
|
||||
|
||||
modifier onlyOwner() {
|
||||
require(msg.sender == _OWNER_, "NOT_OWNER");
|
||||
_;
|
||||
}
|
||||
|
||||
// ============ Functions ============
|
||||
|
||||
function transferOwnership(address newOwner) external onlyOwner {
|
||||
require(newOwner != address(0), "INVALID_OWNER");
|
||||
emit OwnershipTransferPrepared(_OWNER_, newOwner);
|
||||
_NEW_OWNER_ = newOwner;
|
||||
}
|
||||
|
||||
function claimOwnership() external {
|
||||
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
|
||||
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
|
||||
_OWNER_ = _NEW_OWNER_;
|
||||
_NEW_OWNER_ = address(0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user