Fixed dydx proxy withdraw arg

This commit is contained in:
Thrilok kumar 2019-10-05 21:46:47 +05:30
parent 67835fa68c
commit f186a17ae3

View File

@ -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;