diff --git a/contracts/ProxyLogics/instaDydx.sol b/contracts/ProxyLogics/instaDydx.sol index e5b9862..2775590 100644 --- a/contracts/ProxyLogics/instaDydx.sol +++ b/contracts/ProxyLogics/instaDydx.sol @@ -157,7 +157,7 @@ contract Helpers is DSMath { tokenAmt ); bytes memory empty; - address otherAddr = marketId == 0 ? getSoloPayableAddress() : address(this); + address otherAddr = (marketId == 0 && sign) ? getSoloPayableAddress() : address(this); SoloMarginContract.ActionType action = sign ? SoloMarginContract.ActionType.Deposit : SoloMarginContract.ActionType.Withdraw; actions[0] = SoloMarginContract.ActionArgs( action, @@ -243,6 +243,8 @@ contract DydxResolver is Helpers { if (erc20Addr == getAddressETH()) { PayableProxySoloMarginContract soloPayable = PayableProxySoloMarginContract(getSoloPayableAddress()); soloPayable.operate(getAccountArgs(), getActionsArgs(marketId, toWithdraw, false), msg.sender); + SoloMarginContract solo = SoloMarginContract(getSoloAddress()); + solo.operate(getAccountArgs(), getActionsArgs(marketId, toWithdraw, false)); ERC20Interface wethContract = ERC20Interface(getAddressWETH()); uint wethBal = wethContract.balanceOf(address(this)); toWithdraw = toWithdraw < wethBal ? wethBal : toWithdraw;