add dvm && dpp admin control

This commit is contained in:
owen05
2020-11-24 17:25:10 +08:00
parent 5e6db3e4b6
commit 8a4da4b525
17 changed files with 253 additions and 41 deletions

View File

@@ -15,7 +15,6 @@ import {IERC20} from "../../intf/IERC20.sol";
import {DPPTrader} from "./DPPTrader.sol";
contract DPP is DPPTrader {
constructor() public {
_FACTORY_ = msg.sender;
}
@@ -34,6 +33,7 @@ contract DPP is DPPTrader {
) external {
require(msg.sender == _FACTORY_, 'INIT FORBIDDEN');
initOwner(owner);
_ADMIN_ = owner;
_MAINTAINER_ = maintainer;
_BASE_TOKEN_ = IERC20(baseTokenAddress);
_QUOTE_TOKEN_ = IERC20(quoteTokenAddress);

View File

@@ -0,0 +1,58 @@
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IDPP} from "../intf/IDPP.sol";
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
contract DPPAdmin is InitializableOwnable {
address public dpp;
function init(address owner, address _dpp) external {
initOwner(owner);
dpp = _dpp;
}
function setLpFeeRateModel(address newLpFeeRateModel) external onlyOwner {
IDPP(dpp).setLpFeeRateModel(newLpFeeRateModel);
}
function setMtFeeRateModel(address newMtFeeRateModel) external onlyOwner {
IDPP(dpp).setMtFeeRateModel(newMtFeeRateModel);
}
function setTradePermissionManager(address newTradePermissionManager) external onlyOwner {
IDPP(dpp).setTradePermissionManager(newTradePermissionManager);
}
function setMaintainer(address newMaintainer) external onlyOwner {
IDPP(dpp).setMaintainer(newMaintainer);
}
function setGasPriceSource(address newGasPriceLimitSource) external onlyOwner {
IDPP(dpp).setGasPriceSource(newGasPriceLimitSource);
}
function setISource(address newISource) external onlyOwner {
IDPP(dpp).setISource(newISource);
}
function setKSource(address newKSource) external onlyOwner {
IDPP(dpp).setKSource(newKSource);
}
function setBuy(bool open) external onlyOwner {
IDPP(dpp).setBuy(open);
}
function setSell(bool open) external onlyOwner {
IDPP(dpp).setSell(open);
}
}

View File

@@ -28,6 +28,7 @@ contract DPPStorage is InitializableOwnable, ReentrancyGuard {
using SafeMath for uint256;
address public _FACTORY_;
address public _ADMIN_;
// ============ Variables for Control ============