diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-10-04 13:54:32 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-10-04 13:54:32 +0800 |
commit | 250a9a480940ae4fca48109aae97ee0323d57a52 (patch) | |
tree | ac0672a8fc4ced237aea2363d7113710dce02f32 /packages/asset-buyer/src/utils | |
parent | 10f54893ef483d40de4d72f752ae921c62c9ac62 (diff) | |
download | dexon-0x-contracts-250a9a480940ae4fca48109aae97ee0323d57a52.tar.gz dexon-0x-contracts-250a9a480940ae4fca48109aae97ee0323d57a52.tar.zst dexon-0x-contracts-250a9a480940ae4fca48109aae97ee0323d57a52.zip |
Add comments about buy quote calculation
Diffstat (limited to 'packages/asset-buyer/src/utils')
-rw-r--r-- | packages/asset-buyer/src/utils/buy_quote_calculator.ts | 2 |
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), |