diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-08-22 08:07:14 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-08-23 06:39:03 +0800 |
commit | 67d33ec10c3d2467d2d073d22bfe2957353a0cc8 (patch) | |
tree | f92c7fdfa478c54b8bcf845e08f1027365ba89c8 /packages | |
parent | 05ba049f5937be3a3a47ed90898f6a0267a67fd8 (diff) | |
download | dexon-sol-tools-67d33ec10c3d2467d2d073d22bfe2957353a0cc8.tar dexon-sol-tools-67d33ec10c3d2467d2d073d22bfe2957353a0cc8.tar.gz dexon-sol-tools-67d33ec10c3d2467d2d073d22bfe2957353a0cc8.tar.bz2 dexon-sol-tools-67d33ec10c3d2467d2d073d22bfe2957353a0cc8.tar.lz dexon-sol-tools-67d33ec10c3d2467d2d073d22bfe2957353a0cc8.tar.xz dexon-sol-tools-67d33ec10c3d2467d2d073d22bfe2957353a0cc8.tar.zst dexon-sol-tools-67d33ec10c3d2467d2d073d22bfe2957353a0cc8.zip |
Fix rounding bug in marketUtils
Diffstat (limited to 'packages')
-rw-r--r-- | packages/order-utils/CHANGELOG.json | 11 | ||||
-rw-r--r-- | packages/order-utils/src/market_utils.ts | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index c4260bc2f..55e0b499e 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -17,10 +17,17 @@ }, { "note": - "Rename `resultOrders` to `resultFeeOrders` for object returned by `findFeeOrdersThatCoverFeesForTargetOrders` in `marketUtils` api" + "Rename `resultOrders` to `resultFeeOrders` for object returned by `findFeeOrdersThatCoverFeesForTargetOrders` in `marketUtils` api", + "pr": 954 + }, + { + "note": "Make `sortFeeOrdersByFeeAdjustedRate` in `sortingUtils` generic", + "pr": 954 }, { - "note": "Make `sortFeeOrdersByFeeAdjustedRate` in `sortingUtils` generic" + "note": + "Update `findFeeOrdersThatCoverFeesForTargetOrders` to round the the nearest integer when calculating required fees", + "pr": 954 } ] }, diff --git a/packages/order-utils/src/market_utils.ts b/packages/order-utils/src/market_utils.ts index 7eae4c8fc..b31a2b135 100644 --- a/packages/order-utils/src/market_utils.ts +++ b/packages/order-utils/src/market_utils.ts @@ -123,7 +123,7 @@ export const marketUtils = { const makerAssetAmountAvailable = remainingFillableMakerAssetAmounts[index]; const feeToFillMakerAssetAmountAvailable = makerAssetAmountAvailable .mul(order.takerFee) - .div(order.makerAssetAmount); + .dividedToIntegerBy(order.makerAssetAmount); return accFees.plus(feeToFillMakerAssetAmountAvailable); }, constants.ZERO_AMOUNT, |