update deploy script

This commit is contained in:
owen05
2021-03-03 23:08:41 +08:00
parent d1d815b6f4
commit 8b341c3236
16 changed files with 646 additions and 763 deletions

View File

@@ -1,85 +0,0 @@
const fs = require("fs");
const { deploySwitch } = require('../truffle-config.js')
const file = fs.createWriteStream("../deploy-detail-v1.5.txt", { 'flags': 'a' });
let logger = new console.Console(file, file);
const DODOApproveProxy = artifacts.require("DODOApproveProxy");
const DODOV1Proxy04 = artifacts.require("DODOV1Proxy04");
const DODOSellHelper = artifacts.require("DODOSellHelper");
const DODOSwapCalcHelper = artifacts.require("DODOSwapCalcHelper");
module.exports = async (deployer, network, accounts) => {
let DODOSellHelperAddress = "";
let WETHAddress = "";
let DODOApproveProxyAddress = "";
let chiAddress = "";
let DODOSwapCalcHelperAddress = "";
let ownerAddress = ""
if (network == "kovan") {
DODOSellHelperAddress = "0xbdEae617F2616b45DCB69B287D52940a76035Fe3";
WETHAddress = "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b";
DODOSwapCalcHelperAddress = "0x0473FFd7039435F1FC794281F2a05830A1a0108a";
DODOApproveProxyAddress = "";
chiAddress = "0x0000000000004946c0e9f43f4dee607b0ef1fa1c";
ownerAddress = accounts[0];
} else if (network == "live") {
DODOSellHelperAddress = "0x533da777aedce766ceae696bf90f8541a4ba80eb";
WETHAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
DODOApproveProxyAddress = "0x335aC99bb3E51BDbF22025f092Ebc1Cf2c5cC619";
chiAddress = "0x0000000000004946c0e9F43F4Dee607b0eF1fA1c";
DODOSwapCalcHelperAddress = "0x3C02477f1B3C70D692be95a6e3805E02bba71206";
ownerAddress = "0x95C4F5b83aA70810D4f142d58e5F7242Bd891CB0";
} else if (network == "bsclive") {
DODOSellHelperAddress = "0x0F859706AeE7FcF61D5A8939E8CB9dBB6c1EDA33";
WETHAddress = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
DODOApproveProxyAddress = "0xB76de21f04F677f07D9881174a1D8E624276314C";
chiAddress = "0x0000000000000000000000000000000000000000";
DODOSwapCalcHelperAddress = "0xb0199C2c8ADF1E6c1e41De60A62E993406Cb8C02";
ownerAddress = "0xcaa42F09AF66A8BAE3A7445a7f63DAD97c11638b";
} else return;
if (deploySwitch.DEPLOY_V1) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
var tx;
logger.log("Deploy type: Proxy");
if (DODOApproveProxyAddress == "") {
await deployer.deploy(DODOApproveProxy);
DODOApproveProxyAddress = DODOApproveProxy.address;
logger.log("DODOApproveProxy Address: ", DODOApproveDODOApproveProxyAddressAddress);
}
if (DODOSellHelperAddress == "") {
await deployer.deploy(DODOSellHelper);
DODOSellHelperAddress = DODOSellHelper.address;
}
if (DODOSwapCalcHelperAddress == "") {
await deployer.deploy(DODOSwapCalcHelper, DODOSellHelperAddress);
DODOSwapCalcHelperAddress = DODOSwapCalcHelper.address;
logger.log("DODOSwapCalcHelperAddress: ", DODOSwapCalcHelperAddress);
}
await deployer.deploy(
DODOV1Proxy04,
DODOApproveProxyAddress,
DODOSellHelperAddress,
WETHAddress,
chiAddress
);
logger.log("DODOV1Proxy04 Address: ", DODOV1Proxy04.address);
const DODOProxyInstance = await DODOV1Proxy04.at(DODOV1Proxy04.address);
tx = await DODOProxyInstance.initOwner(ownerAddress);
logger.log("Set DODOProxy Owner tx: ", tx.tx);
// const DODOApproveInstance = await DODOApprove.at(DODOApproveAddress);
// tx = await DODOApproveInstance.init(ownerAddress, DODOProxyV1.address);
// logger.log("Set DODOApprove Owner And Init Set Proxy tx: ", tx.tx);
// var tx1 = await DODOProxyV1Instance.addWhiteList("0x111111125434b319222cdbf8c261674adb56f3ae");
// var tx2 = await DODOProxyV1Instance.addWhiteList("0xdef1c0ded9bec7f1a1670819833240f027b25eff");
// logger.log("AddWhiteList tx1: ", tx1.tx);
// logger.log("AddWhiteList tx2: ", tx2.tx);
}
};

View File

@@ -2,6 +2,7 @@ const fs = require("fs");
const { deploySwitch } = require('../truffle-config.js')
const file = fs.createWriteStream("../deploy-detail-v2.0.txt", { 'flags': 'a' });
let logger = new console.Console(file, file);
const { GetConfig } = require("../configAdapter.js")
const CloneFactory = artifacts.require("CloneFactory");
const FeeRateModelTemplate = artifacts.require("FeeRateModel");
@@ -35,173 +36,54 @@ const UniAdapter = artifacts.require("UniAdapter");
module.exports = async (deployer, network, accounts) => {
//Helper And Common
let DODOSellHelperAddress = "";
let WETHAddress = "";
let chiAddress = "";
let DODOCalleeHelperAddress = "";
let DODORouteV2HelperAddress = "";
let DODOV1PmmHelperAddress = "";
let CONFIG = GetConfig(network, accounts)
if (CONFIG == null) return;
//TOKEN
let WETHAddress = CONFIG.WETH;
let chiAddress = CONFIG.CHI;
let DODOTokenAddress = CONFIG.DODO;
//Helper
let DODOSellHelperAddress = CONFIG.DODOSellHelper;
let DODOCalleeHelperAddress = CONFIG.DODOCalleeHelper;
let DODORouteV2HelperAddress = CONFIG.DODOV2RouteHelper;
let DODOV1PmmHelperAddress = CONFIG.DODOV1PmmHelper;
//Template
let CloneFactoryAddress = "";
let DefaultMtFeeRateAddress = "";
let DefaultPermissionAddress = "";
let CloneFactoryAddress = CONFIG.CloneFactory;
let DefaultMtFeeRateAddress = CONFIG.FeeRateModel;
let DefaultPermissionAddress = CONFIG.PermissionManager;
let DvmTemplateAddress = CONFIG.DVM;
let DppTemplateAddress = CONFIG.DPP;
let DppAdminTemplateAddress = CONFIG.DPPAdmin;
let CpTemplateAddress = CONFIG.CP;
let ERC20TemplateAddress = CONFIG.ERC20;
let MintableERC20TemplateAddress = CONFIG.MintableERC20;
let DvmTemplateAddress = "";
let DppTemplateAddress = "";
let DppAdminTemplateAddress = "";
let CpTemplateAddress = "";
//Facotry
let DvmFactoryAddress = "";
let DppFactoryAddress = "";
let CpFactoryAddress = "";
let DvmFactoryAddress = CONFIG.DVMFactory;
let DppFactoryAddress = CONFIG.DPPFactory;
let CpFactoryAddress = CONFIG.CrowdPoolingFactory;
let ERC20FactoryAddress = CONFIG.ERC20Factory;
//Approve
let DODOApproveAddress = "";
let DODOApproveProxyAddress = "";
//Incentive
let DODOIncentiveAddress = "";
let DODOTokenAddress = "";
let DODOApproveAddress = CONFIG.DODOApprove;
let DODOApproveProxyAddress = CONFIG.DODOApproveProxy;
//Periphery
let DODOIncentiveAddress = CONFIG.DODOIncentive;
//Account
let multiSigAddress = "";
let defaultMaintainer = "";
let multiSigAddress = CONFIG.multiSigAddress;
let defaultMaintainer = CONFIG.defaultMaintainer;
//ERC20
let ERC20TemplateAddress = "";
let MintableERC20TemplateAddress = "";
let ERC20FactoryAddress = "";
if (network == "kovan") {
//Helper
DODOSellHelperAddress = "0xbdEae617F2616b45DCB69B287D52940a76035Fe3";
WETHAddress = "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b";
chiAddress = "0x0000000000004946c0e9f43f4dee607b0ef1fa1c";
DODOCalleeHelperAddress = "0x36ce1831941d35c3588759B2D084E240a094ad4A";
DODOV1PmmHelperAddress = "0xC972069473a686b1c11Bd9347D719c87e6745d39";
DODORouteV2HelperAddress = "0xcB3b6cdBe2e57D3e37feba0C55584992Cc1B973F";
//Template
CloneFactoryAddress = "0xf7959fe661124C49F96CF30Da33729201aEE1b27";
DefaultMtFeeRateAddress = "0x57e5b46e400c0C31cA174C8E199fB5fE650DB18a";
DefaultPermissionAddress = "0x82C87c5EB912762676E7a87Aad67D916317c7D0e";
DvmTemplateAddress = "0x268EA583bc954678DeD93D4832F147604142aDaD";
DppTemplateAddress = "0xEAdc4943329Cb8139Ee3c8575f6a9B3659cd0591";
DppAdminTemplateAddress = "0xf63e41A459D9AEcaE4bAE1278ef0ae84F7F2DE56";
CpTemplateAddress = "0x973bEbaE41E79c2B4d9EaEE14c2aB85f43673dc3";
//Factory
DvmFactoryAddress = "0x322F8014C125Da09314d3a68d4d9F427823F17FD";
DppFactoryAddress = "0xC65F8087288aa0a118aa6F3228Ef9ecc8187F4b6";
CpFactoryAddress = "0x9e6E8985D52E91eDf1671f28Ca73bc4F3E219b72";
//Approve
DODOApproveAddress = "0xa375b128e139ae54EF7F189BC8fEb4624f1c2Afa";
DODOApproveProxyAddress = "0xE2bf3e72E126f0AD4Aec07AdfA6cc345EEF43bDe";
DODOIncentiveAddress = "0x5cFCc14f7C8be8B138D9fDF7438391b0BFe0589F";
DODOTokenAddress = "0x854b0f89BAa9101e49Bfb357A38071C9db5d0DFa";
//Account
multiSigAddress = accounts[0];
defaultMaintainer = accounts[0];
} else if (network == "live") {
//Helper
DODOSellHelperAddress = "0x533da777aedce766ceae696bf90f8541a4ba80eb";
WETHAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
chiAddress = "0x0000000000004946c0e9F43F4Dee607b0eF1fA1c";
DODOCalleeHelperAddress = "0xef49a6DBa1C8DF859E49c17E9A485B439c7689d3";
DODORouteV2HelperAddress = "";
DODOV1PmmHelperAddress = "0x6373ceB657C83C91088d328622573FB766064Ac4";
//Template
CloneFactoryAddress = "0x5e5a7b76462e4bdf83aa98795644281bdba80b88";
DefaultMtFeeRateAddress = "0x5e84190a270333aCe5B9202a3F4ceBf11b81bB01";
DefaultPermissionAddress = "0x6B208E08dcF6BD51F50C5Da09d15B2D8E5C46Cf2";
DvmTemplateAddress = "0x2BBD66fC4898242BDBD2583BBe1d76E8b8f71445";
DppTemplateAddress = "0xB76de21f04F677f07D9881174a1D8E624276314C";
DppAdminTemplateAddress = "";
CpTemplateAddress = "0x18b0bD918b55f995Fd404B872404378A62cb403b";
//Factory
DvmFactoryAddress = "0x72d220cE168C4f361dD4deE5D826a01AD8598f6C";
DppFactoryAddress = "";
CpFactoryAddress = "0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25";
//Proxy
DODOApproveAddress = "0xCB859eA579b28e02B87A1FDE08d087ab9dbE5149";
DODOApproveProxyAddress = "";
DODOIncentiveAddress = "0x989DcAA95801C527C5B73AA65d3962dF9aCe1b0C";
DODOTokenAddress = "0x43Dfc4159D86F3A37A5A4B3D4580b888ad7d4DDd";
//Account
multiSigAddress = "0x95C4F5b83aA70810D4f142d58e5F7242Bd891CB0";
defaultMaintainer = "0x95C4F5b83aA70810D4f142d58e5F7242Bd891CB0";
} else if (network == "bsclive") {
//Helper
DODOSellHelperAddress = "0x0F859706AeE7FcF61D5A8939E8CB9dBB6c1EDA33";
WETHAddress = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
chiAddress = "0x0000000000000000000000000000000000000000";
DODOCalleeHelperAddress = "0xaaffAd1017D6a13E026A00121BF258C616B25f7C";
DODORouteV2HelperAddress = "0x1dc8D1f1600B7C1D39e6b60FBC7b021Bc4F9C993";
DODOV1PmmHelperAddress = "0x2BBD66fC4898242BDBD2583BBe1d76E8b8f71445";
//Template
CloneFactoryAddress = "0x03E2427859119E497EB856a166F616a2Ce5f8c88";
DefaultMtFeeRateAddress = "0x18DFdE99F578A0735410797e949E8D3e2AFCB9D2";
DefaultPermissionAddress = "0x729f7f44bf64Ce814716b6261e267DbE6cdf021c";
DvmTemplateAddress = "0xC3BeD579CaB3EC29B22D9AB99F4E586af42496b9";
DppTemplateAddress = "0x85351262f7474Ebe23FfAcD633cf20A491F1325D";
DppAdminTemplateAddress = "0x44D5dF24d5Ef52A791D6436Fa45A8D426f6de34e";
CpTemplateAddress = "0x041ABa00c57Dd47abC37A2931dF569a2A2cc57Be";
//Factory
DvmFactoryAddress = "0x790B4A80Fb1094589A3c0eFC8740aA9b0C1733fB";
DppFactoryAddress = "0xAfe0A75DFFb395eaaBd0a7E1BBbd0b11f8609eeF";
CpFactoryAddress = "0x778DF5B12170e8af8dF94356BfC864E57CE185DC";
//Proxy
DODOApproveAddress = "0xa128Ba44B2738A558A1fdC06d6303d52D3Cef8c1";
DODOApproveProxyAddress = "0xB76de21f04F677f07D9881174a1D8E624276314C";
DODOIncentiveAddress = "0x4EE6398898F7FC3e648b3f6bA458310ac29cD352";
DODOTokenAddress = "0x67ee3Cb086F8a16f34beE3ca72FAD36F7Db929e2";
//Account
multiSigAddress = "0xcaa42F09AF66A8BAE3A7445a7f63DAD97c11638b";
defaultMaintainer = "0xcaa42F09AF66A8BAE3A7445a7f63DAD97c11638b";
} else if (network == 'heco') {
//Helper
DODOSellHelperAddress = "0xA0Bb1FbC23a547a8D448C7c8a2336F69A9dBa1AF";
WETHAddress = "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f";
chiAddress = "0x0000000000000000000000000000000000000000";
DODOCalleeHelperAddress = "0xbd5cc9cf41a7dedaa7dfa6da189d3a522fe262d1";
DODORouteV2HelperAddress = "";
DODOV1PmmHelperAddress = "0xFB973C79C665C0AC69E74C67be90D4C7A6f23c59";
//Template
CloneFactoryAddress = "0x5dCEAe50CF8C3B885430E0E79226C513Db0318f2";
DefaultMtFeeRateAddress = "0x07911226E710dd0b9B1c4a2Dd3c85DeFd821D492";
DefaultPermissionAddress = "0xC142FBA5948c372f49aDa159748EA224de6cC9AA";
DvmTemplateAddress = "0x13742E431830980c59Ca8d8eC4D001F64C0D0f09";
DppTemplateAddress = "";
DppAdminTemplateAddress = "0x3232fd648997F89E614A021fdAc756d61F9030A1";
CpTemplateAddress = "0x02869989ecc2D310C360861Ec2779f7027F65190";
//Factory
DvmFactoryAddress = "";
DppFactoryAddress = "";
CpFactoryAddress = "";
//Proxy
DODOApproveAddress = "";
DODOApproveProxyAddress = "";
DODOIncentiveAddress = "0x94290Bf438697Fa684d8CE0aC07c09f0e82D4f74";
DODOTokenAddress = "0x7d5DF05F987f9B9dD2a13deF1793f943Ad2A5e93";
//Account
// multiSigAddress = "0xD93c8D2429a6b0269527f148F3A0e5D187B0b1Ca";
multiSigAddress = accounts[0];
defaultMaintainer = accounts[0];
} else return;
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
if (deploySwitch.CALLEE) {
await deployer.deploy(DODOCalleeHelper, WETHAddress);
DODOCalleeHelperAddress = DODOCalleeHelper.address;
logger.log("DODOCalleeHelperAddress: ", DODOCalleeHelperAddress);
}
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)
@@ -210,33 +92,12 @@ module.exports = async (deployer, network, accounts) => {
logger.log("UniAdapter Address: ", UniAdapter.address);
}
if (deploySwitch.ERC20) {
logger.log("Deploy type: V2 - ERC20 Factory");
if (ERC20TemplateAddress == "") {
await deployer.deploy(ERC20Template);
ERC20TemplateAddress = ERC20Template.address;
logger.log("ERC20TemplateAddress: ", ERC20TemplateAddress);
}
if (MintableERC20TemplateAddress == "") {
await deployer.deploy(MintableERC20Template);
MintableERC20TemplateAddress = MintableERC20Template.address;
logger.log("MintableERC20TemplateAddress: ", MintableERC20TemplateAddress);
}
if (ERC20FactoryAddress == "") {
await deployer.deploy(
ERC20Factory,
CloneFactoryAddress,
ERC20TemplateAddress,
MintableERC20TemplateAddress
);
ERC20FactoryAddress = ERC20Factory.address;
logger.log("ERC20FactoryAddress: ", ERC20FactoryAddress);
}
}
if (deploySwitch.DEPLOY_V2) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Deploy type: V2");
if (DODOTokenAddress == "") return;
//Helper
if (DODOSellHelperAddress == "") {
@@ -302,6 +163,28 @@ module.exports = async (deployer, network, accounts) => {
logger.log("CpTemplateAddress: ", CpTemplateAddress);
}
if (ERC20TemplateAddress == "") {
await deployer.deploy(ERC20Template);
ERC20TemplateAddress = ERC20Template.address;
logger.log("ERC20TemplateAddress: ", ERC20TemplateAddress);
}
if (MintableERC20TemplateAddress == "") {
await deployer.deploy(MintableERC20Template);
MintableERC20TemplateAddress = MintableERC20Template.address;
logger.log("MintableERC20TemplateAddress: ", MintableERC20TemplateAddress);
}
if (ERC20FactoryAddress == "") {
await deployer.deploy(
ERC20Factory,
CloneFactoryAddress,
ERC20TemplateAddress,
MintableERC20TemplateAddress
);
ERC20FactoryAddress = ERC20Factory.address;
logger.log("ERC20FactoryAddress: ", ERC20FactoryAddress);
}
//Approve
if (DODOApproveAddress == "") {
await deployer.deploy(DODOApprove);

View File

@@ -3,12 +3,13 @@ const Web3 = require('web3');
const { deploySwitch } = require('../truffle-config.js')
const file = fs.createWriteStream("../kovan-mock-v2.0.txt", { 'flags': 'a' });
let logger = new console.Console(file, file);
const { GetConfig } = require("../configAdapter.js")
const CloneFactory = artifacts.require("CloneFactory");
const ERC20Template = artifacts.require("InitializableERC20");
const MintableERC20Template = artifacts.require("InitializableMintableERC20");
const ERC20Factory = artifacts.require("ERC20Factory");
const DODOProxyV2 = artifacts.require("DODOV2Proxy01");
const DODOProxyV2 = artifacts.require("DODOV2Proxy02");
const DVMFactory = artifacts.require("DVMFactory");
const DPPFactory = artifacts.require("DPPFactory");
@@ -58,32 +59,18 @@ const POOL_PARAM = [
];
module.exports = async (deployer, network, accounts) => {
// if (network != "kovan") return;
let CloneFactoryAddress = "";
let ERC20TemplateAddress = "";
let MintableERC20TemplateAddress = "";
let ERC20FactoryAddress = "";
if (network != "kovan") return;
let CONFIG = GetConfig(network, accounts)
let CloneFactoryAddress = CONFIG.CloneFactory;
let ERC20TemplateAddress = CONFIG.ERC20;
let MintableERC20TemplateAddress = CONFIG.MintableERC20;
let ERC20FactoryAddress = CONFIG.ERC20Factory;
let DPPFactoryAddress = "";
let DVMFactoryAddress = "";
let DODOApproveAddress = "";
let DODOProxyV2Address = "";
if (network == "kovan") {
CloneFactoryAddress = "0xf7959fe661124C49F96CF30Da33729201aEE1b27";
ERC20TemplateAddress = "0x77d2e257241e6971688b08bdA9F658F065d7bb41";
MintableERC20TemplateAddress = "0xA45a64DAba80757432fA4d654Df12f65f020C13C";
ERC20FactoryAddress = "0xCb1A2f64EfB02803276BFB5a8D511C4D950282a0";
let DPPFactoryAddress = CONFIG.DPPFactory;
let DVMFactoryAddress = CONFIG.DVMFactory;
let DODOApproveAddress = CONFIG.DODOApprove;
let DODOProxyV2Address = CONFIG.DODOV2Proxy;
DPPFactoryAddress = "0x9fA487762d4329eBDD83a00a82C8a02719Fdf512";
DVMFactoryAddress = "0x322F8014C125Da09314d3a68d4d9F427823F17FD";
DODOApproveAddress = "0x4A354b8d0DDb7083f066bDaC1f50d23DE221B01C";
DODOProxyV2Address = "0x5b3faEAa344F8134a7E0A269a9dFb3C7898b090D";
} else if (network == "heco") {
CloneFactoryAddress = "0x5dCEAe50CF8C3B885430E0E79226C513Db0318f2";
ERC20TemplateAddress = "";
MintableERC20TemplateAddress = "";
ERC20FactoryAddress = "";
}
const provider = new Web3.providers.HttpProvider("https://kovan.infura.io/v3/22d4a3b2df0e47b78d458f43fe50a199");
@@ -93,74 +80,11 @@ module.exports = async (deployer, network, accounts) => {
const web3 = new Web3(provider)
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
if (deploySwitch.MOCK_TARGET_POOL) {
logger.log("Manual add target Pool: V2");
var tx;
const token0Addr = "0xCcf0733cA7B6299D59b1Bddf87f3a8AAaD87461F";
const quote0Addr = "0x43688f367eb83697c3ca5d03c5055b6bd6f6ac4b";
const token0 = await ERC20Template.at(token0Addr);
const quote0 = await ERC20Template.at(quote0Addr);
tx = await token0.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
logger.log("Approve:" + token0Addr + " Tx:", tx.tx);
tx = await quote0.approve(DODOApproveAddress, "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
logger.log("Approve:" + quote0Addr + " Tx:", tx.tx);
const DODOProxyV2Instance = await DODOProxyV2.at(DODOProxyV2Address);
const DPPFactoryInstance = await DPPFactory.at(DPPFactoryAddress);
const baseInAmount = web3.utils.toWei("0", 'ether');
const quoteInAmount = web3.utils.toWei("0", 'mwei');
const deadline = Math.floor(new Date().getTime() / 1000 + 60 * 10);
//DPP Pool
tx = await DODOProxyV2Instance.createDODOPrivatePool(
token0Addr,
quote0Addr,
baseInAmount,
quoteInAmount,
'0',
'1000000',
'1000000000000000000',
false,
deadline
);
var poolAddress = await DPPFactoryInstance._REGISTRY_(token0Addr, quote0Addr, 0);
logger.log("Create DPP: " + token0Addr + "-" + quote0Addr + " Pool:" + poolAddress + " Tx:", tx.tx);
}
if (deploySwitch.MANUAL_ADD_POOL) {
logger.log("Manual add Pool: V2");
const DPPFactoryInstance = await DPPFactory.at(DPPFactoryAddress);
var tx = await DPPFactoryInstance.addPoolByAdmin(
"0x7e83d9d94837ee82f0cc18a691da6f42f03f1d86",
"0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b",
"0x69c8a7fc6e05d7aa36114b3e35f62deca8e11f6e",
"0x5e6e4B49bd79B76850650DB670Ca470ccC19d854"
);
logger.log("Manual add Pool Tx:" + tx.tx);
}
if (deploySwitch.MOCK_V2_SWAP) {
logger.log("Mock SWAP Tx: V2");
const DODOProxyV2Instance = await DODOProxyV2.at(DODOProxyV2Address);
var tx = await DODOProxyV2Instance.dodoSwapV2TokenToToken(
accounts[0],
"0x43688f367eb83697c3ca5d03c5055b6bd6f6ac4b",
"0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE",
web3.utils.toWei("10", 'mwei'),
0,
['0x1d4f55C99BEF84ED889699Be64A691c6651F847E'],
[1],
Math.floor(new Date().getTime() / 1000 + 60 * 10)
);
logger.log("Swap Tx:" + tx.tx);
}
if (deploySwitch.MOCK_V2_POOL) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Mock POOL Tx: V2");
var tx;
{//Approve when change DODOApprove Address
@@ -245,6 +169,9 @@ module.exports = async (deployer, network, accounts) => {
}
if (deploySwitch.MOCK_TOKEN) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Mock TOKEN Tx: V2");
if (CloneFactoryAddress == "") {
await deployer.deploy(CloneFactory);

View File

@@ -2,56 +2,35 @@ const fs = require("fs");
const { deploySwitch } = require('../truffle-config.js')
const file = fs.createWriteStream("../deploy-detail-periphery.txt", { 'flags': 'a' });
let logger = new console.Console(file, file);
const { GetConfig } = require("../configAdapter.js")
const DODOBscToken = artifacts.require("DODOBscToken");
const DODORecharge = artifacts.require("DODORecharge");
const DODOMigrationBSC = artifacts.require("DODOMigrationBSC");
const vDODOToken = artifacts.require("vDODOToken");
const DODOCirculationHelper = artifacts.require("DODOCirculationHelper");
const DODOApproveProxy = artifacts.require("DODOApproveProxy");
const DODOMine = artifacts.require("DODOMine");
const FeeRateImpl = artifacts.require("FeeRateImpl");
const WETH9 = artifacts.require("WETH9");
const DODOToken = artifacts.require("DODOToken");
module.exports = async (deployer, network, accounts) => {
let CONFIG = GetConfig(network, accounts)
if (CONFIG == null) return;
let DODOTokenAddress = "";
let DODOApproveProxyAddress = "";
let DODOTokenAddress = CONFIG.DODO;
let DODOApproveProxyAddress = CONFIG.DODOApproveProxy;
let DODOCirculationHelperAddress = "";
let GovernanceAddress = "";
let vDODOTokenAddress = "";
let dodoTeam = "";
let DODOCirculationHelperAddress = CONFIG.DODOCirculationHelper;
let GovernanceAddress = CONFIG.Governance;
let vDODOTokenAddress = CONFIG.vDODOToken;
let dodoTeam = CONFIG.dodoTeam;
if (network == "kovan") {
DODOTokenAddress = "0x854b0f89BAa9101e49Bfb357A38071C9db5d0DFa";
DODOApproveProxyAddress = "0xE2bf3e72E126f0AD4Aec07AdfA6cc345EEF43bDe";
DODOCirculationHelperAddress = "";
vDODOTokenAddress = "0xf7119Bf8bE41Dd9080Bd0A9AB04788B5EcA140d5";
GovernanceAddress = "0x0000000000000000000000000000000000000000";
//Account
multiSigAddress = accounts[0];
dodoTeam = "0xaac153c1344cA14497A5dd22b1F70C28793625aa";
} else if (network == "live") {
DODOTokenAddress = "0x43dfc4159d86f3a37a5a4b3d4580b888ad7d4ddd";
DODOApproveProxyAddress = "0x335aC99bb3E51BDbF22025f092Ebc1Cf2c5cC619";
DODOCirculationHelperAddress = "";
vDODOTokenAddress = "0xc4436fBAE6eBa5d95bf7d53Ae515F8A707Bd402A";
GovernanceAddress = "0x0000000000000000000000000000000000000000";
//Account
multiSigAddress = "0x95C4F5b83aA70810D4f142d58e5F7242Bd891CB0";
dodoTeam = "0x95C4F5b83aA70810D4f142d58e5F7242Bd891CB0";
} else if (network == "bsclive") {
DODOTokenAddress = "0x67ee3Cb086F8a16f34beE3ca72FAD36F7Db929e2";
DODOApproveProxyAddress = "0xB76de21f04F677f07D9881174a1D8E624276314C";
//Account
multiSigAddress = "0xcaa42F09AF66A8BAE3A7445a7f63DAD97c11638b";
} else return;
let multiSigAddress = CONFIG.multiSigAddress;
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
if(deploySwitch.FEERATEIMPL) {
if (deploySwitch.FEERATEIMPL) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Deploy type: FeeRateImpl");
await deployer.deploy(FeeRateImpl);
var FeeRateImplAddress = FeeRateImpl.address;
@@ -60,15 +39,37 @@ module.exports = async (deployer, network, accounts) => {
var tx = await feeRateImplInstance.initOwner(multiSigAddress);
logger.log("Init feeRateImpl Tx:", tx.tx);
}
if (deploySwitch.DODO) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Deploy type: DODOToken");
await deployer.deploy(DODOToken);
logger.log("DODOTokenAddress: ", DODOToken.address);
}
if (deploySwitch.WETH) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Deploy type: WETH9");
await deployer.deploy(WETH9);
var WETH9Address = WETH9.address;
logger.log("WETH9Address: ", WETH9Address);
}
if (deploySwitch.MINE) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Deploy type: DODOMine");
await deployer.deploy(DODOMine, DODOTokenAddress, 5008500);
DODOMineAddress = DODOMine.address;
logger.log("DODOMineAddress: ", DODOMineAddress);
const dodoMineInstance = await DODOMine.at(DODOMineAddress);
//Add dodo
var tx = await dodoMineInstance.addLpToken(DODOTokenAddress,"3000000000000000000000",true);
var tx = await dodoMineInstance.addLpToken(DODOTokenAddress, "3000000000000000000000", true);
logger.log("Add DODO Tx:", tx.tx);
//set BLockReward
tx = await dodoMineInstance.setReward("1000000000000000", true);
@@ -78,9 +79,12 @@ module.exports = async (deployer, network, accounts) => {
//transfer owner
}
if (deploySwitch.DODORecharge) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Deploy type: DODORecharge");
await deployer.deploy(DODORecharge, DODOTokenAddress, DODOApproveProxyAddress);
DODORechargeAddress = DODORecharge.address;
@@ -90,36 +94,11 @@ module.exports = async (deployer, network, accounts) => {
logger.log("Init DODORechargeAddress Tx:", tx.tx);
}
if (deploySwitch.DODOBscToken && (network == "bsclive")) {
logger.log("Deploy type: DODOBscToken");
await deployer.deploy(DODOBscToken);
DODOBscTokenAddress = DODOBscToken.address;
logger.log("DODOBscTokenAddress: ", DODOBscTokenAddress);
const dodoBscTokenInstance = await DODOBscToken.at(DODOBscTokenAddress);
var tx = await dodoBscTokenInstance.initOwner("0x9c59990ec0177d87ED7D60A56F584E6b06C639a2");
logger.log("Init DODOBscTokenAddress Tx:", tx.tx);
}
if (deploySwitch.BSCMigration && (network !== "bsclive")) {
logger.log("Deploy type: DODOMigrationBSC");
await deployer.deploy(DODOMigrationBSC, DODOTokenAddress, DODOApproveProxyAddress);
DODOMigrationBSCAddress = DODOMigrationBSC.address;
logger.log("DODOMigrationBSCAddress: ", DODOMigrationBSCAddress);
const dodoMigrationBscInstance = await DODOMigrationBSC.at(DODOMigrationBSCAddress);
var tx = await dodoMigrationBscInstance.initOwner(multiSigAddress);
logger.log("Init DODOMigrationBSCAddress Tx:", tx.tx);
if (network == 'kovan') {
//ApproveProxy add
const DODOApproveProxyInstance = await DODOApproveProxy.at(DODOApproveProxyAddress);
tx = await DODOApproveProxyInstance.unlockAddProxy(DODOMigrationBSCAddress);
logger.log("DODOApproveProxy Unlock tx: ", tx.tx);
tx = await DODOApproveProxyInstance.addDODOProxy();
logger.log("DODOApproveProxy add tx: ", tx.tx);
}
}
if (deploySwitch.vDODOToken) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Deploy type: vDODOToken");
if (vDODOTokenAddress == "") {
@@ -146,12 +125,12 @@ module.exports = async (deployer, network, accounts) => {
logger.log("Init DODOCirculationHelperAddress Tx:", tx.tx);
}
if(network == 'kovan') {
if (network == 'kovan') {
const vDODOTokenInstance = await vDODOToken.at(vDODOTokenAddress);
//updateDODOCirculationHelper
var tx = await vDODOTokenInstance.updateDODOCirculationHelper(DODOCirculationHelperAddress);
logger.log("vDODOToken setDODOCirculationHelper tx: ", tx.tx);
//ApproveProxy add
// const DODOApproveProxyInstance = await DODOApproveProxy.at(DODOApproveProxyAddress);
// tx = await DODOApproveProxyInstance.unlockAddProxy(vDODOTokenAddress);
@@ -162,7 +141,7 @@ module.exports = async (deployer, network, accounts) => {
// //Mint DODO first
// tx = await vDODOTokenInstance.mint("100000000000000000000000",dodoTeam);
// logger.log("vDODOToken first mint tx: ", tx.tx);
// //preDepositedBlockReward
// tx = await vDODOTokenInstance.preDepositedBlockReward("100000000000000000000000");
// logger.log("vDODOToken injected dodo tx: ", tx.tx);