diff --git a/config/rinkeby-config.js b/config/rinkeby-config.js index 9f91ff6..2a45ebb 100644 --- a/config/rinkeby-config.js +++ b/config/rinkeby-config.js @@ -14,6 +14,7 @@ module.exports = { //Template CloneFactory: "0x823ECBfCCD3e6Cb67d4c9334F743BEe0E60A7349", FeeRateModel: "0x0ae835f585638CCbD4D7eAA339ED033f8194Bcfe", + FeeRateDIP3: "0x7c9Bd1C5A521a3a39c7A1fb7F0C291a23c3E628A", UserQuota: "0x20D68Cf24211F24Fa0F78a48ab44Dc7da5f55e38", FeeRateImpl:"0x08E485cF3A2d62DC43c37A783abBC85df540E821", PermissionManager: "0x7949a4D350F69ef5Ff4c3079751250f5b7B86a00", @@ -34,7 +35,7 @@ module.exports = { DPPFactory: "0x510b49803E356C750f3a93bA5508C0FFD9f71bDD", DSPFactory: "0xa1ab675cB49BA0DC3F39fA4C20E216572A8dD3c8", CrowdPoolingFactory: "0x45CF2EB0DB78ad56450060557BC8D4F386F826cf", - CrowdPoolingFactoryV2: "0x79e15fc9B4154d90424b588533AB277D30D573f4", + CrowdPoolingFactoryV2: "0x00bda84D618308bdEa0556df64337075396184DF", UpCpFactory: "0x9DbbfFE2C5BA6c931C518199C861ff0b6067c2EB", ERC20Factory: "0x48476599281CB7DD46dbE47264C4594d1d2E19A8", ERC20V2Factory: "0x7A22e361cB74E69B5B1C800A3aAbE3E50e84F4F6", @@ -57,7 +58,7 @@ module.exports = { DODOV2Proxy: "0xba001E96AF87bF9d8D0BDA667067A9921FE6d294", DSPProxy: "0x0f6345D1d07C134BB0973AD102F38eA9195F6f78", CpProxy: "0xa2846A259a05b949DE6e3599eE5cFaA818199E9C", - CpProxyV2: "0x3d5F3020Aa41b6de1f8e49777F4b708f016Dc65B", + CpProxyV2: "0x89D1C1ec29549470f033Cda5854b507ab488eb9F", DPPProxy: "0x45136c2455Dd2631E31ab884cf167eC618CCf39a", RouteProxy: "0xe2b538a781eB5a115a1359B8f363B9703Fd19dE6", DODOMineV3Proxy: "0xcb15BBb59AC8a4B64A4db9B8d9F66c397d89Bd22", diff --git a/contracts/DODOFee/FeeRateDIP3Impl.sol b/contracts/DODOFee/FeeRateDIP3Impl.sol index 0a45a83..c33cb19 100644 --- a/contracts/DODOFee/FeeRateDIP3Impl.sol +++ b/contracts/DODOFee/FeeRateDIP3Impl.sol @@ -190,6 +190,6 @@ contract FeeRateDIP3Impl is InitializableOwnable { } function _kjudge(bytes32 _hashPoolVersion) internal pure returns (bool) { - return (_hashPoolVersion == keccak256(abi.encodePacked("DVM 1.0.2")) || _hashPoolVersion == keccak256(abi.encodePacked("DSP 1.0.1")) || _hashPoolVersion == keccak256(abi.encodePacked("DPP 1.0.0"))); + return (_hashPoolVersion == keccak256(abi.encodePacked("DVM 1.0.2")) || _hashPoolVersion == keccak256(abi.encodePacked("DSP 1.0.1")) || _hashPoolVersion == keccak256(abi.encodePacked("DPP 1.0.0")) || _hashPoolVersion == keccak256(abi.encodePacked("DPP Advanced 1.0.0"))); } } diff --git a/contracts/Factory/CrowdPoolingFactory.sol b/contracts/Factory/CrowdPoolingFactory.sol index be10f4b..ef58995 100644 --- a/contracts/Factory/CrowdPoolingFactory.sol +++ b/contracts/Factory/CrowdPoolingFactory.sol @@ -17,6 +17,7 @@ import {DecimalMath} from "../lib/DecimalMath.sol"; import {FeeRateModel} from "../lib/FeeRateModel.sol"; interface IFeeRateImpl { + function getFeeRate(address pool, address trader) external view returns (uint256); function addCpPoolInfo(address cpPool, address quoteToken, int globalQuota, address feeAddr, address quotaAddr) external; } diff --git a/migrations/3_deploy_v2.js b/migrations/3_deploy_v2.js index 33d991e..bc9672a 100644 --- a/migrations/3_deploy_v2.js +++ b/migrations/3_deploy_v2.js @@ -8,6 +8,7 @@ const CloneFactory = artifacts.require("CloneFactory"); const FeeRateModelTemplate = artifacts.require("FeeRateModel"); const UserQuota = artifacts.require("UserQuota"); const FeeRateImpl = artifacts.require("FeeRateImpl"); +const FeeRateDIP3 = artifacts.require("FeeRateDIP3Impl") const PermissionManagerTemplate = artifacts.require("PermissionManager"); const DODOSellHelper = artifacts.require("DODOSellHelper"); const DODOV1PmmHelper = artifacts.require("DODOV1PmmHelper"); @@ -71,12 +72,14 @@ module.exports = async (deployer, network, accounts) => { let DefaultMtFeeRateAddress = CONFIG.FeeRateModel; let UserQuotaAddress = CONFIG.UserQuota; let FeeRateImplAddress = CONFIG.FeeRateImpl; + let FeeRateDIP3ImplAddress = CONFIG.FeeRateDIP3; let DefaultPermissionAddress = CONFIG.PermissionManager; let DvmTemplateAddress = CONFIG.DVM; let DspTemplateAddress = CONFIG.DSP; let DppTemplateAddress = CONFIG.DPP; let DppAdminTemplateAddress = CONFIG.DPPAdmin; let CpTemplateAddress = CONFIG.CP; + let CpV2TemplateAddress = CONFIG.CPV2; let ERC20TemplateAddress = CONFIG.ERC20; let CustomERC20TemplateAddress = CONFIG.CustomERC20; let MineV2TemplateAddress = CONFIG.ERC20MineV2; @@ -87,6 +90,7 @@ module.exports = async (deployer, network, accounts) => { let DspFactoryAddress = CONFIG.DSPFactory; let DppFactoryAddress = CONFIG.DPPFactory; let CpFactoryAddress = CONFIG.CrowdPoolingFactory; + let CpV2FactoryAddress = CONFIG.CrowdPoolingFactoryV2; let UpCpFactoryAddress = CONFIG.UpCpFactory; let ERC20V2FactoryAddress = CONFIG.ERC20V2Factory; let DODOMineV3RegistryAddress = CONFIG.DODOMineV3Registry; @@ -105,6 +109,7 @@ module.exports = async (deployer, network, accounts) => { let DODOV2ProxyAddress = CONFIG.DODOV2Proxy; let DODODspProxyAddress = CONFIG.DSPProxy; let DODOCpProxyAddress = CONFIG.CpProxy; + let DODOCpV2ProxyAddress = CONFIG.CpProxyV2; let DODODppProxyAddress = CONFIG.DPPProxy; let DODOMineV3ProxyAddress = CONFIG.DODOMineV3Proxy; let DODORouteProxyAddress = CONFIG.RouteProxy; @@ -188,6 +193,12 @@ module.exports = async (deployer, network, accounts) => { logger.log("Init FeeRateImpl Tx:", tx.tx); } + if (FeeRateDIP3ImplAddress == "") { + await deployer.deploy(FeeRateDIP3); + FeeRateDIP3ImplAddress = FeeRateDIP3.address; + logger.log("FeeRateDIP3Impl Address: ", FeeRateDIP3ImplAddress); + } + if (DefaultPermissionAddress == "") { await deployer.deploy(PermissionManagerTemplate); DefaultPermissionAddress = PermissionManagerTemplate.address; @@ -347,6 +358,23 @@ module.exports = async (deployer, network, accounts) => { logger.log("Init CpFactory Tx:", tx.tx); } + if (CpV2FactoryAddress == "") { + await deployer.deploy( + CpFactory, + CloneFactoryAddress, + CpTemplateAddress, + DvmFactoryAddress, + defaultMaintainer, + DefaultMtFeeRateAddress, + DefaultPermissionAddress + ); + CpV2FactoryAddress = CpFactory.address; + logger.log("CpV2FactoryAddress: ", CpV2FactoryAddress); + const CpFactoryInstance = await CpFactory.at(CpV2FactoryAddress); + var tx = await CpFactoryInstance.initOwner(multiSigAddress); + logger.log("Init CpFactory Tx:", tx.tx); + } + if (DspFactoryAddress == "") { await deployer.deploy( DspFactory, @@ -443,6 +471,18 @@ module.exports = async (deployer, network, accounts) => { logger.log("CpProxy address: ", DODOCpProxy.address); } + if (DODOCpV2ProxyAddress == "") { + await deployer.deploy( + DODOCpProxy, + WETHAddress, + CpV2FactoryAddress, + UpCpFactoryAddress, + DODOApproveProxyAddress + ); + DODOCpV2ProxyAddress = DODOCpProxy.address; + logger.log("CpV2Proxy address: ", DODOCpProxy.address); + } + if (DODODppProxyAddress == "") { await deployer.deploy( DODODppProxy,