remove constructor because using proxy mode clone
This commit is contained in:
@@ -33,10 +33,14 @@ contract DODO is Admin, Trader, LiquidityProvider {
|
||||
uint256 mtFeeRate,
|
||||
uint256 k,
|
||||
uint256 gasPriceLimit
|
||||
) external onlyOwner preventReentrant {
|
||||
) external {
|
||||
require(!_INITIALIZED_, "DODO_INITIALIZED");
|
||||
_INITIALIZED_ = true;
|
||||
|
||||
// constructor
|
||||
_OWNER_ = msg.sender;
|
||||
emit OwnershipTransferred(address(0), _OWNER_);
|
||||
|
||||
_SUPERVISOR_ = supervisor;
|
||||
_MAINTAINER_ = maintainer;
|
||||
_BASE_TOKEN_ = baseToken;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
pragma solidity 0.6.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {Ownable} from "../lib/Ownable.sol";
|
||||
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
|
||||
import {SafeMath} from "../lib/SafeMath.sol";
|
||||
import {DecimalMath} from "../lib/DecimalMath.sol";
|
||||
import {ReentrancyGuard} from "../lib/ReentrancyGuard.sol";
|
||||
@@ -22,7 +22,7 @@ import {Types} from "../lib/Types.sol";
|
||||
*
|
||||
* @notice Local Variables
|
||||
*/
|
||||
contract Storage is Ownable, ReentrancyGuard {
|
||||
contract Storage is InitializableOwnable, ReentrancyGuard {
|
||||
using SafeMath for uint256;
|
||||
|
||||
// ============ Variables for Control ============
|
||||
|
||||
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