Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
fix for comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendanChou committed Jun 11, 2019
1 parent a0ba895 commit ab8dbb2
Showing 1 changed file with 13 additions and 14 deletions.
Expand Up @@ -61,7 +61,7 @@ contract ZeroExV2MultiOrderExchangeWrapper is
uint256 makerAmount;
}

struct TokenBalance{
struct TokenBalance {
address owner;
uint256 balance;
}
Expand Down Expand Up @@ -177,27 +177,17 @@ contract ZeroExV2MultiOrderExchangeWrapper is
total.makerAmount = desiredMakerToken;

// gets the exchange cost. modifies total
getExchangeCostInternal(
uint256 takerCost = getExchangeCostInternal(
makerToken,
orders,
total
);

// require that all amount was bought
require(
total.makerAmount == 0,
"ZeroExV2MultiOrderExchangeWrapper#getExchangeCost: Cannot buy enough maker token"
);

// validate that max price will not be violated
validateTradePrice(
priceRatio,
total.takerAmount,
desiredMakerToken
);
validateTradePrice(priceRatio, takerCost, desiredMakerToken);

// return the amount of taker token needed
return total.takerAmount;
return takerCost;
}

// ============ Private Functions ============
Expand All @@ -213,6 +203,7 @@ contract ZeroExV2MultiOrderExchangeWrapper is
)
private
view
returns (uint256)
{
// read exchange address from storage
IExchange zeroExExchange = IExchange(ZERO_EX_EXCHANGE);
Expand Down Expand Up @@ -265,6 +256,14 @@ contract ZeroExV2MultiOrderExchangeWrapper is
total.takerAmount = total.takerAmount.add(available.takerAmount);
total.makerAmount = total.makerAmount.sub(available.makerAmount);
}

// require that entire amount was bought
require(
total.makerAmount == 0,
"ZeroExV2MultiOrderExchangeWrapper#getExchangeCost: Cannot buy enough maker token"
);

return total.takerAmount;
}

/**
Expand Down

0 comments on commit ab8dbb2

Please sign in to comment.