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";
|
2020-11-27 12:13:58 +08:00
|
|
|
|
import {IDODOApprove} from '../../intf/IDODOApprove.sol';
|
2020-11-24 17:25:10 +08:00
|
|
|
|
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
|
|
|
|
|
|
|
|
|
|
|
|
contract DPPAdmin is InitializableOwnable {
|
|
|
|
|
|
|
2020-11-26 13:35:22 +08:00
|
|
|
|
address public _DPP_;
|
|
|
|
|
|
address public _OPERATOR_;
|
2020-11-27 12:13:58 +08:00
|
|
|
|
address public _DODO_APPROVE_;
|
2020-11-24 17:25:10 +08:00
|
|
|
|
|
2020-11-27 12:13:58 +08:00
|
|
|
|
function init(address owner, address dpp,address operator, address dodoApprove) external {
|
2020-11-24 17:25:10 +08:00
|
|
|
|
initOwner(owner);
|
2020-11-26 13:35:22 +08:00
|
|
|
|
_DPP_ = dpp;
|
|
|
|
|
|
_OPERATOR_ = operator;
|
2020-11-27 12:13:58 +08:00
|
|
|
|
_DODO_APPROVE_ = dodoApprove;
|
2020-11-26 13:35:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setOperator(address newOperator) external onlyOwner {
|
|
|
|
|
|
_OPERATOR_ = newOperator;
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setLpFeeRateModel(address newLpFeeRateModel) external onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).setLpFeeRateModel(newLpFeeRateModel);
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setMtFeeRateModel(address newMtFeeRateModel) external onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).setMtFeeRateModel(newMtFeeRateModel);
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setTradePermissionManager(address newTradePermissionManager) external onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).setTradePermissionManager(newTradePermissionManager);
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setMaintainer(address newMaintainer) external onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).setMaintainer(newMaintainer);
|
2020-11-25 17:08:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-24 17:25:10 +08:00
|
|
|
|
function setGasPriceSource(address newGasPriceLimitSource) external onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).setGasPriceSource(newGasPriceLimitSource);
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setISource(address newISource) external onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).setISource(newISource);
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setKSource(address newKSource) external onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).setKSource(newKSource);
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setBuy(bool open) external onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).setBuy(open);
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setSell(bool open) external onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).setSell(open);
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|
2020-11-25 17:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
function retrieve(address payable to,address token,uint256 amount) external onlyOwner {
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).retrieve(to,token,amount);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function reset(
|
|
|
|
|
|
address assetTo,
|
|
|
|
|
|
uint256 newLpFeeRate,
|
|
|
|
|
|
uint256 newMtFeeRate,
|
|
|
|
|
|
uint256 newI,
|
|
|
|
|
|
uint256 newK,
|
|
|
|
|
|
uint256 baseOutAmount,
|
|
|
|
|
|
uint256 quoteOutAmount
|
|
|
|
|
|
) external {
|
2020-11-27 12:13:58 +08:00
|
|
|
|
require(msg.sender == _OWNER_ || (msg.sender == IDODOApprove(_DODO_APPROVE_).getDODOProxy() && assetTo == _OPERATOR_), "RESET FORBIDDEN!");
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).reset(
|
|
|
|
|
|
assetTo,
|
|
|
|
|
|
newLpFeeRate,
|
|
|
|
|
|
newMtFeeRate,
|
|
|
|
|
|
newI,
|
|
|
|
|
|
newK,
|
|
|
|
|
|
baseOutAmount,
|
|
|
|
|
|
quoteOutAmount
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function resetETH(
|
|
|
|
|
|
address from,
|
|
|
|
|
|
uint256 newLpFeeRate,
|
|
|
|
|
|
uint256 newMtFeeRate,
|
|
|
|
|
|
uint256 newI,
|
|
|
|
|
|
uint256 newK,
|
|
|
|
|
|
uint256 baseOutAmount,
|
|
|
|
|
|
uint256 quoteOutAmount
|
|
|
|
|
|
) external {
|
2020-11-27 12:13:58 +08:00
|
|
|
|
require(msg.sender == _OWNER_ || (msg.sender == IDODOApprove(_DODO_APPROVE_).getDODOProxy() && from == _OPERATOR_), "RESET FORBIDDEN!");
|
2020-11-26 13:35:22 +08:00
|
|
|
|
IDPP(_DPP_).reset(
|
|
|
|
|
|
msg.sender,
|
|
|
|
|
|
newLpFeeRate,
|
|
|
|
|
|
newMtFeeRate,
|
|
|
|
|
|
newI,
|
|
|
|
|
|
newK,
|
|
|
|
|
|
baseOutAmount,
|
|
|
|
|
|
quoteOutAmount
|
|
|
|
|
|
);
|
2020-11-25 17:08:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ============ Admin Version Control ============
|
|
|
|
|
|
function version() external pure returns (uint256) {
|
|
|
|
|
|
return 100; // 1.0.0
|
|
|
|
|
|
}
|
2020-11-24 17:25:10 +08:00
|
|
|
|
}
|