Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

[FIX] asset-swapper liquidity breakdown #2472

Merged
merged 4 commits into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/asset-swapper/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion packages/asset-swapper/src/utils/swap_quote_calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down