add swap calc helper

This commit is contained in:
owen05
2020-12-10 00:51:28 +08:00
parent d55238d493
commit c237438dec
9 changed files with 108 additions and 27 deletions

View File

@@ -5,17 +5,20 @@ let logger = new console.Console(file, file);
const DODOApprove = artifacts.require("DODOApprove");
const DODOProxyV1 = artifacts.require("DODOV1Proxy01");
const DODOSellHelper = artifacts.require("DODOSellHelper");
const DODOSwapCalcHelper = artifacts.require("DODOSwapCalcHelper");
const DEPLOY_ROUTE = false;
const DEPLOY_ROUTE = true;
module.exports = async (deployer, network, accounts) => {
let DODOSellHelperAddress = "";
let WETHAddress = "";
let DODOApproveAddress = "";
let chiAddress = "";
let DODOSwapCalcHelperAddress = "";
if (network == "kovan") {
DODOSellHelperAddress = "0xbdEae617F2616b45DCB69B287D52940a76035Fe3";
WETHAddress = "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b";
DODOSwapCalcHelperAddress = "";
// DODOApproveAddress = "0xbcf0fC05860b14cB3D62D1d4C7f531Ad2F28E0fE";
DODOApproveAddress = "0x0C4a80B2e234448E5f6fD86e7eFA733d985004c8";
chiAddress = "0x0000000000004946c0e9f43f4dee607b0ef1fa1c";
@@ -24,19 +27,22 @@ module.exports = async (deployer, network, accounts) => {
WETHAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
DODOApproveAddress = "0x4eC851895d85bfa6835241b3157ae10FfFD3BebC";
chiAddress = "0x0000000000004946c0e9F43F4Dee607b0eF1fA1c";
DODOSwapCalcHelperAddress = "";
} else if (network == "bsclive") {
DODOSellHelperAddress = "0x0F859706AeE7FcF61D5A8939E8CB9dBB6c1EDA33";
WETHAddress = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
DODOApproveAddress = "0x19DA73be23Cea6bFA804Ec020041b8F3971BC522";
chiAddress = "0x0000000000000000000000000000000000000000";
DODOSwapCalcHelperAddress = "";
} else return;
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
if (DEPLOY_ROUTE) {
logger.log("Deploy type: Proxy");
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
// logger.log("Deploy type: Proxy");
if (DODOApproveAddress == "") {
await deployer.deploy(DODOApprove);
DODOApproveAddress = DODOApprove.address;
@@ -45,19 +51,25 @@ module.exports = async (deployer, network, accounts) => {
await deployer.deploy(DODOSellHelper);
DODOSellHelperAddress = DODOSellHelper.address;
}
logger.log("DODOApprove Address: ", DODOApproveAddress);
logger.log("DODOSellHelper Address: ", DODOSellHelperAddress);
await deployer.deploy(
DODOProxyV1,
DODOApproveAddress,
DODOSellHelperAddress,
WETHAddress,
chiAddress
);
logger.log("DODOProxyV1 Address: ", DODOProxyV1.address);
if (DODOSwapCalcHelperAddress == "") {
await deployer.deploy(DODOSwapCalcHelper, DODOSellHelperAddress);
DODOSwapCalcHelperAddress = DODOSwapCalcHelper.address;
}
// logger.log("DODOApprove Address: ", DODOApproveAddress);
// logger.log("DODOSellHelper Address: ", DODOSellHelperAddress);
logger.log("DODOSwapCalcHelper Address: ", DODOSwapCalcHelperAddress);
const DODOApproveInstance = await DODOApprove.at(DODOApproveAddress);
var tx = await DODOApproveInstance.setDODOProxy(DODOProxyV1.address);
logger.log("DODOApprovce setProxy tx: ", tx.tx);
// await deployer.deploy(
// DODOProxyV1,
// DODOApproveAddress,
// DODOSellHelperAddress,
// WETHAddress,
// chiAddress
// );
// logger.log("DODOProxyV1 Address: ", DODOProxyV1.address);
// const DODOApproveInstance = await DODOApprove.at(DODOApproveAddress);
// var tx = await DODOApproveInstance.setDODOProxy(DODOProxyV1.address);
// logger.log("DODOApprovce setProxy tx: ", tx.tx);
}
};

View File

@@ -19,7 +19,7 @@ const DODOProxyV2 = artifacts.require("DODOV2Proxy01");
const DODOSellHelper = artifacts.require("DODOSellHelper");
const DODOCalleeHelper = artifacts.require("DODOCalleeHelper");
const DEPLOY_V2 = true;
const DEPLOY_V2 = false;
module.exports = async (deployer, network, accounts) => {
let DODOSellHelperAddress = "";
@@ -72,11 +72,11 @@ module.exports = async (deployer, network, accounts) => {
//Template
} else return;
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
if (DEPLOY_V2) {
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
logger.log("Deploy type: V2");
if (CloneFactoryAddress == "") {
await deployer.deploy(CloneFactory);