swap fallback fix

This commit is contained in:
owen05
2020-11-15 15:37:03 +08:00
parent d6143dff09
commit c827514ee7
5 changed files with 18 additions and 11 deletions

View File

@@ -44,10 +44,9 @@ contract SmartSwap is Ownable {
_WETH_ = _weth;
}
fallback() external payable {}
fallback() external payable {
require(msg.sender == _WETH_, "WE_CAN_NOT_SAVED_YOUR_ETH");
}
receive() external payable {}
function dodoSwap(
IERC20 fromToken,

View File

@@ -1,7 +1,8 @@
====================================================
network type: live
Deploy time: 2020/11/13 下午5:16:25
Deploy time: 2020/11/15 下午3:25:21
Deploy type: Smart Route
SmartApprove Address: 0xe380Ad3181A69BF92133D2feb609867c4adC61eA
DODOSellHelper Address: 0x533da777aedce766ceae696bf90f8541a4ba80eb
SmartSwap Address: 0xc1e152A032130bc7b49A00c78571C858BFc959C5
SmartSwap Address: 0xf40be68442e8bcf900FED714246f99BE556345e7
SmartApprovce setSmartSwap tx: 0xfd22c5e3ede777d21f0a0d2d8a64ccee584cc43fa2b72113c97360408c974beb

View File

@@ -1,5 +1,5 @@
const Migrations = artifacts.require("Migrations");
module.exports = function(deployer) {
deployer.deploy(Migrations);
// deployer.deploy(Migrations);
};

View File

@@ -16,14 +16,17 @@ module.exports = async (deployer, network,accounts) => {
let DODOSellHelperAddress = ""
let DODOZooAddress = ""
let WETHAddress = ""
let SmartApproveAddress = ""
if(network == 'kovan'){
DODOSellHelperAddress = "0xbdEae617F2616b45DCB69B287D52940a76035Fe3";
DODOZooAddress = "0x92230e929a2226b29ed3441ae5524886347c60c8";
WETHAddress = "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b";
SmartApproveAddress = "0x5627b7DEb3055e1e899003FDca0716b32C382084";
}else if(network == 'live'){
DODOSellHelperAddress = "0x533da777aedce766ceae696bf90f8541a4ba80eb";
DODOZooAddress = "0x3a97247df274a17c59a3bd12735ea3fcdfb49950";
WETHAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
SmartApproveAddress = "0xe380Ad3181A69BF92133D2feb609867c4adC61eA";
}else
return;
@@ -33,18 +36,21 @@ module.exports = async (deployer, network,accounts) => {
if (DEPLOY_ROUTE) {
logger.log("Deploy type: Smart Route");
await deployer.deploy(SmartApprove);
if(SmartApprove == ""){
await deployer.deploy(SmartApprove);
SmartApproveAddress = SmartApprove.address;
}
if(DODOSellHelperAddress == "") {
await deployer.deploy(DODOSellHelper);
DODOSellHelperAddress = DODOSellHelper.address;
}
logger.log("SmartApprove Address: ",SmartApprove.address);
logger.log("SmartApprove Address: ",SmartApproveAddress);
logger.log("DODOSellHelper Address: ",DODOSellHelperAddress);
await deployer.deploy(SmartSwap,SmartApprove.address,DODOSellHelperAddress,WETHAddress);
await deployer.deploy(SmartSwap,SmartApproveAddress,DODOSellHelperAddress,WETHAddress);
logger.log("SmartSwap Address: ",SmartSwap.address);
const SmartApproveInstance = await SmartApprove.deployed();
const SmartApproveInstance = await SmartApprove.at(SmartApproveAddress);
var tx = await SmartApproveInstance.setSmartSwap(SmartSwap.address);
logger.log("SmartApprovce setSmartSwap tx: ",tx.tx);
}

View File

@@ -65,11 +65,12 @@ module.exports = {
skipDryRun: true
},
live: {
networkCheckTimeout: 100000,
provider: function() {
return new HDWalletProvider(privKey, "https://mainnet.infura.io/v3/" + infuraId);
},
gas: 4000000,
gasPrice: 50000000000,
gasPrice: 20000000000,
network_id: 1,
skipDryRun: true
},