From 250a9a480940ae4fca48109aae97ee0323d57a52 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 3 Oct 2018 22:54:32 -0700 Subject: Add comments about buy quote calculation --- packages/asset-buyer/src/utils/buy_quote_calculator.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packages/asset-buyer/src') diff --git a/packages/asset-buyer/src/utils/buy_quote_calculator.ts b/packages/asset-buyer/src/utils/buy_quote_calculator.ts index 9ccaa7933..78666356c 100644 --- a/packages/asset-buyer/src/utils/buy_quote_calculator.ts +++ b/packages/asset-buyer/src/utils/buy_quote_calculator.ts @@ -148,9 +148,11 @@ function findEthAndZrxAmountNeededToBuyAsset( (acc, order, index) => { const remainingFillableMakerAssetAmount = remainingFillableMakerAssetAmounts[index]; const amountToFill = BigNumber.min(acc.remainingAssetBuyAmount, remainingFillableMakerAssetAmount); + // find the amount of eth required to fill amountToFill (amountToFill / makerAssetAmount) * takerAssetAmount const ethAmountForThisOrder = amountToFill .mul(order.takerAssetAmount) .dividedToIntegerBy(order.makerAssetAmount); + // find the amount of zrx required to fill fees for amountToFill (amountToFill / makerAssetAmount) * takerFee const zrxAmountForThisOrder = amountToFill.mul(order.takerFee).dividedToIntegerBy(order.makerAssetAmount); return { ethAmount: acc.ethAmount.plus(ethAmountForThisOrder), -- cgit v1.2.3