diff --git a/contracts/CrowdPooling/impl/CPFunding.sol b/contracts/CrowdPooling/impl/CPFunding.sol index 950e423..05804ca 100644 --- a/contracts/CrowdPooling/impl/CPFunding.sol +++ b/contracts/CrowdPooling/impl/CPFunding.sol @@ -13,7 +13,7 @@ import {SafeERC20} from "../../lib/SafeERC20.sol"; import {DecimalMath} from "../../lib/DecimalMath.sol"; import {IERC20} from "../../intf/IERC20.sol"; import {IDVM} from "../../DODOVendingMachine/intf/IDVM.sol"; -import {IUnownedDVMFactory} from "../../Factory/UnownedDVMFactory.sol"; +import {IDVMFactory} from "../../Factory/DVMFactory.sol"; import {CPStorage} from "./CPStorage.sol"; import {PMMPricing} from "../../lib/PMMPricing.sol"; @@ -101,7 +101,7 @@ contract CPFunding is CPStorage { uint256 ratio = DecimalMath.ONE.sub(DecimalMath.divCeil(baseDepth, poolQuote)); _poolI = ratio.mul(ratio).div(avgPrice); } - _POOL_ = IUnownedDVMFactory(_POOL_FACTORY_).createDODOVendingMachine( + _POOL_ = IDVMFactory(_POOL_FACTORY_).createUnOwnedDODOVendingMachine( address(this), _poolBaseToken, _poolQuoteToken, diff --git a/contracts/Factory/DPPFactory.sol b/contracts/Factory/DPPFactory.sol index 0d6f625..acc6398 100644 --- a/contracts/Factory/DPPFactory.sol +++ b/contracts/Factory/DPPFactory.sol @@ -44,6 +44,9 @@ contract DPPFactory is InitializableOwnable { address dpp ); + + event RemoveDPP(address dpp); + // ============ Functions ============ constructor( @@ -138,10 +141,50 @@ contract DPPFactory is InitializableOwnable { IDPPAdmin(adminModel).init(owner, dpp, operator, dodoSmartApprove); } + // ============ Admin Operation Functions ============ + function updateAdminTemplate(address _newDPPAdminTemplate) external onlyOwner { _DPP_ADMIN_TEMPLATE_ = _newDPPAdminTemplate; } + function addPoolByAdmin( + address creator, + address baseToken, + address quoteToken, + address pool + ) external onlyOwner { + _REGISTRY_[baseToken][quoteToken].push(pool); + _USER_REGISTRY_[creator].push(pool); + emit NewDPP(baseToken, quoteToken, creator, pool); + } + + function removePoolByAdmin( + address creator, + address baseToken, + address quoteToken, + address pool + ) external onlyOwner { + address[] memory registryList = _REGISTRY_[baseToken][quoteToken]; + for (uint256 i = 0; i < registryList.length; i++) { + if (registryList[i] == pool) { + registryList[i] = registryList[registryList.length - 1]; + break; + } + } + _REGISTRY_[baseToken][quoteToken] = registryList; + _REGISTRY_[baseToken][quoteToken].pop(); + address[] memory userRegistryList = _USER_REGISTRY_[creator]; + for (uint256 i = 0; i < userRegistryList.length; i++) { + if (userRegistryList[i] == pool) { + userRegistryList[i] = userRegistryList[userRegistryList.length - 1]; + break; + } + } + _USER_REGISTRY_[creator] = userRegistryList; + _USER_REGISTRY_[creator].pop(); + emit RemoveDPP(pool); + } + // ============ View Functions ============ function getPrivatePool(address baseToken, address quoteToken) diff --git a/contracts/Factory/DVMFactory.sol b/contracts/Factory/DVMFactory.sol index 7cce3cf..37f2cd8 100644 --- a/contracts/Factory/DVMFactory.sol +++ b/contracts/Factory/DVMFactory.sol @@ -25,6 +25,15 @@ interface IDVMFactory { uint256 i, uint256 k ) external returns (address newVendingMachine); + + function createUnOwnedDODOVendingMachine( + address creator, + address baseToken, + address quoteToken, + uint256 lpFeeRate, + uint256 i, + uint256 k + ) external returns (address newVendingMachine); } contract DVMFactory is InitializableOwnable { @@ -34,8 +43,14 @@ contract DVMFactory is InitializableOwnable { address public immutable _DVM_TEMPLATE_; address public immutable _FEE_RATE_MODEL_TEMPLATE_; address public immutable _PERMISSION_MANAGER_TEMPLATE_; - address public immutable _DEFAULT_GAS_PRICE_SOURCE_; address public _DVM_ADMIN_TEMPLATE_; + + address public immutable _DEFAULT_MAINTAINER_; + address public immutable _DEFAULT_MT_FEE_RATE_MODEL_; + address public immutable _DEFAULT_PERMISSION_MANAGER_; + address public immutable _DEFAULT_GAS_PRICE_SOURCE_; + + address internal constant _EMPTY_ = 0x0000000000000000000000000000000000000000; // ============ Registry ============ @@ -53,6 +68,8 @@ contract DVMFactory is InitializableOwnable { address dvm ); + event RemoveDVM(address dvm); + // ============ Functions ============ constructor( @@ -61,13 +78,20 @@ contract DVMFactory is InitializableOwnable { address dvmAdminTemplate, address feeRateModelTemplate, address permissionManagerTemplate, - address defaultGasPriceSource + address defaultGasPriceSource, + address defaultMaintainer, + address defaultMtFeeRateModel, + address defaultPermissionManager ) public { _CLONE_FACTORY_ = cloneFactory; _DVM_TEMPLATE_ = dvmTemplate; _DVM_ADMIN_TEMPLATE_ = dvmAdminTemplate; _FEE_RATE_MODEL_TEMPLATE_ = feeRateModelTemplate; _PERMISSION_MANAGER_TEMPLATE_ = permissionManagerTemplate; + + _DEFAULT_MAINTAINER_ = defaultMaintainer; + _DEFAULT_MT_FEE_RATE_MODEL_ = defaultMtFeeRateModel; + _DEFAULT_PERMISSION_MANAGER_ = defaultPermissionManager; _DEFAULT_GAS_PRICE_SOURCE_ = defaultGasPriceSource; } @@ -101,6 +125,36 @@ contract DVMFactory is InitializableOwnable { emit NewDVM(baseToken, quoteToken, creator, newVendingMachine); } + + function createUnOwnedDODOVendingMachine( + address creator, + address baseToken, + address quoteToken, + uint256 lpFeeRate, + uint256 i, + uint256 k + ) external returns (address newVendingMachine) { + newVendingMachine = ICloneFactory(_CLONE_FACTORY_).clone(_DVM_TEMPLATE_); + { + IDVM(newVendingMachine).init( + _EMPTY_, + _DEFAULT_MAINTAINER_, + baseToken, + quoteToken, + _createFeeRateModel(_EMPTY_, lpFeeRate), + _DEFAULT_MT_FEE_RATE_MODEL_, + _DEFAULT_PERMISSION_MANAGER_, + _DEFAULT_GAS_PRICE_SOURCE_, + i, + k + ); + } + _REGISTRY_[baseToken][quoteToken].push(newVendingMachine); + _USER_REGISTRY_[creator].push(newVendingMachine); + emit NewDVM(baseToken, quoteToken, creator, newVendingMachine); + } + + function _createFeeRateModel(address owner, uint256 feeRate) internal returns (address feeRateModel) @@ -122,10 +176,49 @@ contract DVMFactory is InitializableOwnable { IDVMAdmin(adminModel).init(owner, dvm); } + // ============ Admin Operation Functions ============ function updateAdminTemplate(address _newDVMAdminTemplate) external onlyOwner { _DVM_ADMIN_TEMPLATE_ = _newDVMAdminTemplate; } + function addPoolByAdmin( + address creator, + address baseToken, + address quoteToken, + address pool + ) external onlyOwner { + _REGISTRY_[baseToken][quoteToken].push(pool); + _USER_REGISTRY_[creator].push(pool); + emit NewDVM(baseToken, quoteToken, creator, pool); + } + + function removePoolByAdmin( + address creator, + address baseToken, + address quoteToken, + address pool + ) external onlyOwner { + address[] memory registryList = _REGISTRY_[baseToken][quoteToken]; + for (uint256 i = 0; i < registryList.length; i++) { + if (registryList[i] == pool) { + registryList[i] = registryList[registryList.length - 1]; + break; + } + } + _REGISTRY_[baseToken][quoteToken] = registryList; + _REGISTRY_[baseToken][quoteToken].pop(); + address[] memory userRegistryList = _USER_REGISTRY_[creator]; + for (uint256 i = 0; i < userRegistryList.length; i++) { + if (userRegistryList[i] == pool) { + userRegistryList[i] = userRegistryList[userRegistryList.length - 1]; + break; + } + } + _USER_REGISTRY_[creator] = userRegistryList; + _USER_REGISTRY_[creator].pop(); + emit RemoveDVM(pool); + } + // ============ View Functions ============ function getVendingMachine(address baseToken, address quoteToken) diff --git a/contracts/Factory/UnownedDVMFactory.sol b/contracts/Factory/UnownedDVMFactory.sol deleted file mode 100644 index 900e00b..0000000 --- a/contracts/Factory/UnownedDVMFactory.sol +++ /dev/null @@ -1,141 +0,0 @@ -/* - - Copyright 2020 DODO ZOO. - SPDX-License-Identifier: Apache-2.0 - -*/ - -pragma solidity 0.6.9; -pragma experimental ABIEncoderV2; - -import {Ownable} from "../lib/Ownable.sol"; -import {ICloneFactory} from "../lib/CloneFactory.sol"; -import {IFeeRateModel} from "../lib/FeeRateModel.sol"; -import {IDVM} from "../DODOVendingMachine/intf/IDVM.sol"; -import {IDVMAdmin} from "../DODOVendingMachine/intf/IDVMAdmin.sol"; -import {IPermissionManager} from "../lib/PermissionManager.sol"; - -interface IUnownedDVMFactory { - function createDODOVendingMachine( - address creator, - address baseToken, - address quoteToken, - uint256 lpFeeRate, - uint256 i, - uint256 k - ) external returns (address newVendingMachine); -} - -contract UnownedDVMFactory { - // ============ Templates ============ - - address public immutable _CLONE_FACTORY_; - address public immutable _DVM_TEMPLATE_; - address public immutable _FEE_RATE_MODEL_TEMPLATE_; - - address public immutable _DEFAULT_MAINTAINER_; - address public immutable _DEFAULT_MT_FEE_RATE_MODEL_; - address public immutable _DEFAULT_PERMISSION_MANAGER_; - address public immutable _DEFAULT_GAS_PRICE_SOURCE_; - - address internal constant _EMPTY_ = 0x0000000000000000000000000000000000000000; - - // ============ Registry ============ - - // base -> quote -> DVM address list - mapping(address => mapping(address => address[])) public _REGISTRY_; - // creator -> DVM address list - mapping(address => address[]) public _USER_REGISTRY_; - - // ============ Events ============ - - event NewUnOwnedDVM( - address baseToken, - address quoteToken, - address creator, - address dvm - ); - - // ============ Functions ============ - - constructor( - address cloneFactory, - address dvmTemplate, - address feeRateModelTemplate, - address defaultMaintainer, - address defaultMtFeeRateModel, - address defaultPermissionManager, - address defaultGasPriceSource - ) public { - _CLONE_FACTORY_ = cloneFactory; - _DVM_TEMPLATE_ = dvmTemplate; - _FEE_RATE_MODEL_TEMPLATE_ = feeRateModelTemplate; - - _DEFAULT_MAINTAINER_ = defaultMaintainer; - _DEFAULT_MT_FEE_RATE_MODEL_ = defaultMtFeeRateModel; - _DEFAULT_PERMISSION_MANAGER_ = defaultPermissionManager; - _DEFAULT_GAS_PRICE_SOURCE_ = defaultGasPriceSource; - } - - function createDODOVendingMachine( - address creator, - address baseToken, - address quoteToken, - uint256 lpFeeRate, - uint256 i, - uint256 k - ) external returns (address newVendingMachine) { - newVendingMachine = ICloneFactory(_CLONE_FACTORY_).clone(_DVM_TEMPLATE_); - { - IDVM(newVendingMachine).init( - _EMPTY_, - _DEFAULT_MAINTAINER_, - baseToken, - quoteToken, - _createFeeRateModel(_EMPTY_, lpFeeRate), - _DEFAULT_MT_FEE_RATE_MODEL_, - _DEFAULT_PERMISSION_MANAGER_, - _DEFAULT_GAS_PRICE_SOURCE_, - i, - k - ); - } - _REGISTRY_[baseToken][quoteToken].push(newVendingMachine); - _USER_REGISTRY_[creator].push(newVendingMachine); - emit NewUnOwnedDVM(baseToken, quoteToken, creator, newVendingMachine); - } - - function _createFeeRateModel(address owner, uint256 feeRate) - internal - returns (address feeRateModel) - { - feeRateModel = ICloneFactory(_CLONE_FACTORY_).clone(_FEE_RATE_MODEL_TEMPLATE_); - IFeeRateModel(feeRateModel).init(owner, feeRate); - } - - // ============ View Functions ============ - - function getVendingMachine(address baseToken, address quoteToken) - external - view - returns (address[] memory machines) - { - return _REGISTRY_[baseToken][quoteToken]; - } - - function getVendingMachineBidirection(address token0, address token1) - external - view - returns (address[] memory baseToken0Machines, address[] memory baseToken1Machines) - { - return (_REGISTRY_[token0][token1], _REGISTRY_[token1][token0]); - } - - function getVendingMachineByUser(address user) - external - view - returns (address[] memory machines) - { - return _USER_REGISTRY_[user]; - } -} diff --git a/contracts/SmartRoute/helper/DODOV2RouteHelper.sol b/contracts/SmartRoute/helper/DODOV2RouteHelper.sol index 408e470..cd880e2 100644 --- a/contracts/SmartRoute/helper/DODOV2RouteHelper.sol +++ b/contracts/SmartRoute/helper/DODOV2RouteHelper.sol @@ -13,7 +13,6 @@ import {IDODOV2} from "../intf/IDODOV2.sol"; contract DODOV2RouteHelper { address public immutable _DVM_FACTORY_; address public immutable _DPP_FACTORY_; - //TODO:UnownedDVMFactory 去掉可行性 struct PairDetail { uint256 i; @@ -23,7 +22,10 @@ contract DODOV2RouteHelper { uint256 B0; uint256 Q0; uint8 R; - uint256 totalFeeRate; + uint256 lpFeeRate; + uint256 mtFeeRate; + address baseToken; + address quoteToken; } constructor(address dvmFactory,address dppFactory) public { @@ -37,30 +39,40 @@ contract DODOV2RouteHelper { 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); + PairDetail memory curRes = PairDetail(0,0,0,0,0,0,0,0,0,address(0),address(0)); address cur; if(i < baseToken0DVM.length) { cur = baseToken0DVM[i]; + curRes.baseToken = token0; + curRes.quoteToken = token1; } else if(i < baseToken0DVM.length + baseToken1DVM.length) { cur = baseToken1DVM[i - baseToken0DVM.length]; + curRes.baseToken = token1; + curRes.quoteToken = token0; } else if(i < baseToken0DVM.length + baseToken1DVM.length + baseToken0DPP.length) { cur = baseToken0DPP[i - baseToken0DVM.length - baseToken1DVM.length]; + curRes.baseToken = token0; + curRes.quoteToken = token1; } else { cur = baseToken1DPP[i - baseToken0DVM.length - baseToken1DVM.length - baseToken0DPP.length]; + curRes.baseToken = token1; + curRes.quoteToken = token0; } - - ( - 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; + if(!IDODOV2(cur)._BUYING_CLOSE_() && !IDODOV2(cur)._SELLING_CLOSE_()){ + ( + curRes.i, + curRes.K, + curRes.B, + curRes.Q, + curRes.B0, + curRes.Q0, + curRes.R + ) = IDODOV2(cur).getPMMStateForCall(); + + (curRes.lpFeeRate, curRes.mtFeeRate) = IDODOV2(cur).getUserFeeRate(userAddr); + } + res[i] = curRes; } } diff --git a/contracts/SmartRoute/intf/IDODOV2.sol b/contracts/SmartRoute/intf/IDODOV2.sol index 23afeb4..0061314 100644 --- a/contracts/SmartRoute/intf/IDODOV2.sol +++ b/contracts/SmartRoute/intf/IDODOV2.sol @@ -18,9 +18,13 @@ interface IDODOV2 { function getVaultReserve() external view returns (uint256 baseReserve, uint256 quoteReserve); - function _BASE_TOKEN_() external returns (address); + function _BASE_TOKEN_() external view returns (address); - function _QUOTE_TOKEN_() external returns (address); + function _QUOTE_TOKEN_() external view returns (address); + + function _BUYING_CLOSE_() external view returns (bool); + + function _SELLING_CLOSE_() external view returns (bool); function _OWNER_() external returns (address); diff --git a/deploy-detail-v2.0.txt b/deploy-detail-v2.0.txt index 0543041..254de5a 100644 --- a/deploy-detail-v2.0.txt +++ b/deploy-detail-v2.0.txt @@ -109,3 +109,45 @@ network type: kovan Deploy time: 2020/12/22 下午1:09:32 Deploy type: HELPER V2 DODOV2RouteHelper Address: 0xA5A1699FeDc110606AEF85BD05C961A54686306e +==================================================== +network type: kovan +Deploy time: 2020/12/23 下午12:14:58 +Deploy type: HELPER V2 +DODOV2RouteHelper Address: 0xBABB5D327A38120B093878C5Dd809cb0f325bfFd +==================================================== +network type: kovan +Deploy time: 2020/12/23 下午9:54:47 +Deploy type: V2 +DvmTemplateAddress: 0x35755759Eb9FCDeA6005e5967e732d67eea68EcF +DppTemplateAddress: 0x302A19bD1951a828264527FaAbEC8ec2f9de7024 +DODOApprove Address: 0x99821c1a7C32D7A53B81098e20cc0fE07cC44601 +DvmFactoryAddress: 0x6cbAE38DF513356878cF8e859A33E0eA92BfE023 +Init DvmFactory Tx: 0xdbb4374216cd207617596eb991ad26a3fc7a47ba6563adf93b874ea10cd6be39 +UnownedDvmFactoryAddress: 0x392F73cA7C6ec09B0C06B8a55e1490e3399ba3C2 +DppFactoryAddress: 0x92fE64e923d3B2A2479fACfFF7DAE8a3056Dc4E1 +Init DppFactory Tx: 0x407fec4324df2808358852b22f7ec6037d92bdb1e9b880a811e90a334cd6db4e +DODOProxyV2 Address: 0xdaE7617994772B6B1E3D74c907F7881FE86c7239 +Init DODOProxyV2 Tx: 0x39321c35ccde44b24edc380b3cfba860694624708fa1de34a3c0ff31b7757e72 +DODOApprove Init tx: 0xb02f340245a8a7c5fdd4f5c64e9137793cf238bfda348039eb97d8e2dabaf1ab +==================================================== +network type: kovan +Deploy time: 2020/12/23 下午10:02:35 +Deploy type: HELPER V2 +DODOV2RouteHelper Address: 0x2255ca84C5Bc2df159d002d1839f0C018D2BAd63 +==================================================== +network type: kovan +Deploy time: 2020/12/24 上午11:39:38 +Deploy type: V2 +DvmTemplateAddress: 0x9d37C6BB2e3D62263099faAF2940C0De67a4FD6F +DppTemplateAddress: 0x75CC454c9771A7f1AF4848C4c3775C98b601563E +CpTemplateAddress: 0x60580b981f2670C872AF0119b21C6596Ad7C5D51 +DODOApprove Address: 0x9F332B3a07536A2b0caaB3E3b9D2a5dFD6173c6c +DvmFactoryAddress: 0xF2a62693FB14b326C3719e5aeEF28e8e66dC954e +Init DvmFactory Tx: 0x111defacfa6730734bcc9fad7a095d1c1f3c058995ebaee7c6cae7545134c56a +DppFactoryAddress: 0x58Bc8D248AcbE95CE29CF893C6666D58AF92d941 +Init DppFactory Tx: 0xe5d4f8149977021327e90bf5bd9a7857bb524f7fcd882f1bb00ded1652df6370 +CpFactoryAddress: 0xD2d3c70C75E4Bb10eE366C8f54A06cCdDF5F3906 +DODOV2RouteHelper Address: 0x3249f48a507588740d291c154a6b607521e4cDED +DODOProxyV2 Address: 0xd5C27770E8e2F43B959484971472a0019b17fA56 +Init DODOProxyV2 Tx: 0xdb70bb4355e71060803df0fb9833e03a4e4e657af2afbf1e732cf996614ca8c2 +DODOApprove Init tx: 0x10e6bc3c71ac60145c599acbcfeb7571173445b02756a7d98c7d4e6dbe6f4ecd diff --git a/kovan-mock-v2.0.txt b/kovan-mock-v2.0.txt index 0d284d1..367a3cb 100644 --- a/kovan-mock-v2.0.txt +++ b/kovan-mock-v2.0.txt @@ -136,3 +136,75 @@ Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3 Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xbded78906a95f25ba22720ce45cff94fb015e921294eeb3c4a20402269cc2bba Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x9ebcf8d585ac9374bab0798b493ee64845daa81d289b8b3b6262785c401737d1 Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xaceb4d156bdcaf037e76442275da4e521ee13a02e3b16da34704d6e712d534e4 +==================================================== +network type: kovan +Deploy time: 2020/12/23 下午10:06:11 +Mock POOL Tx: V2 +Approve:0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE Tx: 0xb8998d7b4f18e2cc3a2926f8054e3bc04eb6f71ae78744837264268530e867e1 +Approve:0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA Tx: 0xa20a80abb4da33f882f21247f15b5069972d1ed103faca805fb930c5c9a61a25 +Approve:0xFE1133ea03d701C5006b7f065bBf987955E7A67C Tx: 0x368867d511f3c1af12f4cc8c20ca48f8f8add12bdd315728da4db8149b048936 +Approve:0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C Tx: 0x2ee2c74ffb97191a8480e348613d9e84c64dcbf8e1c11a5c30de64b1947df554 +Approve:0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f Tx: 0x293061f92c46ec349bfad543b9a64066a2ee61e265db5ba306aa1a6df3cc1e72 +Approve:0x6462794c19e6b4543BEC56200212c7c746bbB9eB Tx: 0xd18106912d26fb366174d34790933699992d1ad6bade18faa5e6c4e6f6246a50 +Approve:0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x859663ea7c3a429a10773108291e2ddca0dcedca3f7e193fe3fb5654f01dd61a +Approve:0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x7dac7e0de043032525fe161d7eef9920c8e2ef58cd604ea241f244440e591217 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x0a7ba01be3758da3bc2842e19f6da4ff969b96cd9e7ec09c744bdcf473662e1b +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x531876bbe684081733014488222d666c68af96543ee656b266929644569ab1b5 +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x71c11833854ee92acc270ab42e1d7a1674b8159c6202181bae9b6a084c06504d +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xa222d2888d15b159a3f60d7d569b48b7922ebdbcc66b024b1f9c5d1db369e6db +==================================================== +network type: kovan +Deploy time: 2020/12/23 下午10:12:23 +Mock POOL Tx: V2 +Approve:0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE Tx: 0x7f385e1d55aec77540565dcbf02d768257de16f98f77087c6352d474065cfda6 +Approve:0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA Tx: 0x5cad25f104a8d9852cf035f73ed88a0430b6dbb79fa251ada9ada2ff795aebd0 +Approve:0xFE1133ea03d701C5006b7f065bBf987955E7A67C Tx: 0xfc3dcd661a9b3909e6958953db895e56424041cfc8b5854e4e46a60ef2269cfc +Approve:0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C Tx: 0xf9f4fc4d2a88df0ced892e25d1afd063f677b9f0a9b57ecd1b80572e0e65e488 +Approve:0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f Tx: 0xf139be9e478b24f45adeef91c3e774c66713ee4af281b4fd67aa329b9c015825 +Approve:0x6462794c19e6b4543BEC56200212c7c746bbB9eB Tx: 0xb3c1ce35b5a18b1ee9568cde368fbe4d050ef789f0c89c7b3d4c5d47d272fe20 +Approve:0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x8ee85f0292abeefe38b5de519a7e0f6694f7cb85e0ce252c45bab62e1fec0fe7 +Approve:0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x38eefe0542e5d07a74a24aa76634716457a27e53804909c5fb6caab96af12fcf +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x944c53418febfb42d93328007f4c0d2e31f9091f5a99b2126543681651e696f5 +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x89be70e2dadca73db3dcdb9258731b88600e786328cfb0fff3786b7809683046 +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0xe3e810553bb6bb4ea3c40370af53db16c54d392c3f4f0a289cb7571bb2ca91b1 +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x325d7960defbf9382c84d863478d2a5cdb70d30ced8b922eeb4f890183a0eeea +==================================================== +network type: kovan +Deploy time: 2020/12/23 下午10:18:27 +Mock POOL Tx: V2 +Approve:0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE Tx: 0xb8847c980265142fcf575b33e1c3b2dbf42b5cef7ef22d21b33a568b5b2bf453 +Approve:0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA Tx: 0x55d725b1d704b51d65c29458f7c9d717e8d11c8b44c268f49c2431cc1e761121 +Approve:0xFE1133ea03d701C5006b7f065bBf987955E7A67C Tx: 0xad8c03fe37a7462c816a09f73c8decd9e6b0fa5ab750adcf0ae87ba4cee9d18d +Approve:0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C Tx: 0x305e4b64e2ecc55c653f00ddeaa4135cdb6555cd9529d93499a0d440acf00768 +Approve:0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f Tx: 0xae5795ceb81cf30d5c8f901137d5b4a05b550d28be2572edd0f1dd6b6511af70 +Approve:0x6462794c19e6b4543BEC56200212c7c746bbB9eB Tx: 0x805317786b98166c4857191b016959f7e3d843fe4f535a154ea63c4fd18b33bb +Approve:0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x6549b00d575d11b2896e3820ea45f7275c779aaa6280236010483e748c490d03 +Approve:0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x5623cb45c81fe9cb3c567a80fa08ff2da2f0aca082186404b52bab4a88d497a2 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x0f8d09809616a61902a6c21cf980625eefdc178eb19e143c296197cfa4a1b306 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x046196c6365fb7839efb424189827c474cb8f7d827f8d5e014655fe35b32fb9d +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x5584b926faf63651447d72c3d6369ffc27e9b4bf7429fa6baf1f4e7fa0bbf3e7 +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xb60b498ed12ecc1ce739d33d2e8460b7f4a479e188c1d376ec598ebffa479389 +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x9cb2ae41808ee9118d1843b6317b6820763ff664f18ec2047e57ad7b4bddf519 +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x2bcae29b1b0a68215e04a7ba5bf8135ead8e9f5122567219ad06ed4438f62e5c +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x99e5776171eddfbe714afe60fbe4cfc7b61bc0e3dc1d111dc52536ecc23f761c +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xf6d5abe93d1c64c9b33b7fd1325b05c80c71e475a3484ff9bd447f9db5866d93 +==================================================== +network type: kovan +Deploy time: 2020/12/24 上午11:47:25 +Mock POOL Tx: V2 +Approve:0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE Tx: 0xbeee55d0af864da7c8e8c6962d488969aefb010c7b9b5e9828e6a0339a142251 +Approve:0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA Tx: 0xe8e854b40f696cf64f28e217eb26823ce4363c9cbb44edb04c2bbb45c6515ee5 +Approve:0xFE1133ea03d701C5006b7f065bBf987955E7A67C Tx: 0x85a7b71466180ab6f1d163c284160920a8720abcb9841ecd4d0cb7f3292c7010 +Approve:0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C Tx: 0xf3192fdeb49c7213cc21d8a6894237885ace25b565c7a9de3209528b84474a28 +Approve:0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f Tx: 0x9ede00579795e483dda95cfa01aaf9b3b2075f18e9435fc2455c9d7e9ca92ce4 +Approve:0x6462794c19e6b4543BEC56200212c7c746bbB9eB Tx: 0x8cbb38788c2a20b6d921c1089d8e275acdbd4c64dadfa1b0a596b3806861a787 +Approve:0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0xd455081eefaa81582abff9563db7dd4cc99e73eb72c006d7b343f5b90fb60743 +Approve:0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x8781fce0343948df4a2c91f3e27c23f86f6cf34275a955fc6fbe3cb78f5f4f03 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0xefda1022e036008247eff6d1dd86e9d764818af8ba036cee5f56b6299155c503 +Create DVM: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xa923aa193b804c5388fcee54d5062993a388becc95e66e0412f7b4a75e5a533a +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0x3e07db9d128be0e853843cd59b74ff04dd730d47604cd3ccb5bd9338868a81b1 +Create DVM: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xb33d6496422b6135667198d4fe1c8d7a7340d95741d741d912ac156cbd636726 +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0xb5c04813d12c04cfe3b2fe8af8d27e5460dcadc2657f52ff7b68536d0f67b6cc +Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0x3b53391eb40bf8839f41a58adf18fe02682fdc7be9f540d1737f889b8c9720d5 +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e Tx: 0xa82e90e7d03aa75cfc3d2ecf6a8eaf2c9e2a77a5d43b1c0dc7575f46d7f5cf7b +Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Tx: 0xd4746f0f885d150764d89299bbbdea2c06bc08ab121bdf151d999daf5efacdb8 diff --git a/migrations/3_deploy_v2.js b/migrations/3_deploy_v2.js index e2e7cf2..d3ab6f0 100644 --- a/migrations/3_deploy_v2.js +++ b/migrations/3_deploy_v2.js @@ -16,7 +16,6 @@ const DppAdminTemplate = artifacts.require("DPPAdmin"); const CpTemplate = artifacts.require("CP"); const DvmFactory = artifacts.require("DVMFactory"); -const UnownedDvmFactory = artifacts.require("UnownedDVMFactory"); const DppFactory = artifacts.require("DPPFactory"); const CpFactory = artifacts.require("CrowdPoolingFactory"); @@ -34,6 +33,7 @@ module.exports = async (deployer, network, accounts) => { let WETHAddress = ""; let chiAddress = ""; let DODOCalleeHelperAddress = ""; + let DODORouteV2HelperAddress = ""; //Template let CloneFactoryAddress = ""; let FeeRateModelTemplateAddress = ""; @@ -52,7 +52,6 @@ module.exports = async (deployer, network, accounts) => { let CpTemplateAddress = ""; //Facotry let DvmFactoryAddress = ""; - let UnownedDvmFactoryAddress = ""; let DppFactoryAddress = ""; let CpFactoryAddress = ""; //Approve @@ -67,6 +66,7 @@ module.exports = async (deployer, network, accounts) => { WETHAddress = "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b"; chiAddress = "0x0000000000004946c0e9f43f4dee607b0ef1fa1c"; DODOCalleeHelperAddress = "0x507EBbb195CF54E0aF147A2b269C08a38EA36989"; + DODORouteV2HelperAddress = ""; //Template CloneFactoryAddress = "0xf7959fe661124C49F96CF30Da33729201aEE1b27"; FeeRateModelTemplateAddress = "0xEF3137780B387313c5889B999D03BdCf9aeEa892"; @@ -82,12 +82,11 @@ module.exports = async (deployer, network, accounts) => { DvmAdminTemplateAddress = "0x45f455d7E233403F10b7AFCB0d0d0c0d775AFf63"; DppTemplateAddress = ""; DppAdminTemplateAddress = "0xDfdd9e1693C3A6AF25307c9dA561021f9e685878"; - CpTemplateAddress = "0x59652F06fEdDe7780E8fa5C88CE850F67F26F0Fc"; + CpTemplateAddress = ""; //Factory - DvmFactoryAddress = "0x577481Bde7327e732f78e9f6AF44632CB8DDe80e"; - UnownedDvmFactoryAddress = ""; - DppFactoryAddress = "0xC510D9c58aa226c698F56b22b86A3031b8cBf551"; - CpFactoryAddress = "0x9F90AD19C15d7aF4291EB17b637DF78EaC639EA3"; + DvmFactoryAddress = ""; + DppFactoryAddress = ""; + CpFactoryAddress = ""; //Approve DODOApproveAddress = ""; //Account @@ -117,7 +116,6 @@ module.exports = async (deployer, network, accounts) => { CpTemplateAddress = ""; //Factory DvmFactoryAddress = ""; - UnownedDvmFactoryAddress = ""; DppFactoryAddress = ""; CpFactoryAddress = ""; //Proxy @@ -149,7 +147,6 @@ module.exports = async (deployer, network, accounts) => { CpTemplateAddress = ""; //Factory DvmFactoryAddress = ""; - UnownedDvmFactoryAddress = ""; DppFactoryAddress = ""; CpFactoryAddress = ""; //Proxy @@ -166,7 +163,7 @@ module.exports = async (deployer, network, accounts) => { logger.log("Deploy time: " + new Date().toLocaleString()); logger.log("Deploy type: HELPER V2"); - await deployer.deploy(DODOV2RouteHelper,DvmFactoryAddress,DppFactoryAddress); + await deployer.deploy(DODOV2RouteHelper, "0x6cbAE38DF513356878cF8e859A33E0eA92BfE023","0x92fE64e923d3B2A2479fACfFF7DAE8a3056Dc4E1"); DODOV2RouteHelperAddress = DODOV2RouteHelper.address; logger.log("DODOV2RouteHelper Address: ", DODOV2RouteHelperAddress); } @@ -283,7 +280,10 @@ module.exports = async (deployer, network, accounts) => { DvmAdminTemplateAddress, FeeRateModelTemplateAddress, PermissionManagerTemplateAddress, - DefaultGasSourceAddress + DefaultGasSourceAddress, + defaultMaintainer, + DefaultMtFeeRateAddress, + DefaultPermissionAddress ); DvmFactoryAddress = DvmFactory.address; logger.log("DvmFactoryAddress: ", DvmFactoryAddress); @@ -292,21 +292,6 @@ module.exports = async (deployer, network, accounts) => { logger.log("Init DvmFactory Tx:", tx.tx); } - if (UnownedDvmFactoryAddress == "") { - await deployer.deploy( - UnownedDvmFactory, - CloneFactoryAddress, - DvmTemplateAddress, - FeeRateModelTemplateAddress, - defaultMaintainer, - DefaultMtFeeRateAddress, - DefaultPermissionAddress, - DefaultGasSourceAddress - ); - UnownedDvmFactoryAddress = UnownedDvmFactory.address; - logger.log("UnownedDvmFactoryAddress: ", UnownedDvmFactoryAddress); - } - if (DppFactoryAddress == "") { await deployer.deploy( DppFactory, @@ -331,7 +316,7 @@ module.exports = async (deployer, network, accounts) => { CpFactory, CloneFactoryAddress, CpTemplateAddress, - UnownedDvmFactoryAddress, + DvmFactoryAddress, FeeRateModelTemplateAddress, defaultMaintainer, DefaultMtFeeRateAddress, @@ -342,6 +327,12 @@ module.exports = async (deployer, network, accounts) => { logger.log("CpFactoryAddress: ", CpFactoryAddress); } + if (DODORouteV2HelperAddress == "") { + await deployer.deploy(DODOV2RouteHelper, DvmFactoryAddress, DppFactoryAddress); + DODOV2RouteHelperAddress = DODOV2RouteHelper.address; + logger.log("DODOV2RouteHelper Address: ", DODOV2RouteHelperAddress); + } + //Proxy await deployer.deploy( DODOProxyV2, diff --git a/migrations/4_deploy_v2_mock.js b/migrations/4_deploy_v2_mock.js index 888c116..e2c0ba4 100644 --- a/migrations/4_deploy_v2_mock.js +++ b/migrations/4_deploy_v2_mock.js @@ -16,7 +16,7 @@ const POOL_PARAM = [ quoteAddr: "0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e", //USDC lpFeeRate: "3000000000000000", //0.003 mtFeeRate: "1000000000000000", //0.001 - i: "10000000000000000000", //10 + i: "10000000", //10 k: "500000000000000000" //0.5 }, { @@ -24,23 +24,23 @@ const POOL_PARAM = [ quoteAddr: "0x156595bAF85D5C29E91d959889B022d952190A64", //USDT lpFeeRate: "3000000000000000", //0.003 mtFeeRate: "1000000000000000", //0.001 - i: "10000000000000000000", //10 - k: "800000000000000000" //0.8 + i: "10000000", //10 + k: "0" //0 }, { baseAddr: "0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA", //ABC1 quoteAddr: "0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e", //USDC lpFeeRate: "3000000000000000", //0.003 mtFeeRate: "1000000000000000", //0.001 - i: "5000000000000000000", //5 - k: "800000000000000000" //0.8 + i: "5000000", //5 + k: "1000000000000000000" //1 }, { baseAddr: "0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA", //ABC1 quoteAddr: "0x156595bAF85D5C29E91d959889B022d952190A64", //USDT lpFeeRate: "3000000000000000", //0.003 mtFeeRate: "1000000000000000", //0.001 - i: "5000000000000000000", //5 + i: "8000000", //8 k: "900000000000000000" //0.9 } ]; @@ -51,8 +51,8 @@ module.exports = async (deployer, network, accounts) => { let ERC20TemplateAddress = "0x77d2e257241e6971688b08bdA9F658F065d7bb41"; let MintableERC20TemplateAddress = "0xA45a64DAba80757432fA4d654Df12f65f020C13C"; let ERC20FactoryAddress = "0xCb1A2f64EfB02803276BFB5a8D511C4D950282a0"; - let DODOApproveAddress = "0x6eA356EA3c1780c02873591d93451Ed3f4509bEa"; - let DODOProxyV2Address = "0xfEC85D8ea0E85ABa5b35aca959845878113BE108"; + let DODOApproveAddress = "0x9F332B3a07536A2b0caaB3E3b9D2a5dFD6173c6c"; + let DODOProxyV2Address = "0xd5C27770E8e2F43B959484971472a0019b17fA56"; const provider = new Web3.providers.HttpProvider("https://kovan.infura.io/v3/22d4a3b2df0e47b78d458f43fe50a199"); @@ -76,12 +76,16 @@ module.exports = async (deployer, network, accounts) => { const token3Addr = "0x123ee47BaE3F64d422F2FB18ac444B47c1880F4C"; const token4Addr = "0x0ab8EF8B19655F32959c83e5fC5cD6536065D28f"; const token5Addr = "0x6462794c19e6b4543BEC56200212c7c746bbB9eB"; + const quote0Addr = "0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e"; + const quote1Addr = "0x156595bAF85D5C29E91d959889B022d952190A64"; 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); + const quote0 = await ERC20Template.at(quote0Addr); + const quote1 = await ERC20Template.at(quote1Addr); tx = await token0.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); logger.log("Approve:" + token0Addr + " Tx:", tx.tx); @@ -95,11 +99,15 @@ module.exports = async (deployer, network, accounts) => { logger.log("Approve:" + token4Addr + " Tx:", tx.tx); tx = await token5.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); logger.log("Approve:" + token5Addr + " Tx:", tx.tx); + tx = await quote0.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + logger.log("Approve:" + quote0Addr + " Tx:", tx.tx); + tx = await quote1.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + logger.log("Approve:" + quote1Addr + " Tx:", tx.tx); } const DODOProxyV2Instance = await DODOProxyV2.at(DODOProxyV2Address); const assetTo = accounts[0]; - const baseInAmount = web3.utils.toWei("10000", 'ether'); - const quoteInAmount = 0; + const baseInAmount = web3.utils.toWei("1000", 'ether'); + const quoteInAmount = web3.utils.toWei("100", 'mwei'); const deadline = Math.floor(new Date().getTime() / 1000 + 60 * 10); //DVM Pool for (var i = 0; i < POOL_PARAM.length; i++) { @@ -108,7 +116,7 @@ module.exports = async (deployer, network, accounts) => { POOL_PARAM[i].baseAddr, POOL_PARAM[i].quoteAddr, baseInAmount, - quoteInAmount, + 0, POOL_PARAM[i].lpFeeRate, POOL_PARAM[i].mtFeeRate, POOL_PARAM[i].i, diff --git a/test/CrowdPooling/CPSettle.test.ts b/test/CrowdPooling/CPSettle.test.ts index b211128..a10dcb6 100644 --- a/test/CrowdPooling/CPSettle.test.ts +++ b/test/CrowdPooling/CPSettle.test.ts @@ -10,7 +10,7 @@ import { logGas } from '../utils/Log'; import { CPContext, CPContextInitConfig } from '../utils/CrowdPoolingContext'; import BigNumber from 'bignumber.js'; import { assert } from 'chai'; -import { DVM_NAME, getContractWithAddress, UNOWNED_DVM_FACTORY_NAME } from '../utils/Contracts'; +import { DVM_NAME, getContractWithAddress } from '../utils/Contracts'; const truffleAssert = require('truffle-assertions'); let bidder1: string; diff --git a/test/CrowdPooling/CPSettleReversePool.test.ts b/test/CrowdPooling/CPSettleReversePool.test.ts index 8aafec9..c9b068e 100644 --- a/test/CrowdPooling/CPSettleReversePool.test.ts +++ b/test/CrowdPooling/CPSettleReversePool.test.ts @@ -10,7 +10,7 @@ import { logGas } from '../utils/Log'; import { CPContext, CPContextInitConfig } from '../utils/CrowdPoolingContext'; import BigNumber from 'bignumber.js'; // import { assert } from 'chai'; -import { DVM_NAME, getContractWithAddress, UNOWNED_DVM_FACTORY_NAME } from '../utils/Contracts'; +import { DVM_NAME, getContractWithAddress } from '../utils/Contracts'; import { assert } from 'chai'; const truffleAssert = require('truffle-assertions'); diff --git a/test/utils/Contracts.ts b/test/utils/Contracts.ts index d121814..4936fba 100644 --- a/test/utils/Contracts.ts +++ b/test/utils/Contracts.ts @@ -31,7 +31,6 @@ export const DODO_MINE_READER_NAME = "DODOMineReader" export const DVM_VAULT_NAME = "DVMVault" export const DVM_NAME = "DVM" export const DVM_FACTORY_NAME = "DVMFactory" -export const UNOWNED_DVM_FACTORY_NAME = "UnownedDVMFactory" export const DVM_PROXY_NAME = "DVMProxy" export const CONST_FEE_RATE_MODEL_NAME = "ConstFeeRateModel" export const PERMISSION_MANAGER_NAME = "PermissionManager" diff --git a/test/utils/CrowdPoolingContext.ts b/test/utils/CrowdPoolingContext.ts index 1b66edc..fd3475d 100644 --- a/test/utils/CrowdPoolingContext.ts +++ b/test/utils/CrowdPoolingContext.ts @@ -36,7 +36,7 @@ export interface CPContextInitConfig { export class CPContext { EVM: EVM; Web3: Web3; - UnownedDVMFactory: Contract; + DVMFactory: Contract; CP: Contract; BASE: Contract; QUOTE: Contract; @@ -72,15 +72,17 @@ export class CPContext { ["TestQuote", "QUOTE", 18] ); - this.UnownedDVMFactory = await contracts.newContract(contracts.UNOWNED_DVM_FACTORY_NAME, + this.DVMFactory = await contracts.newContract(contracts.DVM_FACTORY_NAME, [ cloneFactory.options.address, dvmTemplate.options.address, + "0x0000000000000000000000000000000000000000", feeRateModel.options.address, + "0x0000000000000000000000000000000000000000", + defaultGasSource.options.address, this.Maintainer, feeRateModel.options.address, - permissionManager.options.address, - defaultGasSource.options.address + permissionManager.options.address ] ) @@ -95,7 +97,7 @@ export class CPContext { this.QUOTE.options.address, permissionManager.options.address, feeRateModel.options.address, - this.UnownedDVMFactory.options.address + this.DVMFactory.options.address ], [ (await this.Web3.eth.getBlock(await this.Web3.eth.getBlockNumber())).timestamp, diff --git a/test/utils/ProxyContextV2.ts b/test/utils/ProxyContextV2.ts index 98bcdbf..d772dfd 100644 --- a/test/utils/ProxyContextV2.ts +++ b/test/utils/ProxyContextV2.ts @@ -27,7 +27,6 @@ export class ProxyContext { DVMFactory: Contract; DPPFactory: Contract; CPFactory: Contract; - UnownedDVMFactory: Contract; DODOApprove: Contract; DODOCalleeHelper: Contract; DODOSellHelper: Contract; @@ -74,21 +73,11 @@ export class ProxyContext { dvmAdminTemplate.options.address, feeRateModelTemplate.options.address, permissionManagerTemplate.options.address, - defaultGasSource.options.address - ] - ) - - - this.UnownedDVMFactory = await contracts.newContract(contracts.UNOWNED_DVM_FACTORY_NAME, - [ - cloneFactory.options.address, - dvmTemplate.options.address, - feeRateModelTemplate.options.address, + defaultGasSource.options.address, this.Deployer, feeRateModelTemplate.options.address, - permissionManagerTemplate.options.address, - defaultGasSource.options.address - ] + permissionManagerTemplate.options.address + ] ) this.DODOApprove = await contracts.newContract( @@ -113,7 +102,7 @@ export class ProxyContext { [ cloneFactory.options.address, cpTemplate.options.address, - this.UnownedDVMFactory.options.address, + this.DVMFactory.options.address, feeRateModelTemplate.options.address, this.Deployer, feeRateModelTemplate.options.address,