aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-10-04 13:54:32 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-10-04 13:54:32 +0800
commit250a9a480940ae4fca48109aae97ee0323d57a52 (patch)
treeac0672a8fc4ced237aea2363d7113710dce02f32
parent10f54893ef483d40de4d72f752ae921c62c9ac62 (diff)
downloaddexon-sol-tools-250a9a480940ae4fca48109aae97ee0323d57a52.tar
dexon-sol-tools-250a9a480940ae4fca48109aae97ee0323d57a52.tar.gz
dexon-sol-tools-250a9a480940ae4fca48109aae97ee0323d57a52.tar.bz2
dexon-sol-tools-250a9a480940ae4fca48109aae97ee0323d57a52.tar.lz
dexon-sol-tools-250a9a480940ae4fca48109aae97ee0323d57a52.tar.xz
dexon-sol-tools-250a9a480940ae4fca48109aae97ee0323d57a52.tar.zst
dexon-sol-tools-250a9a480940ae4fca48109aae97ee0323d57a52.zip
Add comments about buy quote calculation
-rw-r--r--packages/asset-buyer/src/utils/buy_quote_calculator.ts2
1 files changed, 2 insertions, 0 deletions
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),