2020-12-07 16:20:59 +08:00
|
|
|
const fs = require("fs");
|
2020-12-22 13:18:23 +08:00
|
|
|
const { deploySwitch } = require('../truffle-config.js')
|
2020-12-07 16:20:59 +08:00
|
|
|
const file = fs.createWriteStream("../deploy-detail-v2.0.txt", { 'flags': 'a' });
|
|
|
|
|
let logger = new console.Console(file, file);
|
2021-03-03 23:08:41 +08:00
|
|
|
const { GetConfig } = require("../configAdapter.js")
|
2020-12-07 16:20:59 +08:00
|
|
|
|
|
|
|
|
const CloneFactory = artifacts.require("CloneFactory");
|
2020-12-15 11:17:19 +08:00
|
|
|
const FeeRateModelTemplate = artifacts.require("FeeRateModel");
|
2021-11-09 10:53:38 +08:00
|
|
|
const UserQuota = artifacts.require("UserQuota");
|
|
|
|
|
const FeeRateImpl = artifacts.require("FeeRateImpl");
|
2022-04-22 16:05:36 +08:00
|
|
|
const FeeRateDIP3 = artifacts.require("FeeRateDIP3Impl")
|
2020-12-15 11:17:19 +08:00
|
|
|
const PermissionManagerTemplate = artifacts.require("PermissionManager");
|
2021-05-11 15:03:40 +08:00
|
|
|
const DODOSellHelper = artifacts.require("DODOSellHelper");
|
|
|
|
|
const DODOV1PmmHelper = artifacts.require("DODOV1PmmHelper");
|
2021-04-27 16:18:39 +08:00
|
|
|
const DODOV2RouteHelper = artifacts.require("DODOV2RouteHelper");
|
2021-08-30 19:26:06 +08:00
|
|
|
const DODOSwapCalcHelper = artifacts.require("DODOSwapCalcHelper");
|
|
|
|
|
const ERC20Helper = artifacts.require("ERC20Helper");
|
|
|
|
|
const MultiCall = artifacts.require("Multicall");
|
|
|
|
|
const DODOCalleeHelper = artifacts.require("DODOCalleeHelper");
|
2020-12-15 11:17:19 +08:00
|
|
|
|
2020-12-07 16:20:59 +08:00
|
|
|
const DvmTemplate = artifacts.require("DVM");
|
2021-05-11 15:03:40 +08:00
|
|
|
const DspTemplate = artifacts.require("DSP");
|
2021-08-30 19:26:06 +08:00
|
|
|
const DppTemplate = artifacts.require("DPP");
|
2020-12-07 16:20:59 +08:00
|
|
|
const DppAdminTemplate = artifacts.require("DPPAdmin");
|
2022-05-23 21:23:54 +08:00
|
|
|
const DppAdvancedTemplate = artifacts.require("DPPAdvanced");
|
|
|
|
|
const DppAdvancedAdminTemplate = artifacts.require("DPPAdvancedAdmin");
|
2020-12-15 11:17:19 +08:00
|
|
|
const CpTemplate = artifacts.require("CP");
|
2021-01-26 17:53:49 +08:00
|
|
|
const ERC20Template = artifacts.require("InitializableERC20");
|
2021-08-30 19:26:06 +08:00
|
|
|
const CustomERC20Template = artifacts.require("CustomERC20");
|
2022-05-23 21:23:54 +08:00
|
|
|
const CustomMintableERC20Template = artifacts.require("CustomMintableERC20");
|
2021-08-30 19:26:06 +08:00
|
|
|
const ERC20MineV2 = artifacts.require("ERC20Mine");
|
|
|
|
|
const ERC20MineV3 = artifacts.require("ERC20MineV3");
|
2021-01-26 17:53:49 +08:00
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
const ERC20V2Factory = artifacts.require("ERC20V2Factory");
|
2022-05-23 21:23:54 +08:00
|
|
|
const ERC20V3Factory = artifacts.require("ERC20V3Factory");
|
2020-12-07 16:20:59 +08:00
|
|
|
const DvmFactory = artifacts.require("DVMFactory");
|
|
|
|
|
const DppFactory = artifacts.require("DPPFactory");
|
2021-05-11 15:03:40 +08:00
|
|
|
const DspFactory = artifacts.require("DSPFactory");
|
2020-12-15 11:17:19 +08:00
|
|
|
const CpFactory = artifacts.require("CrowdPoolingFactory");
|
2021-05-11 15:03:40 +08:00
|
|
|
const UpCpFactory = artifacts.require("UpCrowdPoolingFactory");
|
2021-08-30 19:26:06 +08:00
|
|
|
const MineV3Registry = artifacts.require("DODOMineV3Registry");
|
|
|
|
|
const MineV2Factory = artifacts.require("DODOMineV2Factory");
|
2020-12-07 16:20:59 +08:00
|
|
|
|
|
|
|
|
const DODOApprove = artifacts.require("DODOApprove");
|
2021-01-26 17:53:49 +08:00
|
|
|
const DODOApproveProxy = artifacts.require("DODOApproveProxy");
|
2021-05-11 15:03:40 +08:00
|
|
|
|
|
|
|
|
const DODODspProxy = artifacts.require("DODODspProxy");
|
|
|
|
|
const DODOCpProxy = artifacts.require("DODOCpProxy");
|
2021-10-11 23:42:56 +08:00
|
|
|
const DODODppProxy = artifacts.require("DODODppProxy");
|
2021-08-30 19:26:06 +08:00
|
|
|
const DODORouteProxy = artifacts.require("DODORouteProxy");
|
|
|
|
|
const DODOMineV3Proxy = artifacts.require("DODOMineV3Proxy");
|
2021-01-26 17:53:49 +08:00
|
|
|
const DODOProxyV2 = artifacts.require("DODOV2Proxy02");
|
2021-01-18 22:32:12 +08:00
|
|
|
|
|
|
|
|
const DODOV1Adapter = artifacts.require("DODOV1Adapter");
|
|
|
|
|
const DODOV2Adapter = artifacts.require("DODOV2Adapter");
|
|
|
|
|
const UniAdapter = artifacts.require("UniAdapter");
|
2020-12-22 13:18:23 +08:00
|
|
|
|
2020-12-07 16:20:59 +08:00
|
|
|
|
|
|
|
|
module.exports = async (deployer, network, accounts) => {
|
2021-03-03 23:08:41 +08:00
|
|
|
let CONFIG = GetConfig(network, accounts)
|
|
|
|
|
if (CONFIG == null) return;
|
|
|
|
|
//TOKEN
|
|
|
|
|
let WETHAddress = CONFIG.WETH;
|
|
|
|
|
|
|
|
|
|
//Helper
|
|
|
|
|
let DODOSellHelperAddress = CONFIG.DODOSellHelper;
|
|
|
|
|
let DODOCalleeHelperAddress = CONFIG.DODOCalleeHelper;
|
2021-04-27 16:18:39 +08:00
|
|
|
let DODORouteV2HelperAddress = CONFIG.DODOV2RouteHelper;
|
2021-03-03 23:08:41 +08:00
|
|
|
let DODOV1PmmHelperAddress = CONFIG.DODOV1PmmHelper;
|
2021-08-30 19:26:06 +08:00
|
|
|
let DODOSwapCalcHelperAddress = CONFIG.DODOSwapCalcHelper;
|
|
|
|
|
let ERC20HelperAddress = CONFIG.ERC20Helper;
|
|
|
|
|
let MultiCallAddress = CONFIG.MultiCall;
|
2021-03-03 23:08:41 +08:00
|
|
|
|
2020-12-15 11:17:19 +08:00
|
|
|
//Template
|
2021-03-03 23:08:41 +08:00
|
|
|
let CloneFactoryAddress = CONFIG.CloneFactory;
|
|
|
|
|
let DefaultMtFeeRateAddress = CONFIG.FeeRateModel;
|
2021-11-09 10:53:38 +08:00
|
|
|
let UserQuotaAddress = CONFIG.UserQuota;
|
|
|
|
|
let FeeRateImplAddress = CONFIG.FeeRateImpl;
|
2022-05-23 21:23:54 +08:00
|
|
|
let FeeRateDIP3ImplAddress = CONFIG.FeeRateDIP3Impl;
|
2021-03-03 23:08:41 +08:00
|
|
|
let DefaultPermissionAddress = CONFIG.PermissionManager;
|
|
|
|
|
let DvmTemplateAddress = CONFIG.DVM;
|
2021-05-11 15:03:40 +08:00
|
|
|
let DspTemplateAddress = CONFIG.DSP;
|
2022-05-23 21:23:54 +08:00
|
|
|
let DppTemplateAddress = CONFIG.DPP;
|
|
|
|
|
let DppAdminTemplateAddress = CONFIG.DPPAdmin;
|
|
|
|
|
let DppAdvancedTemplateAddress = CONFIG.DPPAdvanced;
|
|
|
|
|
let DppAdvancedAdminTemplateAddress = CONFIG.DPPAdvancedAdmin;
|
2021-03-03 23:08:41 +08:00
|
|
|
let CpTemplateAddress = CONFIG.CP;
|
2022-04-22 16:05:36 +08:00
|
|
|
let CpV2TemplateAddress = CONFIG.CPV2;
|
2021-03-03 23:08:41 +08:00
|
|
|
let ERC20TemplateAddress = CONFIG.ERC20;
|
2021-08-30 19:26:06 +08:00
|
|
|
let CustomERC20TemplateAddress = CONFIG.CustomERC20;
|
2022-05-23 21:23:54 +08:00
|
|
|
let CustomMintableERC20TemplateAddress = CONFIG.CustomMintableERC20;
|
2021-08-30 19:26:06 +08:00
|
|
|
let MineV2TemplateAddress = CONFIG.ERC20MineV2;
|
|
|
|
|
let MineV3TemplateAddress = CONFIG.ERC20MineV3;
|
2020-12-15 11:17:19 +08:00
|
|
|
|
|
|
|
|
//Facotry
|
2021-03-03 23:08:41 +08:00
|
|
|
let DvmFactoryAddress = CONFIG.DVMFactory;
|
2021-05-11 15:03:40 +08:00
|
|
|
let DspFactoryAddress = CONFIG.DSPFactory;
|
2021-03-03 23:08:41 +08:00
|
|
|
let DppFactoryAddress = CONFIG.DPPFactory;
|
|
|
|
|
let CpFactoryAddress = CONFIG.CrowdPoolingFactory;
|
2022-04-22 16:05:36 +08:00
|
|
|
let CpV2FactoryAddress = CONFIG.CrowdPoolingFactoryV2;
|
2021-05-11 15:03:40 +08:00
|
|
|
let UpCpFactoryAddress = CONFIG.UpCpFactory;
|
2021-08-30 19:26:06 +08:00
|
|
|
let ERC20V2FactoryAddress = CONFIG.ERC20V2Factory;
|
2022-05-23 21:23:54 +08:00
|
|
|
let ERC20V3FactoryAddress = CONFIG.ERC20V3Factory;
|
2021-08-30 19:26:06 +08:00
|
|
|
let DODOMineV3RegistryAddress = CONFIG.DODOMineV3Registry;
|
|
|
|
|
let DODOMineV2FactoryAddress = CONFIG.DODOMineV2Factory;
|
2020-12-07 16:20:59 +08:00
|
|
|
|
2021-03-03 23:08:41 +08:00
|
|
|
//Approve
|
|
|
|
|
let DODOApproveAddress = CONFIG.DODOApprove;
|
|
|
|
|
let DODOApproveProxyAddress = CONFIG.DODOApproveProxy;
|
2021-02-25 21:34:58 +08:00
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
//Adapter
|
|
|
|
|
let DODOV1AdpaterAddress = CONFIG.DODOV1Adapter;
|
|
|
|
|
let DODOV2AdapterAddress = CONFIG.DODOV2Adapter;
|
|
|
|
|
let UniAdapterAddress = CONFIG.UniAdapter;
|
|
|
|
|
|
|
|
|
|
//Proxy
|
|
|
|
|
let DODOV2ProxyAddress = CONFIG.DODOV2Proxy;
|
|
|
|
|
let DODODspProxyAddress = CONFIG.DSPProxy;
|
|
|
|
|
let DODOCpProxyAddress = CONFIG.CpProxy;
|
2021-10-11 23:42:56 +08:00
|
|
|
let DODODppProxyAddress = CONFIG.DPPProxy;
|
2021-08-30 19:26:06 +08:00
|
|
|
let DODOMineV3ProxyAddress = CONFIG.DODOMineV3Proxy;
|
|
|
|
|
let DODORouteProxyAddress = CONFIG.RouteProxy;
|
|
|
|
|
|
|
|
|
|
|
2021-03-03 23:08:41 +08:00
|
|
|
//Account
|
|
|
|
|
let multiSigAddress = CONFIG.multiSigAddress;
|
|
|
|
|
let defaultMaintainer = CONFIG.defaultMaintainer;
|
2020-12-07 16:20:59 +08:00
|
|
|
|
2021-01-21 09:48:58 +08:00
|
|
|
|
2020-12-22 13:18:23 +08:00
|
|
|
if (deploySwitch.DEPLOY_V2) {
|
2021-03-03 23:08:41 +08:00
|
|
|
logger.log("====================================================");
|
|
|
|
|
logger.log("network type: " + network);
|
|
|
|
|
logger.log("Deploy time: " + new Date().toLocaleString());
|
2020-12-07 16:20:59 +08:00
|
|
|
logger.log("Deploy type: V2");
|
2021-03-09 15:43:02 +08:00
|
|
|
logger.log("multiSigAddress: ", multiSigAddress)
|
|
|
|
|
|
2020-12-15 11:17:19 +08:00
|
|
|
//Helper
|
2021-08-30 19:26:06 +08:00
|
|
|
if (MultiCallAddress == "") {
|
|
|
|
|
await deployer.deploy(MultiCall);
|
|
|
|
|
MultiCallAddress = MultiCall.address;
|
|
|
|
|
logger.log("MultiCallAddress: ", MultiCallAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-15 11:17:19 +08:00
|
|
|
if (DODOSellHelperAddress == "") {
|
|
|
|
|
await deployer.deploy(DODOSellHelper);
|
|
|
|
|
DODOSellHelperAddress = DODOSellHelper.address;
|
|
|
|
|
logger.log("DODOSellHelper Address: ", DODOSellHelperAddress);
|
|
|
|
|
}
|
2021-08-30 19:26:06 +08:00
|
|
|
|
|
|
|
|
if (DODOSwapCalcHelperAddress == "") {
|
|
|
|
|
await deployer.deploy(DODOSwapCalcHelper, DODOSellHelperAddress);
|
|
|
|
|
logger.log("DODOSwapCalcHelper Address: ", DODOSwapCalcHelper.address);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ERC20HelperAddress == "") {
|
|
|
|
|
await deployer.deploy(ERC20Helper);
|
|
|
|
|
logger.log("ERC20Helper Address: ", ERC20Helper.address);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-15 11:17:19 +08:00
|
|
|
if (DODOCalleeHelperAddress == "") {
|
|
|
|
|
await deployer.deploy(DODOCalleeHelper, WETHAddress);
|
|
|
|
|
DODOCalleeHelperAddress = DODOCalleeHelper.address;
|
|
|
|
|
logger.log("DODOCalleeHelperAddress: ", DODOCalleeHelperAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-22 14:00:45 +08:00
|
|
|
if (DODOV1PmmHelperAddress == "") {
|
|
|
|
|
await deployer.deploy(DODOV1PmmHelper);
|
|
|
|
|
DODOV1PmmHelperAddress = DODOV1PmmHelper.address;
|
|
|
|
|
logger.log("DODOV1RouterHelper Address: ", DODOV1PmmHelperAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-15 11:17:19 +08:00
|
|
|
//Template
|
2020-12-07 16:20:59 +08:00
|
|
|
if (CloneFactoryAddress == "") {
|
|
|
|
|
await deployer.deploy(CloneFactory);
|
|
|
|
|
CloneFactoryAddress = CloneFactory.address;
|
|
|
|
|
logger.log("CloneFactoryAddress: ", CloneFactoryAddress);
|
|
|
|
|
}
|
2021-01-05 18:01:51 +08:00
|
|
|
|
2020-12-15 11:17:19 +08:00
|
|
|
if (DefaultMtFeeRateAddress == "") {
|
2021-01-22 14:00:45 +08:00
|
|
|
await deployer.deploy(FeeRateModelTemplate);
|
|
|
|
|
DefaultMtFeeRateAddress = FeeRateModelTemplate.address;
|
2020-12-15 11:17:19 +08:00
|
|
|
logger.log("DefaultMtFeeRateAddress: ", DefaultMtFeeRateAddress);
|
2021-02-04 17:21:18 +08:00
|
|
|
const defaultMtFeeRateInstance = await FeeRateModelTemplate.at(DefaultMtFeeRateAddress);
|
|
|
|
|
var tx = await defaultMtFeeRateInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init DefaultMtFeeRateAddress Tx:", tx.tx);
|
2020-12-07 16:20:59 +08:00
|
|
|
}
|
2020-12-15 11:17:19 +08:00
|
|
|
|
2021-11-09 10:53:38 +08:00
|
|
|
if (UserQuotaAddress == "") {
|
|
|
|
|
await deployer.deploy(UserQuota);
|
|
|
|
|
UserQuotaAddress = UserQuota.address;
|
|
|
|
|
logger.log("UserQuotaAddress: ", UserQuotaAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-12 14:40:39 +08:00
|
|
|
|
|
|
|
|
/*
|
2021-11-09 10:53:38 +08:00
|
|
|
if (FeeRateImplAddress == "") {
|
|
|
|
|
await deployer.deploy(FeeRateImpl);
|
|
|
|
|
FeeRateImplAddress = FeeRateImpl.address;
|
|
|
|
|
logger.log("FeeRateImpl Address: ", FeeRateImplAddress);
|
|
|
|
|
const feeRateImplInstance = await FeeRateImpl.at(FeeRateImplAddress);
|
|
|
|
|
var tx = await feeRateImplInstance.init(multiSigAddress,CloneFactoryAddress,UserQuotaAddress);
|
|
|
|
|
logger.log("Init FeeRateImpl Tx:", tx.tx);
|
2021-08-30 19:26:06 +08:00
|
|
|
}
|
2023-05-12 14:40:39 +08:00
|
|
|
*/
|
2021-08-30 19:26:06 +08:00
|
|
|
|
2022-04-22 16:05:36 +08:00
|
|
|
if (FeeRateDIP3ImplAddress == "") {
|
|
|
|
|
await deployer.deploy(FeeRateDIP3);
|
|
|
|
|
FeeRateDIP3ImplAddress = FeeRateDIP3.address;
|
|
|
|
|
logger.log("FeeRateDIP3Impl Address: ", FeeRateDIP3ImplAddress);
|
2023-05-12 14:40:39 +08:00
|
|
|
const feeRateImplInstance = await FeeRateDIP3.at(FeeRateDIP3ImplAddress);
|
|
|
|
|
var tx = await feeRateImplInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init FeeRateDIP3Impl Tx:", tx.tx);
|
2022-04-22 16:05:36 +08:00
|
|
|
}
|
|
|
|
|
|
2020-12-15 11:17:19 +08:00
|
|
|
if (DefaultPermissionAddress == "") {
|
|
|
|
|
await deployer.deploy(PermissionManagerTemplate);
|
|
|
|
|
DefaultPermissionAddress = PermissionManagerTemplate.address;
|
|
|
|
|
logger.log("DefaultPermissionAddress: ", DefaultPermissionAddress);
|
|
|
|
|
const defaultPermissionInstance = await PermissionManagerTemplate.at(DefaultPermissionAddress);
|
|
|
|
|
var tx = await defaultPermissionInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init DefaultPermissionAddress Tx:", tx.tx);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-07 16:20:59 +08:00
|
|
|
if (DvmTemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(DvmTemplate);
|
|
|
|
|
DvmTemplateAddress = DvmTemplate.address;
|
|
|
|
|
logger.log("DvmTemplateAddress: ", DvmTemplateAddress);
|
|
|
|
|
}
|
2021-05-11 15:03:40 +08:00
|
|
|
|
|
|
|
|
if (DspTemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(DspTemplate);
|
|
|
|
|
DspTemplateAddress = DspTemplate.address;
|
|
|
|
|
logger.log("DspTemplateAddress: ", DspTemplateAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-12 14:40:39 +08:00
|
|
|
/*
|
2020-12-07 16:20:59 +08:00
|
|
|
if (DppTemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(DppTemplate);
|
|
|
|
|
DppTemplateAddress = DppTemplate.address;
|
|
|
|
|
logger.log("DppTemplateAddress: ", DppTemplateAddress);
|
|
|
|
|
}
|
2021-05-11 15:03:40 +08:00
|
|
|
|
2020-12-07 16:20:59 +08:00
|
|
|
if (DppAdminTemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(DppAdminTemplate);
|
|
|
|
|
DppAdminTemplateAddress = DppAdminTemplate.address;
|
|
|
|
|
logger.log("DppAdminTemplateAddress: ", DppAdminTemplateAddress);
|
|
|
|
|
}
|
2023-05-12 14:40:39 +08:00
|
|
|
*/
|
2021-08-30 19:26:06 +08:00
|
|
|
|
2022-05-23 21:23:54 +08:00
|
|
|
if (DppAdvancedTemplateAddress == "") {
|
2023-05-12 14:40:39 +08:00
|
|
|
await deployer.deploy(DppAdvancedTemplate);
|
2022-05-23 21:23:54 +08:00
|
|
|
DppAdvancedTemplateAddress = DppAdvancedTemplate.address;
|
|
|
|
|
logger.log("DppAdvancedTemplateAddress: ", DppAdvancedTemplateAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (DppAdvancedAdminTemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(DppAdvancedAdminTemplate);
|
|
|
|
|
DppAdvancedAdminTemplateAddress = DppAdvancedAdminTemplate.address;
|
|
|
|
|
logger.log("DppAdvancedAdminTemplateAddress: ", DppAdvancedAdminTemplateAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-15 11:17:19 +08:00
|
|
|
if (CpTemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(CpTemplate);
|
|
|
|
|
CpTemplateAddress = CpTemplate.address;
|
|
|
|
|
logger.log("CpTemplateAddress: ", CpTemplateAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-03 23:08:41 +08:00
|
|
|
if (ERC20TemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(ERC20Template);
|
|
|
|
|
ERC20TemplateAddress = ERC20Template.address;
|
|
|
|
|
logger.log("ERC20TemplateAddress: ", ERC20TemplateAddress);
|
|
|
|
|
}
|
2021-08-30 19:26:06 +08:00
|
|
|
|
|
|
|
|
if (CustomERC20TemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(CustomERC20Template);
|
|
|
|
|
CustomERC20TemplateAddress = CustomERC20Template.address;
|
|
|
|
|
logger.log("CustomERC20TemplateAddress: ", CustomERC20TemplateAddress);
|
2021-03-03 23:08:41 +08:00
|
|
|
}
|
|
|
|
|
|
2022-05-23 21:23:54 +08:00
|
|
|
if (CustomMintableERC20TemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(CustomMintableERC20Template);
|
|
|
|
|
CustomMintableERC20TemplateAddress = CustomMintableERC20Template.address;
|
|
|
|
|
logger.log("CustomMintableERC20TemplateAddress: ", CustomMintableERC20TemplateAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
if (MineV2TemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(ERC20MineV2);
|
|
|
|
|
MineV2TemplateAddress = ERC20MineV2.address;
|
|
|
|
|
logger.log("MineV2TemplateAddress: ", MineV2TemplateAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MineV3TemplateAddress == "") {
|
|
|
|
|
await deployer.deploy(ERC20MineV3);
|
|
|
|
|
MineV3TemplateAddress = ERC20MineV3.address;
|
|
|
|
|
logger.log("MineV3TemplateAddress: ", MineV3TemplateAddress);
|
2021-03-03 23:08:41 +08:00
|
|
|
}
|
|
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
|
2020-12-15 11:17:19 +08:00
|
|
|
//Approve
|
2020-12-07 16:20:59 +08:00
|
|
|
if (DODOApproveAddress == "") {
|
|
|
|
|
await deployer.deploy(DODOApprove);
|
|
|
|
|
DODOApproveAddress = DODOApprove.address;
|
|
|
|
|
logger.log("DODOApprove Address: ", DODOApproveAddress);
|
|
|
|
|
}
|
2020-12-15 11:17:19 +08:00
|
|
|
|
2021-01-26 17:53:49 +08:00
|
|
|
if (DODOApproveProxyAddress == "") {
|
|
|
|
|
await deployer.deploy(DODOApproveProxy, DODOApproveAddress);
|
|
|
|
|
DODOApproveProxyAddress = DODOApproveProxy.address;
|
|
|
|
|
logger.log("DODOApproveProxy Address: ", DODOApproveProxyAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
|
2020-12-07 16:20:59 +08:00
|
|
|
//Factory
|
2023-05-12 14:40:39 +08:00
|
|
|
/*
|
|
|
|
|
疑似废弃
|
2021-08-30 19:26:06 +08:00
|
|
|
if (ERC20V2FactoryAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
ERC20V2Factory,
|
|
|
|
|
CloneFactoryAddress,
|
|
|
|
|
ERC20TemplateAddress,
|
|
|
|
|
CustomERC20TemplateAddress
|
|
|
|
|
);
|
|
|
|
|
ERC20V2FactoryAddress = ERC20V2Factory.address;
|
|
|
|
|
logger.log("ERC20V2FactoryAddress: ", ERC20V2FactoryAddress);
|
|
|
|
|
const ERC20V2FactoryInstance = await ERC20V2Factory.at(ERC20V2FactoryAddress);
|
|
|
|
|
var tx = await ERC20V2FactoryInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init ERC20V2Factory Tx:", tx.tx);
|
|
|
|
|
}
|
2023-05-12 14:40:39 +08:00
|
|
|
*/
|
2021-08-30 19:26:06 +08:00
|
|
|
|
2022-05-23 21:23:54 +08:00
|
|
|
if (ERC20V3FactoryAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
ERC20V3Factory,
|
|
|
|
|
CloneFactoryAddress,
|
|
|
|
|
ERC20TemplateAddress,
|
|
|
|
|
CustomERC20TemplateAddress,
|
|
|
|
|
CustomMintableERC20TemplateAddress,
|
|
|
|
|
2000000000000000
|
|
|
|
|
);
|
|
|
|
|
ERC20V3FactoryAddress = ERC20V3Factory.address;
|
|
|
|
|
logger.log("ERC20V3FactoryAddress: ", ERC20V3FactoryAddress);
|
|
|
|
|
const ERC20V3FactoryInstance = await ERC20V3Factory.at(ERC20V3FactoryAddress);
|
|
|
|
|
var tx = await ERC20V3FactoryInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init ERC20V2Factory Tx:", tx.tx);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-07 16:20:59 +08:00
|
|
|
if (DvmFactoryAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
DvmFactory,
|
|
|
|
|
CloneFactoryAddress,
|
|
|
|
|
DvmTemplateAddress,
|
2020-12-24 11:51:55 +08:00
|
|
|
defaultMaintainer,
|
2021-01-05 18:01:51 +08:00
|
|
|
DefaultMtFeeRateAddress
|
2020-12-07 16:20:59 +08:00
|
|
|
);
|
|
|
|
|
DvmFactoryAddress = DvmFactory.address;
|
|
|
|
|
logger.log("DvmFactoryAddress: ", DvmFactoryAddress);
|
2020-12-15 11:17:19 +08:00
|
|
|
const DvmFactoryInstance = await DvmFactory.at(DvmFactoryAddress);
|
|
|
|
|
var tx = await DvmFactoryInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init DvmFactory Tx:", tx.tx);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-07 16:20:59 +08:00
|
|
|
if (DppFactoryAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
DppFactory,
|
|
|
|
|
CloneFactoryAddress,
|
2022-05-23 21:23:54 +08:00
|
|
|
DppAdvancedTemplateAddress,
|
|
|
|
|
DppAdvancedAdminTemplateAddress,
|
2021-01-05 18:01:51 +08:00
|
|
|
defaultMaintainer,
|
|
|
|
|
DefaultMtFeeRateAddress,
|
2021-01-26 17:53:49 +08:00
|
|
|
DODOApproveProxyAddress
|
2020-12-07 16:20:59 +08:00
|
|
|
);
|
|
|
|
|
DppFactoryAddress = DppFactory.address;
|
|
|
|
|
logger.log("DppFactoryAddress: ", DppFactoryAddress);
|
2020-12-15 11:17:19 +08:00
|
|
|
const DppFactoryInstance = await DppFactory.at(DppFactoryAddress);
|
|
|
|
|
var tx = await DppFactoryInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init DppFactory Tx:", tx.tx);
|
2020-12-07 16:20:59 +08:00
|
|
|
}
|
2021-01-08 20:43:12 +08:00
|
|
|
|
2023-05-12 14:40:39 +08:00
|
|
|
/*
|
2021-05-11 15:03:40 +08:00
|
|
|
if (UpCpFactoryAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
UpCpFactory,
|
|
|
|
|
CloneFactoryAddress,
|
|
|
|
|
CpTemplateAddress,
|
|
|
|
|
DvmFactoryAddress,
|
|
|
|
|
defaultMaintainer,
|
|
|
|
|
DefaultMtFeeRateAddress,
|
|
|
|
|
DefaultPermissionAddress
|
|
|
|
|
);
|
|
|
|
|
UpCpFactoryAddress = UpCpFactory.address;
|
2021-08-30 19:26:06 +08:00
|
|
|
logger.log("UpCrowdPoolingFactory address: ", UpCpFactory.address);
|
2021-05-11 15:03:40 +08:00
|
|
|
const UpCpFactoryInstance = await UpCpFactory.at(UpCpFactory.address);
|
|
|
|
|
var tx = await UpCpFactoryInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init UpCpFactory Tx:", tx.tx);
|
|
|
|
|
}
|
2023-05-12 14:40:39 +08:00
|
|
|
|
2021-05-11 15:03:40 +08:00
|
|
|
|
2020-12-15 11:17:19 +08:00
|
|
|
if (CpFactoryAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
CpFactory,
|
|
|
|
|
CloneFactoryAddress,
|
|
|
|
|
CpTemplateAddress,
|
2020-12-24 11:51:55 +08:00
|
|
|
DvmFactoryAddress,
|
2020-12-15 11:17:19 +08:00
|
|
|
defaultMaintainer,
|
|
|
|
|
DefaultMtFeeRateAddress,
|
2021-01-05 18:01:51 +08:00
|
|
|
DefaultPermissionAddress
|
2020-12-15 11:17:19 +08:00
|
|
|
);
|
|
|
|
|
CpFactoryAddress = CpFactory.address;
|
|
|
|
|
logger.log("CpFactoryAddress: ", CpFactoryAddress);
|
2021-01-18 22:32:12 +08:00
|
|
|
const CpFactoryInstance = await CpFactory.at(CpFactoryAddress);
|
|
|
|
|
var tx = await CpFactoryInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init CpFactory Tx:", tx.tx);
|
2020-12-15 11:17:19 +08:00
|
|
|
}
|
2023-05-12 14:40:39 +08:00
|
|
|
*/
|
2020-12-15 11:17:19 +08:00
|
|
|
|
2022-04-22 16:05:36 +08:00
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-11 15:03:40 +08:00
|
|
|
if (DspFactoryAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
DspFactory,
|
|
|
|
|
CloneFactoryAddress,
|
|
|
|
|
DspTemplateAddress,
|
|
|
|
|
defaultMaintainer,
|
|
|
|
|
DefaultMtFeeRateAddress
|
|
|
|
|
);
|
|
|
|
|
DspFactoryAddress = DspFactory.address;
|
|
|
|
|
logger.log("DspFactoryAddress: ", DspFactoryAddress);
|
|
|
|
|
const DspFactoryInstance = await DspFactory.at(DspFactoryAddress);
|
|
|
|
|
var tx = await DspFactoryInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init DspFactory Tx:", tx.tx);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
if (DODOMineV2FactoryAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
MineV2Factory,
|
|
|
|
|
CloneFactoryAddress,
|
|
|
|
|
MineV2TemplateAddress,
|
|
|
|
|
defaultMaintainer
|
|
|
|
|
);
|
|
|
|
|
DODOMineV2FactoryAddress = MineV2Factory.address;
|
|
|
|
|
logger.log("DODOMineV2FactoryAddress: ", DODOMineV2FactoryAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (DODOMineV3RegistryAddress == "") {
|
|
|
|
|
await deployer.deploy(MineV3Registry);
|
|
|
|
|
DODOMineV3RegistryAddress = MineV3Registry.address;
|
|
|
|
|
logger.log("DODOMineV3RegistryAddress: ", DODOMineV3RegistryAddress);
|
|
|
|
|
|
|
|
|
|
const dodoMineV3RegistryInstance = await MineV3Registry.at(DODOMineV3RegistryAddress);
|
|
|
|
|
var tx = await dodoMineV3RegistryInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init DODOMineV3Registry Tx:", tx.tx);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-11 15:03:40 +08:00
|
|
|
if (DODORouteV2HelperAddress == "") {
|
|
|
|
|
await deployer.deploy(DODOV2RouteHelper, DvmFactoryAddress, DppFactoryAddress, DspFactoryAddress);
|
|
|
|
|
DODOV2RouteHelperAddress = DODOV2RouteHelper.address;
|
|
|
|
|
logger.log("DODOV2RouteHelper Address: ", DODOV2RouteHelperAddress);
|
|
|
|
|
}
|
2020-12-24 11:51:55 +08:00
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
//Adapter
|
|
|
|
|
if (DODOV1AdpaterAddress == "") {
|
|
|
|
|
await deployer.deploy(DODOV1Adapter, DODOSellHelperAddress);
|
|
|
|
|
logger.log("DODOV1Adapter Address: ", DODOV1Adapter.address);
|
|
|
|
|
}
|
|
|
|
|
if (DODOV2AdapterAddress == "") {
|
|
|
|
|
await deployer.deploy(DODOV2Adapter)
|
|
|
|
|
logger.log("DODOV2Adapter Address: ", DODOV2Adapter.address);
|
|
|
|
|
}
|
|
|
|
|
if (UniAdapterAddress == "") {
|
|
|
|
|
await deployer.deploy(UniAdapter)
|
|
|
|
|
logger.log("UniAdapter Address: ", UniAdapter.address);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-12-07 16:20:59 +08:00
|
|
|
//Proxy
|
2021-08-30 19:26:06 +08:00
|
|
|
if (DODOV2ProxyAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
DODOProxyV2,
|
|
|
|
|
DvmFactoryAddress,
|
|
|
|
|
WETHAddress,
|
|
|
|
|
DODOApproveProxyAddress,
|
|
|
|
|
DODOSellHelperAddress
|
|
|
|
|
);
|
|
|
|
|
DODOV2ProxyAddress = DODOProxyV2.address;
|
|
|
|
|
logger.log("DODOV2Proxy02 Address: ", DODOProxyV2.address);
|
|
|
|
|
const DODOProxyV2Instance = await DODOProxyV2.at(DODOProxyV2.address);
|
|
|
|
|
var tx = await DODOProxyV2Instance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init DODOProxyV2 Tx:", tx.tx);
|
|
|
|
|
}
|
2021-01-08 20:43:12 +08:00
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
if (DODODspProxyAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
DODODspProxy,
|
|
|
|
|
DspFactoryAddress,
|
|
|
|
|
WETHAddress,
|
|
|
|
|
DODOApproveProxyAddress
|
|
|
|
|
);
|
|
|
|
|
DODODspProxyAddress = DODODspProxy.address;
|
|
|
|
|
logger.log("DODODspProxy Address: ", DODODspProxy.address);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (DODOCpProxyAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
DODOCpProxy,
|
|
|
|
|
WETHAddress,
|
|
|
|
|
CpFactoryAddress,
|
2022-04-23 21:50:07 +08:00
|
|
|
// UpCpFactoryAddress, V2 doesn't need this parameter
|
2021-08-30 19:26:06 +08:00
|
|
|
DODOApproveProxyAddress
|
|
|
|
|
);
|
|
|
|
|
DODOCpProxyAddress = DODOCpProxy.address;
|
|
|
|
|
logger.log("CpProxy address: ", DODOCpProxy.address);
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-11 23:42:56 +08:00
|
|
|
if (DODODppProxyAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
DODODppProxy,
|
|
|
|
|
WETHAddress,
|
|
|
|
|
DODOApproveProxyAddress,
|
|
|
|
|
DppFactoryAddress
|
|
|
|
|
);
|
|
|
|
|
DODODppProxyAddress = DODODppProxy.address;
|
|
|
|
|
logger.log("DPPProxy address: ", DODODppProxy.address);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
if (DODOMineV3ProxyAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
DODOMineV3Proxy,
|
|
|
|
|
CloneFactoryAddress,
|
|
|
|
|
MineV3TemplateAddress,
|
|
|
|
|
DODOApproveProxyAddress,
|
|
|
|
|
DODOMineV3RegistryAddress
|
|
|
|
|
);
|
|
|
|
|
DODOMineV3ProxyAddress = DODOMineV3Proxy.address;
|
|
|
|
|
logger.log("DODOMineV3ProxyAddress: ", DODOMineV3ProxyAddress);
|
|
|
|
|
|
|
|
|
|
const dodoMineV3ProxyInstance = await DODOMineV3Proxy.at(DODOMineV3ProxyAddress);
|
|
|
|
|
var tx = await dodoMineV3ProxyInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init DODOMineV3Proxy Tx:", tx.tx);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-24 22:51:55 +08:00
|
|
|
// need deploy dodoRouteProxy in dodo-route-contract repo
|
2023-05-12 14:40:39 +08:00
|
|
|
/*
|
2021-08-30 19:26:06 +08:00
|
|
|
if (DODORouteProxyAddress == "") {
|
|
|
|
|
await deployer.deploy(
|
|
|
|
|
DODORouteProxy,
|
|
|
|
|
WETHAddress,
|
|
|
|
|
DODOApproveProxyAddress
|
|
|
|
|
);
|
|
|
|
|
DODOApproveProxyAddress = DODORouteProxy.address;
|
|
|
|
|
logger.log("DODORouteProxy Address: ", DODORouteProxy.address);
|
|
|
|
|
}
|
2023-05-12 14:40:39 +08:00
|
|
|
*/
|
2021-08-30 19:26:06 +08:00
|
|
|
|
2023-05-12 14:40:39 +08:00
|
|
|
if (network == 'kovan' || network == 'rinkeby' ||network == "boba_test" || network == "dashboard") {
|
2021-08-30 19:26:06 +08:00
|
|
|
var tx;
|
2023-05-12 14:40:39 +08:00
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
//ApproveProxy init以及添加ProxyList
|
2021-01-26 17:53:49 +08:00
|
|
|
const DODOApproveProxyInstance = await DODOApproveProxy.at(DODOApproveProxyAddress);
|
2021-10-11 23:42:56 +08:00
|
|
|
tx = await DODOApproveProxyInstance.init(multiSigAddress, [DODOV2ProxyAddress, DODODspProxyAddress, DODOCpProxyAddress, DODODppProxyAddress, DODOMineV3ProxyAddress, DODORouteProxyAddress]);
|
2021-01-26 17:53:49 +08:00
|
|
|
logger.log("DODOApproveProxy Init tx: ", tx.tx);
|
|
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
//Approve init
|
2021-01-26 17:53:49 +08:00
|
|
|
const DODOApproveInstance = await DODOApprove.at(DODOApproveAddress);
|
2021-08-30 19:26:06 +08:00
|
|
|
tx = await DODOApproveInstance.init(multiSigAddress, DODOApproveProxy.address);
|
2021-01-26 17:53:49 +08:00
|
|
|
logger.log("DODOApprove Init tx: ", tx.tx);
|
2023-05-12 14:40:39 +08:00
|
|
|
|
2021-08-30 19:26:06 +08:00
|
|
|
|
2021-11-09 10:53:38 +08:00
|
|
|
//Set FeeRateImpl
|
2021-11-05 09:11:16 +08:00
|
|
|
const FeeRateModelInstance = await FeeRateModelTemplate.at(DefaultMtFeeRateAddress);
|
2023-05-12 14:40:39 +08:00
|
|
|
tx = await FeeRateModelInstance.setFeeProxy(FeeRateDIP3ImplAddress);
|
2021-11-09 10:53:38 +08:00
|
|
|
logger.log("Set FeeRateImpl tx: ", tx.tx);
|
2021-08-30 19:26:06 +08:00
|
|
|
|
2023-05-12 14:40:39 +08:00
|
|
|
//ERC20V3Factory 设置fee
|
|
|
|
|
const ERC20V3FactoryInstance = await ERC20V3Factory.at(ERC20V3FactoryAddress);
|
|
|
|
|
tx = await ERC20V3FactoryInstance.changeCreateFee("100000000000000000");
|
|
|
|
|
logger.log("Set ERC20V3 fee tx: ", tx.tx);
|
2021-08-30 19:26:06 +08:00
|
|
|
|
|
|
|
|
//DODOMineV2Factory 设置个人账户为owner
|
|
|
|
|
const dodoMineV2FactoryInstance = await DODOMineV2Factory.at(DODOMineV2FactoryAddress);
|
|
|
|
|
var tx = await dodoMineV2FactoryInstance.initOwner(multiSigAddress);
|
|
|
|
|
logger.log("Init DODOMineV2Factory Tx:", tx.tx);
|
|
|
|
|
|
|
|
|
|
//DODOMineV3Registry add Proxy as admin
|
|
|
|
|
const dodoMineV3RegistryInstance = await DODOMineV3Registry.at(DODOMineV3RegistryAddress);
|
|
|
|
|
var tx = await dodoMineV3RegistryInstance.addAdminList(DODOMineV3ProxyAddress);
|
|
|
|
|
logger.log("DODOMineV3RegistryAddress Init tx: ", tx.tx);
|
2021-10-09 10:30:43 +08:00
|
|
|
|
|
|
|
|
//DPPFactory add DODProxy as admin
|
|
|
|
|
const dppFactoryInstance = await DPPFactory.at(DppFactoryAddress);
|
2021-10-11 23:42:56 +08:00
|
|
|
var tx = await dppFactoryInstance.addAdminList(DODODppProxyAddress);
|
|
|
|
|
logger.log("DPPFactory Add DPPProxy tx: ", tx.tx);
|
2021-01-08 20:43:12 +08:00
|
|
|
}
|
|
|
|
|
|
2020-12-07 16:20:59 +08:00
|
|
|
}
|
|
|
|
|
};
|