From 2b3ffc31e8c8cadd44044d9496f6e5263c2512d0 Mon Sep 17 00:00:00 2001 From: owen05 Date: Tue, 22 Dec 2020 13:18:23 +0800 Subject: [PATCH] add routev2 predata helper --- .gitignore | 3 +- contracts/DODOPrivatePool/impl/DPPTrader.sol | 23 ++ .../DODOVendingMachine/impl/DVMTrader.sol | 23 ++ contracts/Factory/CrowdPoolingFactory.sol | 2 + .../SmartRoute/helper/DODOV2RouteHelper.sol | 67 ++++++ contracts/SmartRoute/intf/IDODOV2.sol | 15 ++ deploy-detail-v2.0.txt | 44 ++++ kovan-mock-v2.0.txt | 80 +++++++ migrations/2_deploy_v1.5.js | 5 +- migrations/3_deploy_v2.js | 27 ++- migrations/4_deploy_v2_mock.js | 202 +++++++++--------- package.json | 2 +- test/Proxy/proxy.cp.test.ts | 10 +- truffle-config.js | 13 +- 14 files changed, 392 insertions(+), 124 deletions(-) create mode 100644 contracts/SmartRoute/helper/DODOV2RouteHelper.sol diff --git a/.gitignore b/.gitignore index 251962d..e7f35b2 100644 --- a/.gitignore +++ b/.gitignore @@ -21,5 +21,4 @@ node_modules #Hardhat files cache -artifacts -deploy-detail.txt \ No newline at end of file +artifacts \ No newline at end of file diff --git a/contracts/DODOPrivatePool/impl/DPPTrader.sol b/contracts/DODOPrivatePool/impl/DPPTrader.sol index facfbcc..1c623bf 100644 --- a/contracts/DODOPrivatePool/impl/DPPTrader.sol +++ b/contracts/DODOPrivatePool/impl/DPPTrader.sol @@ -267,6 +267,29 @@ contract DPPTrader is DPPVault { PMMPricing.adjustedTarget(state); } + function getPMMStateForCall() + external + view + returns ( + uint256 i, + uint256 K, + uint256 B, + uint256 Q, + uint256 B0, + uint256 Q0, + uint8 R + ) + { + PMMPricing.PMMState memory state = getPMMState(); + i = state.i; + K = state.K; + B = state.B; + Q = state.Q; + B0 = state.B0; + Q0 = state.Q0; + R = uint8(state.R); + } + function getMidPrice() public view returns (uint256 midPrice) { return PMMPricing.getMidPrice(getPMMState()); } diff --git a/contracts/DODOVendingMachine/impl/DVMTrader.sol b/contracts/DODOVendingMachine/impl/DVMTrader.sol index 07a2f0b..75b5366 100644 --- a/contracts/DODOVendingMachine/impl/DVMTrader.sol +++ b/contracts/DODOVendingMachine/impl/DVMTrader.sol @@ -208,6 +208,29 @@ contract DVMTrader is DVMVault { PMMPricing.adjustedTarget(state); } + function getPMMStateForCall() + external + view + returns ( + uint256 i, + uint256 K, + uint256 B, + uint256 Q, + uint256 B0, + uint256 Q0, + uint8 R + ) + { + PMMPricing.PMMState memory state = getPMMState(); + i = state.i; + K = state.K; + B = state.B; + Q = state.Q; + B0 = state.B0; + Q0 = state.Q0; + R = uint8(state.R); + } + function getMidPrice() public view returns (uint256 midPrice) { return PMMPricing.getMidPrice(getPMMState()); } diff --git a/contracts/Factory/CrowdPoolingFactory.sol b/contracts/Factory/CrowdPoolingFactory.sol index 80db757..4d46e27 100644 --- a/contracts/Factory/CrowdPoolingFactory.sol +++ b/contracts/Factory/CrowdPoolingFactory.sol @@ -123,6 +123,8 @@ contract CrowdPoolingFactory is Ownable { _USER_REGISTRY_[creator].push(cpAddress); emit NewCP(baseToken, quoteToken, creator, cpAddress); + + //TODO: 初始存入资金,用于settle补贴 } // ============ View Functions ============ diff --git a/contracts/SmartRoute/helper/DODOV2RouteHelper.sol b/contracts/SmartRoute/helper/DODOV2RouteHelper.sol new file mode 100644 index 0000000..408e470 --- /dev/null +++ b/contracts/SmartRoute/helper/DODOV2RouteHelper.sol @@ -0,0 +1,67 @@ +/* + + Copyright 2020 DODO ZOO. + SPDX-License-Identifier: Apache-2.0 + +*/ + +pragma solidity 0.6.9; +pragma experimental ABIEncoderV2; + +import {IDODOV2} from "../intf/IDODOV2.sol"; + +contract DODOV2RouteHelper { + address public immutable _DVM_FACTORY_; + address public immutable _DPP_FACTORY_; + //TODO:UnownedDVMFactory 去掉可行性 + + struct PairDetail { + uint256 i; + uint256 K; + uint256 B; + uint256 Q; + uint256 B0; + uint256 Q0; + uint8 R; + uint256 totalFeeRate; + } + + constructor(address dvmFactory,address dppFactory) public { + _DVM_FACTORY_ = dvmFactory; + _DPP_FACTORY_ = dppFactory; + } + + function getPairDetail(address token0,address token1,address userAddr) external view returns (PairDetail[] memory res) { + (address[] memory baseToken0DVM, address[] memory baseToken1DVM) = IDODOV2(_DVM_FACTORY_).getVendingMachineBidirection(token0,token1); + (address[] memory baseToken0DPP, address[] memory baseToken1DPP) = IDODOV2(_DPP_FACTORY_).getPrivatePoolBidirection(token0,token1); + uint256 len = baseToken0DVM.length + baseToken1DVM.length + baseToken0DPP.length + baseToken1DPP.length; + res = new PairDetail[](len); + for(uint8 i = 0; i < len; i++) { + PairDetail memory curRes = PairDetail(0,0,0,0,0,0,0,0); + address cur; + if(i < baseToken0DVM.length) { + cur = baseToken0DVM[i]; + } else if(i < baseToken0DVM.length + baseToken1DVM.length) { + cur = baseToken1DVM[i - baseToken0DVM.length]; + } else if(i < baseToken0DVM.length + baseToken1DVM.length + baseToken0DPP.length) { + cur = baseToken0DPP[i - baseToken0DVM.length - baseToken1DVM.length]; + } else { + cur = baseToken1DPP[i - baseToken0DVM.length - baseToken1DVM.length - baseToken0DPP.length]; + } + + ( + curRes.i, + curRes.K, + curRes.B, + curRes.Q, + curRes.B0, + curRes.Q0, + curRes.R + ) = IDODOV2(cur).getPMMStateForCall(); + + (uint256 lpFeeRate, uint256 mtFeeRate) = IDODOV2(cur).getUserFeeRate(userAddr); + curRes.totalFeeRate = lpFeeRate + mtFeeRate; + res[i] = curRes; + } + } +} \ No newline at end of file diff --git a/contracts/SmartRoute/intf/IDODOV2.sol b/contracts/SmartRoute/intf/IDODOV2.sol index 4d8ab53..23afeb4 100644 --- a/contracts/SmartRoute/intf/IDODOV2.sol +++ b/contracts/SmartRoute/intf/IDODOV2.sol @@ -24,6 +24,18 @@ interface IDODOV2 { function _OWNER_() external returns (address); + function getPMMStateForCall() external view returns ( + uint256 i, + uint256 K, + uint256 B, + uint256 Q, + uint256 B0, + uint256 Q0, + uint8 R + ); + + function getUserFeeRate(address user) external view returns (uint256 lpFeeRate, uint256 mtFeeRate); + //========== DODOVendingMachine ======== function createDODOVendingMachine( @@ -38,6 +50,7 @@ interface IDODOV2 { function buyShares(address to) external returns (uint256,uint256,uint256); + function getVendingMachineBidirection(address token0, address token1) external view returns (address[] memory baseToken0Machines, address[] memory baseToken1Machines); //========== DODOPrivatePool =========== @@ -66,6 +79,8 @@ interface IDODOV2 { uint256 minQuoteReserve ) external returns (bool); + function getPrivatePoolBidirection(address token0, address token1) external view returns (address[] memory baseToken0Pool, address[] memory baseToken1Pool); + //========== CrowdPooling =========== function createCrowdPooling() external returns (address newCrowdPooling); diff --git a/deploy-detail-v2.0.txt b/deploy-detail-v2.0.txt index d93b2fe..0543041 100644 --- a/deploy-detail-v2.0.txt +++ b/deploy-detail-v2.0.txt @@ -65,3 +65,47 @@ DODOApprove Address: 0xa7Beb077e2A44243F1215F80dBb133Aa98A2143d DODOProxyV2 Address: 0x852AF3De06Daaf5bBcb2B2B7a19D2b4Df15e488F Init DODOProxyV2 Tx: 0x9420d8236486c0b8d46cf3155f52acd78ff71beba6456c3e7a6a65d47e9d3f7f DODOApprove Init tx: 0x38c5ace45ae99654f94baf328d53f293320ec70b13093e8e645d6e858d9a85f1 +==================================================== +network type: kovan +Deploy time: 2020/12/22 上午10:30:38 +Deploy type: HELPER V2 +==================================================== +network type: kovan +Deploy time: 2020/12/22 上午10:33:24 +Deploy type: HELPER V2 +DODOV2RouteHelper Address: 0xFb6B765d741AD6658C355Bec345F1718b7955763 +==================================================== +network type: kovan +Deploy time: 2020/12/22 上午11:25:38 +Deploy type: V2 +DvmTemplateAddress: 0xcD08659418F6C4315b9e6cE574e7a5159BED6D82 +DppTemplateAddress: 0xa587a93e4d6c0586661DdD228EbaE41558F58589 +DODOApprove Address: 0x2Cb248324dd52b2cF351d35F2a49E013f75607a3 +DvmFactoryAddress: 0x029871152358F4f15b63064765960e358305Cd2c +Init DvmFactory Tx: 0xaaa9b96cfa6f84b1e20f39dcbb0e74444a7614302df4d4f86c5a8a7be7d69d30 +UnownedDvmFactoryAddress: 0x91C63C9C60B53E7ab885e184bAA902eD30c44F98 +DppFactoryAddress: 0x6D768bDe6eb51B1551d0d95c2909DDD370a61552 +Init DppFactory Tx: 0x87da4b7f02c63970ecfb35028fd3c4fa0d5694e587c6d532d9c99fdf7d609b57 +DODOProxyV2 Address: 0x4E9dC77254e0907873A349Ea273cc5E89d5A2d47 +Init DODOProxyV2 Tx: 0x32c1ba330c40e91e492bbe73d8fef9c578d220e7bdf40e3c136a7e92700f7f2e +DODOApprove Init tx: 0x77ad672800fadedfc481445b95e14b5286e0f9f17370533fbcfa3ed3ab6cfafb +==================================================== +network type: kovan +Deploy time: 2020/12/22 下午12:41:37 +Deploy type: V2 +DvmTemplateAddress: 0x0723d8FD20Cc802323877146e7cB6B88eF5bd1F0 +DppTemplateAddress: 0xAfD2c1Eef42A490B5a98ACb7B814bA00D62843af +DODOApprove Address: 0x6eA356EA3c1780c02873591d93451Ed3f4509bEa +DvmFactoryAddress: 0x577481Bde7327e732f78e9f6AF44632CB8DDe80e +Init DvmFactory Tx: 0xa3d488cc0a17cd13bdf92cac43e447f46684921ccbe90125778a8af0d4920beb +UnownedDvmFactoryAddress: 0xc0184A5dBbe41d9e5F9B414Bf80F4a27b5446f4A +DppFactoryAddress: 0xC510D9c58aa226c698F56b22b86A3031b8cBf551 +Init DppFactory Tx: 0x34bfb9de6c7b729ec87c6a2a0cfe3087897d282ce5a8000970b772b7d9d00bdc +DODOProxyV2 Address: 0xfEC85D8ea0E85ABa5b35aca959845878113BE108 +Init DODOProxyV2 Tx: 0x71013c65158545383d36f62214ab58148e6a7e9ca2a7196679c6846d125aad93 +DODOApprove Init tx: 0xe8fed4488058710fe5ad07cf62f5c41381af1946e7243a8053de9b1b177a7031 +==================================================== +network type: kovan +Deploy time: 2020/12/22 下午1:09:32 +Deploy type: HELPER V2 +DODOV2RouteHelper Address: 0xA5A1699FeDc110606AEF85BD05C961A54686306e diff --git a/kovan-mock-v2.0.txt b/kovan-mock-v2.0.txt index 28a25ba..0d284d1 100644 --- a/kovan-mock-v2.0.txt +++ b/kovan-mock-v2.0.txt @@ -56,3 +56,83 @@ Create DPP 0xFE1133ea03d701C5006b7f065bBf987955E7A67C Tx: 0x591e9d4f8aeb1773c1db Create DPP 0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C Tx: 0xee691843418c432c77dc8f55bad638551ca4c1f71ca98a7a9e789a5c10d14569 Create DPP 0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f Tx: 0x60586a3b460a507107e2412ce68eb370d12d3ccfe8cab2d313871cc521c59eeb Create DPP 0x6462794c19e6b4543BEC56200212c7c746bbB9eB Tx: 0x0c4a29fea84b4fff01898dc447ae311d3e76caffe14ec877dd437a593423b853 + +==================================================== +network type: kovan +Deploy time: 2020/12/21 上午11:31:44 +Mock TOKEN Tx: V2 +ERC20 address: 0x156595bAF85D5C29E91d959889B022d952190A64; Symbol:USDT +==================================================== +network type: kovan +Deploy time: 2020/12/21 下午12:02:58 +Mock POOL Tx: V2 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0xcfd0546fd0fb31ff2c051a09018f61f8869b3ebe1c8657d11b11b1ce5dd01535 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x7e0d3717f3a84a8f924ef08392e37bd86da5419ac30864231a4c80465e5826b6 +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x8386c03649cd4502ec9d13086a73ce2c44c2e99b243501ff8b4aa7c63cc69c69 +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x839a82a59583d5bdf978d50920a96e0b0059a2ad8269f59e2fa4560986dadfec +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x00bf8c61510bfa6ef23a6ff8c73fcbc0c914d35b233bbd18420dbcd1361ef4a7 +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x6944f5e9b14f78a8e2a843dfea0df12f9af4ced08bb41649661d22dceea77eec +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x71c44c1397cd1c21d70f84e065ea502c5064e2fe41183fb49c48bb20b17f26ea +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x92fade7263acd051dd7202e6d42b9d3a2f6054158f515f518b880709a243e39e +==================================================== +network type: kovan +Deploy time: 2020/12/21 下午5:52:24 +Mock POOL Tx: V2 +==================================================== +network type: kovan +Deploy time: 2020/12/21 下午5:54:43 +Mock POOL Tx: V2 +Approve:0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE Tx: 0x2a5bc64f488ab0fcc4e78f61b3828a95a0cb876c259da8b5302fc34fc6728841 +Approve:0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA Tx: 0xa5c4bdf42a3d25eedb94ab532ee2ae23748f9e2a887bc1c927ee5d57a46e45c1 +Approve:0xFE1133ea03d701C5006b7f065bBf987955E7A67C Tx: 0x8a9d851f58df5d051ad88507bcb3e89b5363dfed62fc32b3422e6c93363d5188 +Approve:0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C Tx: 0x883b1629de0e9380aae3b49ad2fbd75ecc2872ed68fdb944659d19c57c914088 +Approve:0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f Tx: 0x0c7632f16bab993fdaeb0ee8e5439019c331302a4fdac6053581901f62e444da +Approve:0x6462794c19e6b4543BEC56200212c7c746bbB9eB Tx: 0xc26ec75d39d530d8261bddf240838840312f90a7b079ad7d2f496b7ffcf59bdb +==================================================== +network type: kovan +Deploy time: 2020/12/21 下午5:57:32 +Mock POOL Tx: V2 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x905e232630b5d7b6e0b94ba36bd757b98ae85e9367cda7eb14c25839e59fad20 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xa8863df1cc7b14304ce6c86cc2c3cf430e3fd91c4d49f7485050686955b3cf93 +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x94e3d04e8727cc89a84be545ee8645e54d957f1b4056d3d8829c4e02cf323a62 +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x9ee20fe97cfe17073776a05fca857d3e8f6806c7ab6012d0452e0104382ea0dd +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x31342d7e7a1466316dbc1ae854ec72fbcc5538e613703551bc9580f33695f6a3 +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xd5d4d5c6f366d743819fa840d007b08db01b9858e67910ab580558d7c80197b4 +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0xa94d744c2eacb3289d997a4df6f0d876d281c9490277ec819dcd95fef1380707 +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xfd1cc2eac77c42ccd6917914423a59e0835bdac065c01182204d68973dfba90a +==================================================== +network type: kovan +Deploy time: 2020/12/22 上午11:32:19 +Mock POOL Tx: V2 +Approve:0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE Tx: 0xf3d1a74bc5f9a26230b12c1ffa6ede8a444cc06989df7945902350fd29f8ffd3 +Approve:0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA Tx: 0xce2522019ab10095785ca2644c9867075606c2738ea877d34b8ad0f003d39a5c +Approve:0xFE1133ea03d701C5006b7f065bBf987955E7A67C Tx: 0xd8878c926dc0c9fcf790226236631b2d035659a3bf6a309ac5ca572b812ab504 +Approve:0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C Tx: 0x51d61b8dfbf5dd0433e3da23ac6babd80e00119cce07100ef2051664551114fb +Approve:0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f Tx: 0xc86697227d933f721a937fe64fa6d00d00282e0c0dd218b96802d32afed07b4f +Approve:0x6462794c19e6b4543BEC56200212c7c746bbB9eB Tx: 0x4b776f5c6a19ec75312ce5287364b2fe7fd09f77fcf7e5f58b1321a027b7a9de +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x430312b3bb0c5be2fe6891ce7fad10fcf173f7c94c9a1f449c03d1f41ce555f0 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x033e34185f4ad1ee4029e559be5b394f1c64590d0c95d704c6363452ec9cf7f9 +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0xde3a8c619ab6e23254be21d2bf63f782ae9ee1c9c88ce0c13134e10bc5747c18 +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x867b98322215dfdbe185f4ede238b4d89d93ab7421bf455847c188ccda0ae55a +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x760fd48862bae8b4066fea533dc03673048b7c5c6fcca7bad2e0dba696baa7fa +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x43cd86086019b16683d869915bb5ddbbba9515c734dc8fedbcaed79829c3141b +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0xb77428c2b04c398f54b5d3d2c82c61f89b9e513bd5e8fb3dedd3257df66786db +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x3a00c5998e20b3136687559cf24854466ed4db9c4cbbc3170ec3dce4a89c1c49 +==================================================== +network type: kovan +Deploy time: 2020/12/22 下午1:11:01 +Mock POOL Tx: V2 +Approve:0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE Tx: 0x18628d36532b6cb4e7c9bfda1620c0468109b863bcea2b324747c6871f6cebb9 +Approve:0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA Tx: 0xf56f46c6580c66e9701bdebd5418d7c6cef926cb18f2fe86ca64f3a6551b7192 +Approve:0xFE1133ea03d701C5006b7f065bBf987955E7A67C Tx: 0x3f71e2423a07cd60932aa865f6d2eab97a540836fa7fcdb25bd574bbbfe443ef +Approve:0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C Tx: 0xd30ad979b91e934808eaa2f84db42fb10b1c41da65ec630fc2861a93fcf5388f +Approve:0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f Tx: 0xa23a99470a0ba46eed8350ab96d35f1611e74e47ce84aea2380e19e9ce6e5fc2 +Approve:0x6462794c19e6b4543BEC56200212c7c746bbB9eB Tx: 0x4c08777310a5937e4230488b649324e72f170dc1bcc590f62b037d3e276d7e96 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0xdef48e57e4263aeb11beb0c75ccbfe849686a3ab5650e408e30f19788286f0fc +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xb4f2116439cc4bb2b6f3fb664aeb4b18223cbad2254e2307fb912210c5d97c8a +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x179855fb67ef2648c08716b1d0c092136471f3d092b02fa023ea72f08732d54e +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xe0b75e03ebf4613332194bee33be883197fe8601a466614849eb737d2ebbf109 +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x319b3913d3709cc75d25f4974923f74603468964a2966ba7b624811885e01b40 +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xbded78906a95f25ba22720ce45cff94fb015e921294eeb3c4a20402269cc2bba +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x9ebcf8d585ac9374bab0798b493ee64845daa81d289b8b3b6262785c401737d1 +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xaceb4d156bdcaf037e76442275da4e521ee13a02e3b16da34704d6e712d534e4 diff --git a/migrations/2_deploy_v1.5.js b/migrations/2_deploy_v1.5.js index 2a503d5..703ef1b 100644 --- a/migrations/2_deploy_v1.5.js +++ b/migrations/2_deploy_v1.5.js @@ -1,4 +1,5 @@ const fs = require("fs"); +const { deploySwitch } = require('../truffle-config.js') const file = fs.createWriteStream("../deploy-detail-v1.5.txt", { 'flags': 'a' }); let logger = new console.Console(file, file); @@ -7,8 +8,6 @@ const DODOProxyV1 = artifacts.require("DODOV1Proxy01"); const DODOSellHelper = artifacts.require("DODOSellHelper"); const DODOSwapCalcHelper = artifacts.require("DODOSwapCalcHelper"); -const DEPLOY_ROUTE = false; - module.exports = async (deployer, network, accounts) => { let DODOSellHelperAddress = ""; let WETHAddress = ""; @@ -39,7 +38,7 @@ module.exports = async (deployer, network, accounts) => { ownerAddress = "0x4073f2b9bB95774531b9e23d206a308c614A943a"; } else return; - if (DEPLOY_ROUTE) { + if (deploySwitch.DEPLOY_V1) { logger.log("===================================================="); logger.log("network type: " + network); diff --git a/migrations/3_deploy_v2.js b/migrations/3_deploy_v2.js index 5e949f2..e2e7cf2 100644 --- a/migrations/3_deploy_v2.js +++ b/migrations/3_deploy_v2.js @@ -1,4 +1,5 @@ const fs = require("fs"); +const { deploySwitch } = require('../truffle-config.js') const file = fs.createWriteStream("../deploy-detail-v2.0.txt", { 'flags': 'a' }); let logger = new console.Console(file, file); @@ -23,8 +24,9 @@ const DODOApprove = artifacts.require("DODOApprove"); const DODOProxyV2 = artifacts.require("DODOV2Proxy01"); const DODOSellHelper = artifacts.require("DODOSellHelper"); const DODOCalleeHelper = artifacts.require("DODOCalleeHelper"); +const DODOV2RouteHelper = artifacts.require("DODOV2RouteHelper"); + -const DEPLOY_V2 = false; module.exports = async (deployer, network, accounts) => { //Helper And Common @@ -76,15 +78,15 @@ module.exports = async (deployer, network, accounts) => { DefaultMtFeeRateAddress = "0xEfdE4225AC747136289979e29f1236527b2E4DB1"; DefaultPermissionAddress = "0xACc7E23368261e1E02103c4e5ae672E7D01f5797"; - DvmTemplateAddress = "0xb509d7BdbC9847a7bc4B73e96F92Ecf4058E3bc0"; + DvmTemplateAddress = ""; DvmAdminTemplateAddress = "0x45f455d7E233403F10b7AFCB0d0d0c0d775AFf63"; - DppTemplateAddress = "0xDaF105aCc7F83ac66dB7085D37123e047D1999c4"; + DppTemplateAddress = ""; DppAdminTemplateAddress = "0xDfdd9e1693C3A6AF25307c9dA561021f9e685878"; CpTemplateAddress = "0x59652F06fEdDe7780E8fa5C88CE850F67F26F0Fc"; //Factory - DvmFactoryAddress = "0x03db1C1C1Adf27A73DFe9BDc3B21D4c569c2D41e"; - UnownedDvmFactoryAddress = "0xc8A53F0fE35106762420E3b69866547BB4f389c2"; - DppFactoryAddress = "0x1B3Ce1Ac27C1C2d05743CE237aAF3406372049b1"; + DvmFactoryAddress = "0x577481Bde7327e732f78e9f6AF44632CB8DDe80e"; + UnownedDvmFactoryAddress = ""; + DppFactoryAddress = "0xC510D9c58aa226c698F56b22b86A3031b8cBf551"; CpFactoryAddress = "0x9F90AD19C15d7aF4291EB17b637DF78EaC639EA3"; //Approve DODOApproveAddress = ""; @@ -158,7 +160,18 @@ module.exports = async (deployer, network, accounts) => { } else return; - if (DEPLOY_V2) { + if(deploySwitch.HELPER_V2) { + logger.log("===================================================="); + logger.log("network type: " + network); + logger.log("Deploy time: " + new Date().toLocaleString()); + logger.log("Deploy type: HELPER V2"); + + await deployer.deploy(DODOV2RouteHelper,DvmFactoryAddress,DppFactoryAddress); + DODOV2RouteHelperAddress = DODOV2RouteHelper.address; + logger.log("DODOV2RouteHelper Address: ", DODOV2RouteHelperAddress); + } + + if (deploySwitch.DEPLOY_V2) { logger.log("===================================================="); logger.log("network type: " + network); logger.log("Deploy time: " + new Date().toLocaleString()); diff --git a/migrations/4_deploy_v2_mock.js b/migrations/4_deploy_v2_mock.js index a70a53e..888c116 100644 --- a/migrations/4_deploy_v2_mock.js +++ b/migrations/4_deploy_v2_mock.js @@ -1,5 +1,6 @@ const fs = require("fs"); const Web3 = require('web3'); +const { deploySwitch } = require('../truffle-config.js') const file = fs.createWriteStream("../kovan-mock-v2.0.txt", { 'flags': 'a' }); let logger = new console.Console(file, file); @@ -9,8 +10,40 @@ const MintableERC20Template = artifacts.require("InitializableMintableERC20"); const ERC20Factory = artifacts.require("ERC20Factory"); const DODOProxyV2 = artifacts.require("DODOV2Proxy01"); -const MOCK_TOKEN = false; -const MOCK_POOL = false; +const POOL_PARAM = [ + { + baseAddr: "0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE", //ABC0 + quoteAddr: "0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e", //USDC + lpFeeRate: "3000000000000000", //0.003 + mtFeeRate: "1000000000000000", //0.001 + i: "10000000000000000000", //10 + k: "500000000000000000" //0.5 + }, + { + baseAddr: "0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE", //ABC0 + quoteAddr: "0x156595bAF85D5C29E91d959889B022d952190A64", //USDT + lpFeeRate: "3000000000000000", //0.003 + mtFeeRate: "1000000000000000", //0.001 + i: "10000000000000000000", //10 + k: "800000000000000000" //0.8 + }, + { + baseAddr: "0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA", //ABC1 + quoteAddr: "0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e", //USDC + lpFeeRate: "3000000000000000", //0.003 + mtFeeRate: "1000000000000000", //0.001 + i: "5000000000000000000", //5 + k: "800000000000000000" //0.8 + }, + { + baseAddr: "0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA", //ABC1 + quoteAddr: "0x156595bAF85D5C29E91d959889B022d952190A64", //USDT + lpFeeRate: "3000000000000000", //0.003 + mtFeeRate: "1000000000000000", //0.001 + i: "5000000000000000000", //5 + k: "900000000000000000" //0.9 + } +]; module.exports = async (deployer, network, accounts) => { if (network != "kovan") return; @@ -18,8 +51,8 @@ module.exports = async (deployer, network, accounts) => { let ERC20TemplateAddress = "0x77d2e257241e6971688b08bdA9F658F065d7bb41"; let MintableERC20TemplateAddress = "0xA45a64DAba80757432fA4d654Df12f65f020C13C"; let ERC20FactoryAddress = "0xCb1A2f64EfB02803276BFB5a8D511C4D950282a0"; - let DODOApproveAddress = "0xC38ad4314bb44EE84cC2D4B2B1BBa4644550f172"; - let DODOProxyV2Address = "0x7102A9AA2146557EA60a6319EB40e8C8d856e628"; + let DODOApproveAddress = "0x6eA356EA3c1780c02873591d93451Ed3f4509bEa"; + let DODOProxyV2Address = "0xfEC85D8ea0E85ABa5b35aca959845878113BE108"; const provider = new Web3.providers.HttpProvider("https://kovan.infura.io/v3/22d4a3b2df0e47b78d458f43fe50a199"); @@ -33,77 +66,75 @@ module.exports = async (deployer, network, accounts) => { logger.log("network type: " + network); logger.log("Deploy time: " + new Date().toLocaleString()); - if (MOCK_POOL) { + if (deploySwitch.MOCK_V2_POOL) { logger.log("Mock POOL Tx: V2"); var tx; - const quoteAddr = "0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e"; - const token0Addr = "0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE"; - const token1Addr = "0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA"; - const token2Addr = "0xFE1133ea03d701C5006b7f065bBf987955E7A67C"; - const token3Addr = "0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C"; - const token4Addr = "0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f"; - const token5Addr = "0x6462794c19e6b4543BEC56200212c7c746bbB9eB"; - const token0 = await ERC20Template.at(token0Addr); - const token1 = await ERC20Template.at(token1Addr); - const token2 = await ERC20Template.at(token2Addr); - const token3 = await ERC20Template.at(token3Addr); - const token4 = await ERC20Template.at(token4Addr); - const token5 = await ERC20Template.at(token5Addr); - - //approve - tx = await token0.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - logger.log("Approve:" + token0Addr + " Tx:", tx.tx); - tx = await token1.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - logger.log("Approve:" + token1Addr + " Tx:", tx.tx); - tx = await token2.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - logger.log("Approve:" + token2Addr + " Tx:", tx.tx); - tx = await token3.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - logger.log("Approve:" + token3Addr + " Tx:", tx.tx); - tx = await token4.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - logger.log("Approve:" + token4Addr + " Tx:", tx.tx); - tx = await token5.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); - logger.log("Approve:" + token5Addr + " Tx:", tx.tx); - + {//Approve when change DODOApprove Address + const token0Addr = "0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE"; + const token1Addr = "0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA"; + const token2Addr = "0xFE1133ea03d701C5006b7f065bBf987955E7A67C"; + const token3Addr = "0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C"; + const token4Addr = "0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f"; + const token5Addr = "0x6462794c19e6b4543BEC56200212c7c746bbB9eB"; + const token0 = await ERC20Template.at(token0Addr); + const token1 = await ERC20Template.at(token1Addr); + const token2 = await ERC20Template.at(token2Addr); + const token3 = await ERC20Template.at(token3Addr); + const token4 = await ERC20Template.at(token4Addr); + const token5 = await ERC20Template.at(token5Addr); + tx = await token0.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + logger.log("Approve:" + token0Addr + " Tx:", tx.tx); + tx = await token1.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + logger.log("Approve:" + token1Addr + " Tx:", tx.tx); + tx = await token2.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + logger.log("Approve:" + token2Addr + " Tx:", tx.tx); + tx = await token3.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + logger.log("Approve:" + token3Addr + " Tx:", tx.tx); + tx = await token4.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + logger.log("Approve:" + token4Addr + " Tx:", tx.tx); + tx = await token5.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + logger.log("Approve:" + token5Addr + " Tx:", tx.tx); + } const DODOProxyV2Instance = await DODOProxyV2.at(DODOProxyV2Address); const assetTo = accounts[0]; const baseInAmount = web3.utils.toWei("10000", 'ether'); const quoteInAmount = 0; - const lpFeeRate = web3.utils.toWei("0.003", 'ether'); - const mtFeeRate = web3.utils.toWei("0.001", 'ether'); - const i = web3.utils.toWei("10", 'ether'); - const k = web3.utils.toWei("0.5", 'ether'); const deadline = Math.floor(new Date().getTime() / 1000 + 60 * 10); //DVM Pool - tx = await DODOProxyV2Instance.createDODOVendingMachine(assetTo, token0Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DVM " + token0Addr + " Tx:", tx.tx); - tx = await DODOProxyV2Instance.createDODOVendingMachine(assetTo, token1Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DVM " + token1Addr + " Tx:", tx.tx); - tx = await DODOProxyV2Instance.createDODOVendingMachine(assetTo, token2Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DVM " + token2Addr + " Tx:", tx.tx); - tx = await DODOProxyV2Instance.createDODOVendingMachine(assetTo, token3Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DVM " + token3Addr + " Tx:", tx.tx); - tx = await DODOProxyV2Instance.createDODOVendingMachine(assetTo, token4Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DVM " + token4Addr + " Tx:", tx.tx); - tx = await DODOProxyV2Instance.createDODOVendingMachine(assetTo, token5Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DVM " + token5Addr + " Tx:", tx.tx); - //DPP Pool - tx = await DODOProxyV2Instance.createDODOPrivatePool(token0Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DPP " + token0Addr + " Tx:", tx.tx); - tx = await DODOProxyV2Instance.createDODOPrivatePool(token1Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DPP " + token1Addr + " Tx:", tx.tx); - tx = await DODOProxyV2Instance.createDODOPrivatePool(token2Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DPP " + token2Addr + " Tx:", tx.tx); - tx = await DODOProxyV2Instance.createDODOPrivatePool(token3Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DPP " + token3Addr + " Tx:", tx.tx); - tx = await DODOProxyV2Instance.createDODOPrivatePool(token4Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DPP " + token4Addr + " Tx:", tx.tx); - tx = await DODOProxyV2Instance.createDODOPrivatePool(token5Addr, quoteAddr, baseInAmount, quoteInAmount, lpFeeRate, mtFeeRate, i, k, deadline); - logger.log("Create DPP " + token5Addr + " Tx:", tx.tx); + for (var i = 0; i < POOL_PARAM.length; i++) { + tx = await DODOProxyV2Instance.createDODOVendingMachine( + assetTo, + POOL_PARAM[i].baseAddr, + POOL_PARAM[i].quoteAddr, + baseInAmount, + quoteInAmount, + POOL_PARAM[i].lpFeeRate, + POOL_PARAM[i].mtFeeRate, + POOL_PARAM[i].i, + POOL_PARAM[i].k, + deadline + ); + logger.log("Create DVM: " + POOL_PARAM[i].baseAddr + "-" + POOL_PARAM[i].quoteAddr + " Tx:", tx.tx); + } + //DVM Pool + for (var i = 0; i < POOL_PARAM.length; i++) { + tx = await DODOProxyV2Instance.createDODOPrivatePool( + POOL_PARAM[i].baseAddr, + POOL_PARAM[i].quoteAddr, + baseInAmount, + quoteInAmount, + POOL_PARAM[i].lpFeeRate, + POOL_PARAM[i].mtFeeRate, + POOL_PARAM[i].i, + POOL_PARAM[i].k, + deadline + ); + logger.log("Create DPP: " + POOL_PARAM[i].baseAddr + "-" + POOL_PARAM[i].quoteAddr + " Tx:", tx.tx); + } } - - if (MOCK_TOKEN) { + if (deploySwitch.MOCK_TOKEN) { logger.log("Mock TOKEN Tx: V2"); if (CloneFactoryAddress == "") { await deployer.deploy(CloneFactory); @@ -134,49 +165,12 @@ module.exports = async (deployer, network, accounts) => { const ERC20FactoryInstance = await ERC20Factory.at(ERC20FactoryAddress); - const totalSupply = web3.utils.toWei("100000000", 'ether'); - for (let i = 0; i < 8; i++) { - var tx = await ERC20FactoryInstance.createStdERC20(totalSupply, 'ABC Token', 'ABC' + i, 18); - logger.log("ERC20 address: ", tx.logs[0].args['erc20'] + "; Symbol:" + 'ABC' + i); - } - } - - - if (MOCK_TOKEN) { - logger.log("Mock TOKEN Tx: V2"); - if (CloneFactoryAddress == "") { - await deployer.deploy(CloneFactory); - CloneFactoryAddress = CloneFactory.address; - logger.log("CloneFactoryAddress: ", CloneFactoryAddress); - } - if (ERC20TemplateAddress == "") { - await deployer.deploy(ERC20Template); - ERC20TemplateAddress = ERC20Template.address; - logger.log("ERC20TemplateAddress: ", ERC20TemplateAddress); - } - if (MintableERC20TemplateAddress == "") { - await deployer.deploy(MintableERC20Template); - MintableERC20TemplateAddress = MintableERC20Template.address; - logger.log("MintableERC20TemplateAddress: ", MintableERC20TemplateAddress); - } - - if (ERC20FactoryAddress == "") { - await deployer.deploy( - ERC20Factory, - CloneFactoryAddress, - ERC20TemplateAddress, - MintableERC20TemplateAddress - ); - ERC20FactoryAddress = ERC20Factory.address; - logger.log("ERC20FactoryAddress: ", ERC20FactoryAddress); - } - - const ERC20FactoryInstance = await ERC20Factory.at(ERC20FactoryAddress); - - const totalSupply = web3.utils.toWei("100000000", 'ether'); + const totalSupply = web3.utils.toWei("100000000", 'mwei'); for (let i = 0; i < 8; i++) { var tx = await ERC20FactoryInstance.createStdERC20(totalSupply, 'ABC Token', 'ABC' + i, 18); + // var tx = await ERC20FactoryInstance.createStdERC20(totalSupply, 'USDT Token', 'USDT', 6); logger.log("ERC20 address: ", tx.logs[0].args['erc20'] + "; Symbol:" + 'ABC' + i); + // logger.log("ERC20 address: ", tx.logs[0].args['erc20'] + "; Symbol:" + 'USDT'); } } }; diff --git a/package.json b/package.json index 48a765b..905dd5c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "keywords": [ "dodo", "ethereum", - "lmm" + "pmm" ], "scripts": { "prettier": "prettier --write **/*.sol", diff --git a/test/Proxy/proxy.cp.test.ts b/test/Proxy/proxy.cp.test.ts index 1511eb4..71a085b 100644 --- a/test/Proxy/proxy.cp.test.ts +++ b/test/Proxy/proxy.cp.test.ts @@ -69,12 +69,13 @@ describe("DODOProxyV2.0", () => { Math.floor(new Date().getTime() / 1000) + 10, 60 * 60 * 24, 60 * 60 * 24, - 60 * 60 * 24 * 30 + 60 * 60 * 24 * 30, + 60 * 60 * 24 * 7 ] var valueList = [ mweiStr("10000"), - decimalStr("0.2"), decimalStr("0.5"), + decimalStr("10"), decimalStr("1") ] cp_DODO_USDT = await initCreateCP(ctx, ctx.DODO.options.address, ctx.USDT.options.address, decimalStr("100000"), timeLine, valueList); @@ -104,12 +105,13 @@ describe("DODOProxyV2.0", () => { Math.floor(new Date().getTime() / 1000) + 10, 60 * 60 * 24, 60 * 60 * 24, - 60 * 60 * 24 * 30 + 60 * 60 * 24 * 30, + 60 * 60 * 24 * 7 ] var valueList = [ mweiStr("10000"), - decimalStr("0.2"), decimalStr("0.5"), + decimalStr("10"), decimalStr("1") ] await logGas(await ctx.DODOProxyV2.methods.createCrowdPooling( diff --git a/truffle-config.js b/truffle-config.js index a0e9e31..306d3b0 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -37,6 +37,13 @@ module.exports = { * * $ truffle test --network */ + deploySwitch: { + DEPLOY_V1: false, + DEPLOY_V2: false, + MOCK_TOKEN: false, + MOCK_V2_POOL: true, + HELPER_V2: false, + }, networks: { // Useful for testing. The `development` name is special - truffle uses it by default @@ -54,7 +61,7 @@ module.exports = { }, kovan: { networkCheckTimeout: 100000, - provider: function() { + provider: function () { return new HDWalletProvider(privKey, "https://kovan.infura.io/v3/" + infuraId); }, gas: 8000000, @@ -64,7 +71,7 @@ module.exports = { }, live: { networkCheckTimeout: 100000, - provider: function() { + provider: function () { return new HDWalletProvider(privKey, "https://mainnet.infura.io/v3/" + infuraId); }, gas: 3000000, @@ -73,7 +80,7 @@ module.exports = { skipDryRun: true }, bsclive: { - provider: function() { + provider: function () { return new HDWalletProvider(privKey, "https://bsc-dataseed1.binance.org"); }, network_id: 56,