From 65641f2c373a14a76565953fce6f57520b3f22b5 Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Tue, 19 Nov 2019 06:20:48 +0530 Subject: [PATCH] bug fixed in mcd migrate --- contracts/ProxyLogics/MCD/InstaMcdMigrate.sol | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/contracts/ProxyLogics/MCD/InstaMcdMigrate.sol b/contracts/ProxyLogics/MCD/InstaMcdMigrate.sol index 4dfe80f..bfb3369 100644 --- a/contracts/ProxyLogics/MCD/InstaMcdMigrate.sol +++ b/contracts/ProxyLogics/MCD/InstaMcdMigrate.sol @@ -181,7 +181,7 @@ contract Helpers is DSMath { } /** - * @dev get Compound ETH Address + * @dev get ETH Address */ function getETHAddress() public pure returns (address ethAddr) { ethAddr = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; // main @@ -328,19 +328,21 @@ contract MKRSwapper is LiquidityResolver { if (tokenAddr == getETHAddress()) { mkrEx.ethToTokenSwapOutput.value(srcAmt)(govFee, uint(1899063809)); - } else if (tokenAddr != getSaiAddress() && tokenAddr != getDaiAddress()) { - require(TokenInterface(tokenAddr).transferFrom(msg.sender, address(this), srcAmt), "not-approved-yet"); + } else { + if (tokenAddr != getSaiAddress() && tokenAddr != getDaiAddress()) { + require(TokenInterface(tokenAddr).transferFrom(msg.sender, address(this), srcAmt), "not-approved-yet"); + } + address buyTknExAddr = UniswapFactoryInterface(getUniFactoryAddr()).getExchange(tokenAddr); + UniswapExchange buyTknEx = UniswapExchange(buyTknExAddr); + setApproval(tokenAddr, srcAmt, buyTknExAddr); + buyTknEx.tokenToTokenSwapOutput( + govFee, + srcAmt, + uint(999000000000000000000), + uint(1899063809), // 6th March 2030 GMT // no logic + mkr + ); } - address buyTknExAddr = UniswapFactoryInterface(getUniFactoryAddr()).getExchange(tokenAddr); - UniswapExchange buyTknEx = UniswapExchange(buyTknExAddr); - setApproval(tokenAddr, srcAmt, buyTknExAddr); - buyTknEx.tokenToTokenSwapOutput( - govFee, - srcAmt, - uint(999000000000000000000), - uint(1899063809), // 6th March 2030 GMT // no logic - mkr - ); } }