From 30195f9f28005d89dc96f863eb793d5df38ea8cc Mon Sep 17 00:00:00 2001 From: David Sun Date: Thu, 6 Feb 2020 00:09:39 -0500 Subject: [PATCH] [FIX] asset-swapper liquidity breakdown (#2472) * changed divided * added changelog * prettier Co-authored-by: Jacob Evans --- CHANGELOG.json | 4 ++++ src/utils/swap_quote_calculator.ts | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.json b/CHANGELOG.json index 141a4707fb..fdca0f6f68 100644 --- a/CHANGELOG.json +++ b/CHANGELOG.json @@ -2,6 +2,10 @@ { "version": "4.1.1", "changes": [ + { + "note": "Fix bug with liquidity source breakdown", + "pr": 2472 + }, { "note": "Prune orders before creating a dummy order for the Sampler", "pr": 2470 diff --git a/src/utils/swap_quote_calculator.ts b/src/utils/swap_quote_calculator.ts index 71ee57c55c..069897e43e 100644 --- a/src/utils/swap_quote_calculator.ts +++ b/src/utils/swap_quote_calculator.ts @@ -426,7 +426,9 @@ export class SwapQuoteCalculator { return { ...acc, ...{ - [source]: (!!acc[source] ? acc[source].plus(assetAmount) : assetAmount).dividedBy(totalAssetAmount), + [source]: !!acc[source] + ? acc[source].plus(assetAmount.dividedBy(totalAssetAmount)) + : assetAmount.dividedBy(totalAssetAmount), }, }; }, breakdown);