diff --git a/packages/asset-swapper/CHANGELOG.json b/packages/asset-swapper/CHANGELOG.json index 141a4707fb..fdca0f6f68 100644 --- a/packages/asset-swapper/CHANGELOG.json +++ b/packages/asset-swapper/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/packages/asset-swapper/src/utils/swap_quote_calculator.ts b/packages/asset-swapper/src/utils/swap_quote_calculator.ts index 71ee57c55c..069897e43e 100644 --- a/packages/asset-swapper/src/utils/swap_quote_calculator.ts +++ b/packages/asset-swapper/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);