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

Commit

Permalink
[FIX] asset-swapper liquidity breakdown (#2472)
Browse files Browse the repository at this point in the history
* changed divided

* added changelog

* prettier

Co-authored-by: Jacob Evans <dekz@dekz.net>
  • Loading branch information
dave4506 and dekz committed Feb 6, 2020
1 parent 0b80e51 commit 30195f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions 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 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

0 comments on commit 30195f9

Please sign in to comment.