2020-11-24 17:25:10 +08:00
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
Copyright 2020 DODO ZOO.
|
|
|
|
|
|
SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity 0.6.9;
|
|
|
|
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
|
|
|
|
|
|
|
|
import {IDPP} from "../intf/IDPP.sol";
|
2021-01-26 17:53:49 +08:00
|
|
|
|
import {IDODOApproveProxy} from "../../SmartRoute/DODOApproveProxy.sol";
|
2020-11-24 17:25:10 +08:00
|
|
|
|
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
|
|
|
|
|
|
|
2021-01-08 17:19:23 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @title DPPAdmin
|
|
|
|
|
|
* @author DODO Breeder
|
|
|
|
|
|
*
|
|
|
|
|
|
* @notice Admin of DODOPrivatePool
|
|
|
|
|
|
*/
|
2020-11-24 17:25:10 +08:00
|
|
|
|
contract DPPAdmin is InitializableOwnable {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
address public _DPP_;
|
2020-11-28 17:44:39 +08:00
|
|
|
|
address public _OPERATOR_;
|
2021-01-26 17:53:49 +08:00
|
|
|
|
address public _DODO_APPROVE_PROXY_;
|
2020-12-10 20:27:36 +08:00
|
|
|
|
uint256 public _FREEZE_TIMESTAMP_;
|
|
|
|
|
|
|
2021-01-08 17:19:23 +08:00
|
|
|
|
|
2020-12-10 20:27:36 +08:00
|
|
|
|
modifier notFreezed() {
|
|
|
|
|
|
require(block.timestamp >= _FREEZE_TIMESTAMP_, "ADMIN_FREEZED");
|
|
|
|
|
|
_;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-28 17:44:39 +08:00
|
|
|
|
function init(
|
|
|
|
|
|
address owner,
|
|
|
|
|
|
address dpp,
|
|
|
|
|
|
address operator,
|
2021-01-26 17:53:49 +08:00
|
|
|
|
address dodoApproveProxy
|
2020-11-28 17:44:39 +08:00
|
|
|
|
) external {
|
2020-11-24 17:25:10 +08:00
|
|
|
|
initOwner(owner);
|
2020-11-26 13:35:22 +08:00
|
|
|
|
_DPP_ = dpp;
|
|
|
|
|
|
_OPERATOR_ = operator;
|
2021-01-26 17:53:49 +08:00
|
|
|
|
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
|
2020-11-26 13:35:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-12-18 21:33:40 +08:00
|
|
|
|
function sync() external notFreezed onlyOwner {
|
2020-12-21 23:16:55 +08:00
|
|
|
|
IDPP(_DPP_).ratioSync();
|
2020-12-18 21:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-12-10 20:27:36 +08:00
|
|
|
|
function setFreezeTimestamp(uint256 timestamp) external notFreezed onlyOwner {
|
|
|
|
|
|
_FREEZE_TIMESTAMP_ = timestamp;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-12-10 20:29:11 +08:00
|
|
|
|
function setOperator(address newOperator) external notFreezed onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
_OPERATOR_ = newOperator;
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-28 17:44:39 +08:00
|
|
|
|
function retrieve(
|
|
|
|
|
|
address payable to,
|
|
|
|
|
|
address token,
|
|
|
|
|
|
uint256 amount
|
2020-12-10 20:29:11 +08:00
|
|
|
|
) external notFreezed onlyOwner {
|
2020-11-28 17:44:39 +08:00
|
|
|
|
IDPP(_DPP_).retrieve(to, token, amount);
|
2020-11-26 13:35:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function reset(
|
2020-11-28 17:44:39 +08:00
|
|
|
|
address operator,
|
2020-11-26 13:35:22 +08:00
|
|
|
|
uint256 newLpFeeRate,
|
|
|
|
|
|
uint256 newI,
|
|
|
|
|
|
uint256 newK,
|
|
|
|
|
|
uint256 baseOutAmount,
|
2020-12-18 11:27:45 +08:00
|
|
|
|
uint256 quoteOutAmount,
|
|
|
|
|
|
uint256 minBaseReserve,
|
|
|
|
|
|
uint256 minQuoteReserve
|
|
|
|
|
|
) external notFreezed returns (bool) {
|
2020-11-28 17:44:39 +08:00
|
|
|
|
require(
|
|
|
|
|
|
msg.sender == _OWNER_ ||
|
2021-01-26 17:53:49 +08:00
|
|
|
|
(IDODOApproveProxy(_DODO_APPROVE_PROXY_).isAllowedProxy(msg.sender) &&
|
2020-11-28 17:44:39 +08:00
|
|
|
|
operator == _OPERATOR_),
|
|
|
|
|
|
"RESET FORBIDDEN!"
|
2020-11-26 13:35:22 +08:00
|
|
|
|
);
|
2020-12-21 23:16:55 +08:00
|
|
|
|
return
|
|
|
|
|
|
IDPP(_DPP_).reset(
|
|
|
|
|
|
msg.sender,
|
|
|
|
|
|
newLpFeeRate,
|
|
|
|
|
|
newI,
|
|
|
|
|
|
newK,
|
|
|
|
|
|
baseOutAmount,
|
|
|
|
|
|
quoteOutAmount,
|
|
|
|
|
|
minBaseReserve,
|
|
|
|
|
|
minQuoteReserve
|
|
|
|
|
|
);
|
2020-11-25 17:08:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ============ Admin Version Control ============
|
2020-11-30 09:59:01 +08:00
|
|
|
|
|
|
|
|
|
|
function version() external pure returns (string memory) {
|
|
|
|
|
|
return "DPPAdmin 1.0.0"; // 1.0.0
|
2020-11-25 17:08:28 +08:00
|
|
|
|
}
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|