update swapcalc helper

This commit is contained in:
owen05
2020-12-15 18:47:38 +08:00
parent 6f29fd4bc5
commit 610baa6d0e
5 changed files with 31 additions and 11 deletions

View File

@@ -21,9 +21,10 @@ contract DODOSwapCalcHelper {
uint256 fromTokenAmount,
address[] memory dodoPairs,
uint8[] memory directions
) external view returns (uint256 returnAmount,uint256[] memory midPrices) {
) external view returns (uint256 returnAmount,uint256[] memory midPrices,uint256[] memory feeRates) {
returnAmount = fromTokenAmount;
midPrices = new uint256[](dodoPairs.length);
feeRates = new uint256[](dodoPairs.length);
for (uint256 i = 0; i < dodoPairs.length; i++) {
address curDodoPair = dodoPairs[i];
if (directions[i] == 0) {
@@ -35,6 +36,7 @@ contract DODOSwapCalcHelper {
);
}
midPrices[i] = IDODOV1(curDodoPair).getMidPrice();
feeRates[i] = IDODOV1(curDodoPair)._MT_FEE_RATE_() + IDODOV1(curDodoPair)._LP_FEE_RATE_();
}
}
}
}

View File

@@ -46,3 +46,23 @@ DODOApprove Address: 0xCB859eA579b28e02B87A1FDE08d087ab9dbE5149
DODOProxyV1 Address: 0xd0678Ec59d1337e29D1E1B1b6338f3E85D311F5e
Set DODOProxyV1 Owner tx: 0xb8bc4d84d39159c34c885b53fd345c935dc82214979e5885f9f9bc3ff59a3524
Set DODOApprove Owner And Init Set Proxy tx: 0x2199c008304d2c2a7ddfd18b26dbe4dd480aa7cd064a5ff85b87a9679b078702
====================================================
network type: live
Deploy time: 2020/12/15 下午6:05:56
Deploy type: Proxy
DODOSwapCalcHelperAddress: 0x7B9e97C4E3F008E854CF210E6948A0E40f70461B
====================================================
network type: live
Deploy time: 2020/12/15 下午6:31:06
Deploy type: Proxy
DODOSwapCalcHelperAddress: 0x3C02477f1B3C70D692be95a6e3805E02bba71206
====================================================
network type: kovan
Deploy time: 2020/12/15 下午6:44:08
Deploy type: Proxy
DODOSwapCalcHelperAddress: 0x0473FFd7039435F1FC794281F2a05830A1a0108a
====================================================
network type: bsclive
Deploy time: 2020/12/15 下午6:45:35
Deploy type: Proxy
DODOSwapCalcHelperAddress: 0xb0199C2c8ADF1E6c1e41De60A62E993406Cb8C02

View File

@@ -19,24 +19,23 @@ module.exports = async (deployer, network, accounts) => {
if (network == "kovan") {
DODOSellHelperAddress = "0xbdEae617F2616b45DCB69B287D52940a76035Fe3";
WETHAddress = "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b";
DODOSwapCalcHelperAddress = "";
// DODOApproveAddress = "0x0C4a80B2e234448E5f6fD86e7eFA733d985004c8";
DODOSwapCalcHelperAddress = "0x0473FFd7039435F1FC794281F2a05830A1a0108a";
DODOApproveAddress = "";
chiAddress = "0x0000000000004946c0e9f43f4dee607b0ef1fa1c";
ownerAddress = accounts[0];
} else if (network == "live") {
DODOSellHelperAddress = "0x533da777aedce766ceae696bf90f8541a4ba80eb";
WETHAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
DODOApproveAddress = "";
DODOApproveAddress = "0xCB859eA579b28e02B87A1FDE08d087ab9dbE5149";
chiAddress = "0x0000000000004946c0e9F43F4Dee607b0eF1fA1c";
DODOSwapCalcHelperAddress = "0x22C1a736DBE8200E6DF2f3D8F97c0D5749c1E257";
DODOSwapCalcHelperAddress = "0x3C02477f1B3C70D692be95a6e3805E02bba71206";
ownerAddress = "0x95C4F5b83aA70810D4f142d58e5F7242Bd891CB0";
} else if (network == "bsclive") {
DODOSellHelperAddress = "0x0F859706AeE7FcF61D5A8939E8CB9dBB6c1EDA33";
WETHAddress = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
DODOApproveAddress = "";
chiAddress = "0x0000000000000000000000000000000000000000";
DODOSwapCalcHelperAddress = "";
DODOSwapCalcHelperAddress = "0xb0199C2c8ADF1E6c1e41De60A62E993406Cb8C02";
//TODO:待生成替换
ownerAddress = accounts[0];
} else return;
@@ -61,6 +60,7 @@ module.exports = async (deployer, network, accounts) => {
if (DODOSwapCalcHelperAddress == "") {
await deployer.deploy(DODOSwapCalcHelper, DODOSellHelperAddress);
DODOSwapCalcHelperAddress = DODOSwapCalcHelper.address;
logger.log("DODOSwapCalcHelperAddress: ", DODOSwapCalcHelperAddress);
}
await deployer.deploy(
@@ -81,9 +81,7 @@ module.exports = async (deployer, network, accounts) => {
// var tx1 = await DODOProxyV1Instance.addWhiteList("0x111111125434b319222cdbf8c261674adb56f3ae");
// var tx2 = await DODOProxyV1Instance.addWhiteList("0xf740b67da229f2f10bcbd38a7979992fcc71b8eb");
// var tx3 = await DODOProxyV1Instance.addWhiteList("0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D");
// logger.log("AddWhiteList tx1: ", tx1.tx);
// logger.log("AddWhiteList tx2: ", tx2.tx);
// logger.log("AddWhiteList tx3: ", tx3.tx);
}
};

View File

@@ -24,7 +24,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) => {
//Helper And Common

View File

@@ -68,7 +68,7 @@ module.exports = {
return new HDWalletProvider(privKey, "https://mainnet.infura.io/v3/" + infuraId);
},
gas: 3000000,
gasPrice: 50000000000,
gasPrice: 100000000000,
network_id: 1,
skipDryRun: true
},