remove operator

This commit is contained in:
mingda
2020-11-26 00:41:38 +08:00
parent d6e16d5c52
commit c6f7ac0431
4 changed files with 10 additions and 15 deletions

View File

@@ -18,7 +18,6 @@ contract DPP is DPPTrader {
function init(
address owner,
address maintainer,
address operator,
address baseTokenAddress,
address quoteTokenAddress,
address lpFeeRateModel,
@@ -31,7 +30,6 @@ contract DPP is DPPTrader {
) external {
initOwner(owner);
_MAINTAINER_ = maintainer;
_OPERATOR_ = operator;
_BASE_TOKEN_ = IERC20(baseTokenAddress);
_QUOTE_TOKEN_ = IERC20(quoteTokenAddress);
_LP_FEE_RATE_MODEL_ = IFeeRateModel(lpFeeRateModel);

View File

@@ -43,7 +43,6 @@ contract DPPStorage is InitializableOwnable, ReentrancyGuard {
// ============ Core Address ============
address public _MAINTAINER_; // collect maintainer fee
address public _OPERATOR_;
IERC20 public _BASE_TOKEN_;
IERC20 public _QUOTE_TOKEN_;

View File

@@ -71,13 +71,7 @@ contract DPPVault is DPPStorage {
uint256 newK,
uint256 baseOutAmount,
uint256 quoteOutAmount
) public {
require(
msg.sender == _OWNER_ ||
(msg.sender == ISmartApprove(_DODO_SMART_APPROVE_).getSmartSwap() &&
from == _OPERATOR_),
"RESET FORBIDDEN"
);
) public onlyOwner {
require(newK > 0 && newK <= 10**18, "K OUT OF RANGE!");
if (baseOutAmount > 0) _transferBaseOut(from, baseOutAmount);
if (quoteOutAmount > 0) _transferQuoteOut(from, quoteOutAmount);

View File

@@ -67,6 +67,8 @@ export class DPPContext {
var mtFeeRateModel = await contracts.newContract(contracts.CONST_FEE_RATE_MODEL_NAME)
var permissionManager = await contracts.newContract(contracts.PERMISSION_MANAGER_NAME)
var gasPriceSource = await contracts.newContract(contracts.EXTERNAL_VALUE_NAME)
var iSource = await contracts.newContract(contracts.EXTERNAL_VALUE_NAME)
var kSource = await contracts.newContract(contracts.EXTERNAL_VALUE_NAME)
this.BASE = await contracts.newContract(
contracts.MINTABLE_ERC20_CONTRACT_NAME,
@@ -82,20 +84,22 @@ export class DPPContext {
this.Maintainer = allAccounts[1];
this.SpareAccounts = allAccounts.slice(2, 10);
await this.DVM.methods.init(
await this.DPP.methods.init(
this.Deployer,
this.Maintainer,
this.Deployer,
this.BASE.options.address,
this.QUOTE.options.address,
lpFeeRateModel.options.address,
mtFeeRateModel.options.address,
permissionManager.options.address,
kSource.options.address,
iSource.options.address,
gasPriceSource.options.address,
config.i,
config.k
this.Maintainer,
permissionManager.options.address,
).send(this.sendParam(this.Deployer))
await gasPriceSource.methods.initOwner(this.Deployer).send(this.sendParam(this.Deployer))
await gasPriceSource.methods.initOwner(this.DPP.options.address).send(this.sendParam(this.Deployer))
await gasPriceSource.methods.set(MAX_UINT256).send(this.sendParam(this.Deployer))
await lpFeeRateModel.methods.init(this.Deployer, config.lpFeeRate).send(this.sendParam(this.Deployer))
await mtFeeRateModel.methods.init(this.Deployer, config.mtFeeRate).send(this.sendParam(this.Deployer))