update arb contract info

This commit is contained in:
owen05
2021-08-30 19:26:06 +08:00
parent ff84835f3c
commit 7a5d076e33
6 changed files with 278 additions and 107 deletions

View File

@@ -6,33 +6,42 @@ const { GetConfig } = require("../configAdapter.js")
const CloneFactory = artifacts.require("CloneFactory");
const FeeRateModelTemplate = artifacts.require("FeeRateModel");
const FeeRateDIP3 = artifacts.require("FeeRateDIP3Impl");
const PermissionManagerTemplate = artifacts.require("PermissionManager");
const DODOSellHelper = artifacts.require("DODOSellHelper");
const DODOCalleeHelper = artifacts.require("DODOCalleeHelper");
const DODOV1PmmHelper = artifacts.require("DODOV1PmmHelper");
const DODOV2RouteHelper = artifacts.require("DODOV2RouteHelper");
const DODOSwapCalcHelper = artifacts.require("DODOSwapCalcHelper");
const ERC20Helper = artifacts.require("ERC20Helper");
const MultiCall = artifacts.require("Multicall");
const DODOCalleeHelper = artifacts.require("DODOCalleeHelper");
const DvmTemplate = artifacts.require("DVM");
const DppTemplate = artifacts.require("DPP");
const DspTemplate = artifacts.require("DSP");
const DppTemplate = artifacts.require("DPP");
const DppAdminTemplate = artifacts.require("DPPAdmin");
const CpTemplate = artifacts.require("CP");
const ERC20Template = artifacts.require("InitializableERC20");
const MintableERC20Template = artifacts.require("InitializableMintableERC20");
const ERC20Factory = artifacts.require("ERC20Factory");
const CustomERC20Template = artifacts.require("CustomERC20");
const ERC20MineV2 = artifacts.require("ERC20Mine");
const ERC20MineV3 = artifacts.require("ERC20MineV3");
const ERC20V2Factory = artifacts.require("ERC20V2Factory");
const DvmFactory = artifacts.require("DVMFactory");
const DppFactory = artifacts.require("DPPFactory");
const DspFactory = artifacts.require("DSPFactory");
const CpFactory = artifacts.require("CrowdPoolingFactory");
const UpCpFactory = artifacts.require("UpCrowdPoolingFactory");
const MineV3Registry = artifacts.require("DODOMineV3Registry");
const MineV2Factory = artifacts.require("DODOMineV2Factory");
const DODOApprove = artifacts.require("DODOApprove");
const DODOApproveProxy = artifacts.require("DODOApproveProxy");
const DODODspProxy = artifacts.require("DODODspProxy");
const DODOCpProxy = artifacts.require("DODOCpProxy");
const DODORouteProxy = artifacts.require("DODORouteProxy");
const DODOMineV3Proxy = artifacts.require("DODOMineV3Proxy");
const DODOProxyV2 = artifacts.require("DODOV2Proxy02");
const DODOV1Adapter = artifacts.require("DODOV1Adapter");
@@ -51,10 +60,14 @@ module.exports = async (deployer, network, accounts) => {
let DODOCalleeHelperAddress = CONFIG.DODOCalleeHelper;
let DODORouteV2HelperAddress = CONFIG.DODOV2RouteHelper;
let DODOV1PmmHelperAddress = CONFIG.DODOV1PmmHelper;
let DODOSwapCalcHelperAddress = CONFIG.DODOSwapCalcHelper;
let ERC20HelperAddress = CONFIG.ERC20Helper;
let MultiCallAddress = CONFIG.MultiCall;
//Template
let CloneFactoryAddress = CONFIG.CloneFactory;
let DefaultMtFeeRateAddress = CONFIG.FeeRateModel;
let FeeRateDIP3Address = CONFIG.FeeRateDIP3;
let DefaultPermissionAddress = CONFIG.PermissionManager;
let DvmTemplateAddress = CONFIG.DVM;
let DspTemplateAddress = CONFIG.DSP;
@@ -62,7 +75,9 @@ module.exports = async (deployer, network, accounts) => {
let DppAdminTemplateAddress = CONFIG.DPPAdmin;
let CpTemplateAddress = CONFIG.CP;
let ERC20TemplateAddress = CONFIG.ERC20;
let MintableERC20TemplateAddress = CONFIG.MintableERC20;
let CustomERC20TemplateAddress = CONFIG.CustomERC20;
let MineV2TemplateAddress = CONFIG.ERC20MineV2;
let MineV3TemplateAddress = CONFIG.ERC20MineV3;
//Facotry
let DvmFactoryAddress = CONFIG.DVMFactory;
@@ -70,31 +85,32 @@ module.exports = async (deployer, network, accounts) => {
let DppFactoryAddress = CONFIG.DPPFactory;
let CpFactoryAddress = CONFIG.CrowdPoolingFactory;
let UpCpFactoryAddress = CONFIG.UpCpFactory;
let ERC20FactoryAddress = CONFIG.ERC20Factory;
let ERC20V2FactoryAddress = CONFIG.ERC20V2Factory;
let DODOMineV3RegistryAddress = CONFIG.DODOMineV3Registry;
let DODOMineV2FactoryAddress = CONFIG.DODOMineV2Factory;
//Approve
let DODOApproveAddress = CONFIG.DODOApprove;
let DODOApproveProxyAddress = CONFIG.DODOApproveProxy;
//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;
let DODOMineV3ProxyAddress = CONFIG.DODOMineV3Proxy;
let DODORouteProxyAddress = CONFIG.RouteProxy;
//Account
let multiSigAddress = CONFIG.multiSigAddress;
let defaultMaintainer = CONFIG.defaultMaintainer;
if (deploySwitch.ADAPTER) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Deploy type: V2 - Adapter");
await deployer.deploy(DODOV1Adapter, DODOSellHelperAddress)
logger.log("DODOV1Adapter Address: ", DODOV1Adapter.address);
await deployer.deploy(DODOV2Adapter)
logger.log("DODOV2Adapter Address: ", DODOV2Adapter.address);
await deployer.deploy(UniAdapter)
logger.log("UniAdapter Address: ", UniAdapter.address);
}
if (deploySwitch.DEPLOY_V2) {
logger.log("====================================================");
logger.log("network type: " + network);
@@ -103,11 +119,28 @@ module.exports = async (deployer, network, accounts) => {
logger.log("multiSigAddress: ", multiSigAddress)
//Helper
if (MultiCallAddress == "") {
await deployer.deploy(MultiCall);
MultiCallAddress = MultiCall.address;
logger.log("MultiCallAddress: ", MultiCallAddress);
}
if (DODOSellHelperAddress == "") {
await deployer.deploy(DODOSellHelper);
DODOSellHelperAddress = DODOSellHelper.address;
logger.log("DODOSellHelper Address: ", DODOSellHelperAddress);
}
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);
}
if (DODOCalleeHelperAddress == "") {
await deployer.deploy(DODOCalleeHelper, WETHAddress);
DODOCalleeHelperAddress = DODOCalleeHelper.address;
@@ -136,6 +169,15 @@ module.exports = async (deployer, network, accounts) => {
logger.log("Init DefaultMtFeeRateAddress Tx:", tx.tx);
}
if (FeeRateDIP3Address == "") {
await deployer.deploy(FeeRateDIP3);
FeeRateDIP3Address = FeeRateDIP3.address;
logger.log("FeeRateDIP3 Address: ", FeeRateDIP3Address);
const feeRateDIP3Instance = await FeeRateDIP3.at(FeeRateDIP3Address);
var tx = await feeRateDIP3Instance.initOwner(multiSigAddress);
logger.log("Init FeeRateDIP3 Tx:", tx.tx);
}
if (DefaultPermissionAddress == "") {
await deployer.deploy(PermissionManagerTemplate);
DefaultPermissionAddress = PermissionManagerTemplate.address;
@@ -168,6 +210,7 @@ module.exports = async (deployer, network, accounts) => {
DppAdminTemplateAddress = DppAdminTemplate.address;
logger.log("DppAdminTemplateAddress: ", DppAdminTemplateAddress);
}
if (CpTemplateAddress == "") {
await deployer.deploy(CpTemplate);
CpTemplateAddress = CpTemplate.address;
@@ -179,23 +222,26 @@ module.exports = async (deployer, network, accounts) => {
ERC20TemplateAddress = ERC20Template.address;
logger.log("ERC20TemplateAddress: ", ERC20TemplateAddress);
}
if (MintableERC20TemplateAddress == "") {
await deployer.deploy(MintableERC20Template);
MintableERC20TemplateAddress = MintableERC20Template.address;
logger.log("MintableERC20TemplateAddress: ", MintableERC20TemplateAddress);
if (CustomERC20TemplateAddress == "") {
await deployer.deploy(CustomERC20Template);
CustomERC20TemplateAddress = CustomERC20Template.address;
logger.log("CustomERC20TemplateAddress: ", CustomERC20TemplateAddress);
}
if (ERC20FactoryAddress == "") {
await deployer.deploy(
ERC20Factory,
CloneFactoryAddress,
ERC20TemplateAddress,
MintableERC20TemplateAddress
);
ERC20FactoryAddress = ERC20Factory.address;
logger.log("ERC20FactoryAddress: ", ERC20FactoryAddress);
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);
}
//Approve
if (DODOApproveAddress == "") {
await deployer.deploy(DODOApprove);
@@ -209,7 +255,22 @@ module.exports = async (deployer, network, accounts) => {
logger.log("DODOApproveProxy Address: ", DODOApproveProxyAddress);
}
//Factory
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);
}
if (DvmFactoryAddress == "") {
await deployer.deploy(
DvmFactory,
@@ -252,8 +313,8 @@ module.exports = async (deployer, network, accounts) => {
DefaultMtFeeRateAddress,
DefaultPermissionAddress
);
logger.log("UpCrowdPoolingFactory address: ", UpCpFactory.address);
UpCpFactoryAddress = UpCpFactory.address;
logger.log("UpCrowdPoolingFactory address: ", UpCpFactory.address);
const UpCpFactoryInstance = await UpCpFactory.at(UpCpFactory.address);
var tx = await UpCpFactoryInstance.initOwner(multiSigAddress);
logger.log("Init UpCpFactory Tx:", tx.tx);
@@ -291,56 +352,149 @@ module.exports = async (deployer, network, accounts) => {
logger.log("Init DspFactory Tx:", tx.tx);
}
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);
}
if (DODORouteV2HelperAddress == "") {
await deployer.deploy(DODOV2RouteHelper, DvmFactoryAddress, DppFactoryAddress, DspFactoryAddress);
DODOV2RouteHelperAddress = DODOV2RouteHelper.address;
logger.log("DODOV2RouteHelper Address: ", DODOV2RouteHelperAddress);
}
//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);
}
//Proxy
await deployer.deploy(
DODODspProxy,
DspFactoryAddress,
WETHAddress,
DODOApproveProxyAddress
);
logger.log("DODODspProxy Address: ", DODODspProxy.address);
if (DODOV2ProxyAddress == "") {
await deployer.deploy(
DODOProxyV2,
DvmFactoryAddress,
DppFactoryAddress,
WETHAddress,
DODOApproveProxyAddress,
DODOSellHelperAddress
);
await deployer.deploy(
DODOProxyV2
);
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);
}
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,
UpCpFactoryAddress,
DODOApproveProxyAddress
);
DODOCpProxyAddress = DODOCpProxy.address;
logger.log("CpProxy address: ", DODOCpProxy.address);
}
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);
}
if (DODORouteProxyAddress == "") {
await deployer.deploy(
DODORouteProxy,
WETHAddress,
DODOApproveProxyAddress
);
DODOApproveProxyAddress = DODORouteProxy.address;
logger.log("DODORouteProxy Address: ", DODORouteProxy.address);
}
await deployer.deploy(
DODOCpProxy,
WETHAddress,
CpFactoryAddress,
UpCpFactoryAddress,
DODOApproveProxyAddress
);
logger.log("CpProxy address: ", DODOCpProxy.address);
await deployer.deploy(
DODOProxyV2,
DvmFactoryAddress,
DppFactoryAddress,
WETHAddress,
DODOApproveProxyAddress,
DODOSellHelperAddress
);
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);
if (network == 'kovan' || network == 'mbtestnet' || network == 'oktest' || network == 'matic' || network == 'arb' || network == 'rinkeby') {
if (network == 'kovan' || network == 'rinkeby') {
var tx;
//ApproveProxy init以及添加ProxyList
const DODOApproveProxyInstance = await DODOApproveProxy.at(DODOApproveProxyAddress);
var tx = await DODOApproveProxyInstance.init(multiSigAddress, [DODOProxyV2.address, DODOCpProxy.address, DODODspProxy.address]);
tx = await DODOApproveProxyInstance.init(multiSigAddress, [DODOV2ProxyAddress, DODODspProxyAddress, DODOCpProxyAddress, DODOMineV3ProxyAddress, DODORouteProxyAddress]);
logger.log("DODOApproveProxy Init tx: ", tx.tx);
//Approve init
const DODOApproveInstance = await DODOApprove.at(DODOApproveAddress);
var tx = await DODOApproveInstance.init(multiSigAddress, DODOApproveProxy.address);
tx = await DODOApproveInstance.init(multiSigAddress, DODOApproveProxy.address);
logger.log("DODOApprove Init tx: ", tx.tx);
//Set FeeRateDIP3
const FeeRateModelInstance = await FeeRateModel.at(DefaultMtFeeRateAddress);
tx = await FeeRateModelInstance.setProxy(FeeRateDIP3Address);
logger.log("Set FeeRateDIP3 tx: ", tx.tx);
//ERC20V2Factory 设置fee
const ERC20V2FactoryInstance = await ERC20V2Factory.at(ERC20V2FactoryAddress);
tx = await ERC20V2FactoryInstance.changeCreateFee("100000000000000000");
logger.log("Set ERC20V2 fee tx: ", tx.tx);
//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);
}
}