From 01c544780291a5acc3e2be4980493e63065fb200 Mon Sep 17 00:00:00 2001 From: owen05 Date: Tue, 9 Mar 2021 15:43:02 +0800 Subject: [PATCH] fix --- config/oktest-config.js | 56 +++++++++++++++++++ contracts/DODOVendingMachine/impl/DVM.sol | 3 + .../DODOVendingMachine/impl/DVMStorage.sol | 2 + migrations/2_deploy_v2.js | 5 +- truffle-config.js | 2 +- 5 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 config/oktest-config.js diff --git a/config/oktest-config.js b/config/oktest-config.js new file mode 100644 index 0000000..ad98d1c --- /dev/null +++ b/config/oktest-config.js @@ -0,0 +1,56 @@ +module.exports = { + OKTEST_CONFIG: { + //TOKEN + WETH: "", + CHI: "0x0000000000000000000000000000000000000000", + DODO: "", + + //Helper + DODOSellHelper: "", + DODOCalleeHelper: "", + DODOV1PmmHelper: "", + DODOV2RouteHelper: "", + + //Template + CloneFactory: "", + FeeRateModel: "", + PermissionManager: "", + DVM: "", + DPP: "", + DPPAdmin: "", + CP: "", + ERC20: "", + MintableERC20: "", + + //Factory + DVMFactory: "", + DPPFactory: "", + CrowdPoolingFactory: "", + ERC20Factory: "", + + //Approve + DODOApprove: "", + DODOApproveProxy: "", + + //Periphery + DODOIncentive: "", + + //Adpater + DODOV1Adapter: "", + DODOV2Adapter: "", + UniAdapter: "", + + //Proxy + DODOV2Proxy: "", + + //vDODO + DODOCirculationHelper: "", + Governance: "", + dodoTeam: "", + vDODOToken: "", + + //Account + multiSigAddress: "", + defaultMaintainer: "", + } +} \ No newline at end of file diff --git a/contracts/DODOVendingMachine/impl/DVM.sol b/contracts/DODOVendingMachine/impl/DVM.sol index fd0b180..197c4c1 100644 --- a/contracts/DODOVendingMachine/impl/DVM.sol +++ b/contracts/DODOVendingMachine/impl/DVM.sol @@ -31,6 +31,9 @@ contract DVM is DVMTrader, DVMFunding { uint256 k, bool isOpenTWAP ) external { + require(!_DVM_INITIALIZED_, "DVM_INITIALIZED"); + _DVM_INITIALIZED_ = true; + require(baseTokenAddress != quoteTokenAddress, "BASE_QUOTE_CAN_NOT_BE_SAME"); _BASE_TOKEN_ = IERC20(baseTokenAddress); _QUOTE_TOKEN_ = IERC20(quoteTokenAddress); diff --git a/contracts/DODOVendingMachine/impl/DVMStorage.sol b/contracts/DODOVendingMachine/impl/DVMStorage.sol index dc9127d..e4a0c9a 100644 --- a/contracts/DODOVendingMachine/impl/DVMStorage.sol +++ b/contracts/DODOVendingMachine/impl/DVMStorage.sol @@ -21,6 +21,8 @@ contract DVMStorage is ReentrancyGuard { bool public _IS_OPEN_TWAP_ = false; + bool internal _DVM_INITIALIZED_; + // ============ Core Address ============ address public _MAINTAINER_; diff --git a/migrations/2_deploy_v2.js b/migrations/2_deploy_v2.js index c5191f9..50ef93b 100644 --- a/migrations/2_deploy_v2.js +++ b/migrations/2_deploy_v2.js @@ -97,7 +97,8 @@ module.exports = async (deployer, network, accounts) => { logger.log("network type: " + network); logger.log("Deploy time: " + new Date().toLocaleString()); logger.log("Deploy type: V2"); - + logger.log("multiSigAddress: ", multiSigAddress) + if (DODOTokenAddress == "") return; //Helper if (DODOSellHelperAddress == "") { @@ -282,7 +283,7 @@ module.exports = async (deployer, network, accounts) => { logger.log("Init DODOProxyV2 Tx:", tx.tx); - if (network == 'kovan') { + if (network == 'kovan' || network == 'mbtestnet') { const DODOApproveProxyInstance = await DODOApproveProxy.at(DODOApproveProxyAddress); var tx = await DODOApproveProxyInstance.init(multiSigAddress, [DODOProxyV2.address]); diff --git a/truffle-config.js b/truffle-config.js index 78001ae..2d75d3a 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -39,7 +39,7 @@ module.exports = { */ deploySwitch: { DEPLOY_V1: false, - DEPLOY_V2: false, + DEPLOY_V2: true, ADAPTER: false, MOCK_TOKEN: false, MOCK_V2_POOL: false,