aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/utils
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-10-16 08:52:51 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-10-24 00:56:03 +0800
commite086c7b8e637fd57160273c69e27222ae8586a29 (patch)
tree3267ed23fb0393e7534e25350ffa8f658a076e7f /packages/contracts/test/utils
parent1f0c7f8fbeba90ac1f65c57ff58782051c751b3d (diff)
downloaddexon-0x-contracts-e086c7b8e637fd57160273c69e27222ae8586a29.tar.gz
dexon-0x-contracts-e086c7b8e637fd57160273c69e27222ae8586a29.tar.zst
dexon-0x-contracts-e086c7b8e637fd57160273c69e27222ae8586a29.zip
Round up for Market Buys in Forwarding Contract. Includes new test cases + regression testing.
Diffstat (limited to 'packages/contracts/test/utils')
-rw-r--r--packages/contracts/test/utils/forwarder_wrapper.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/contracts/test/utils/forwarder_wrapper.ts b/packages/contracts/test/utils/forwarder_wrapper.ts
index f1a64d47d..a0bfcfe1d 100644
--- a/packages/contracts/test/utils/forwarder_wrapper.ts
+++ b/packages/contracts/test/utils/forwarder_wrapper.ts
@@ -26,9 +26,12 @@ export class ForwarderWrapper {
_.forEach(feeOrders, feeOrder => {
const feeAvailable = feeOrder.makerAssetAmount.minus(feeOrder.takerFee);
if (!remainingFeeAmount.isZero() && feeAvailable.gt(remainingFeeAmount)) {
- wethAmount = wethAmount
- .plus(feeOrder.takerAssetAmount.times(remainingFeeAmount).dividedToIntegerBy(feeAvailable))
- .plus(1);
+ wethAmount = wethAmount.plus(
+ feeOrder.takerAssetAmount
+ .times(remainingFeeAmount)
+ .dividedBy(feeAvailable)
+ .ceil(),
+ );
remainingFeeAmount = new BigNumber(0);
} else if (!remainingFeeAmount.isZero()) {
wethAmount = wethAmount.plus(feeOrder.takerAssetAmount);