From dd62faa0098c1bb135b98577e3f5efbaaa8cae70 Mon Sep 17 00:00:00 2001 From: Samyak Jain Date: Mon, 24 Jun 2019 03:49:33 +0530 Subject: [PATCH] bugs resolved --- contracts/ProxyLogics/InstaSave.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contracts/ProxyLogics/InstaSave.sol b/contracts/ProxyLogics/InstaSave.sol index b6d023b..2e69cf9 100644 --- a/contracts/ProxyLogics/InstaSave.sol +++ b/contracts/ProxyLogics/InstaSave.sol @@ -498,7 +498,9 @@ contract SaveResolver is GetDetails { function saveSwap(uint srcAmt, uint daiDebt) internal returns (uint destAmt) { (,uint isBest) = getBest(getAddressETH(), getAddressDAI(), srcAmt); if (isBest == 0) { - TokenInterface(getAddressWETH()).deposit.value(srcAmt)(); + TokenInterface weth = TokenInterface(getAddressWETH()); + weth.deposit.value(srcAmt)(); + setAllowance(weth, getAddressEth2Dai()); destAmt = Eth2DaiInterface(getAddressEth2Dai()).sellAllAmount( getAddressWETH(), srcAmt, @@ -528,6 +530,7 @@ contract SaveResolver is GetDetails { function loopSwap(uint srcAmt) internal returns (uint destAmt) { (,uint isBest) = getBest(getAddressETH(), getAddressDAI(), srcAmt); if (isBest == 0) { + setAllowance(TokenInterface(getAddressDAI()), getAddressEth2Dai()); destAmt = Eth2DaiInterface(getAddressEth2Dai()).sellAllAmount( getAddressDAI(), srcAmt,