aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher
diff options
context:
space:
mode:
authorJacob Evans <dekz@dekz.net>2018-08-16 10:13:27 +0800
committerGitHub <noreply@github.com>2018-08-16 10:13:27 +0800
commit480d28ea26be86d685d81059a0dbe4cd025f0c21 (patch)
tree8b8b72f1945a7d85f11af14f16338a059cc9f900 /packages/order-watcher
parentf9f232f5d9527926cd64027f69491b0bc6e58894 (diff)
parent88c99396a2d1b880bffb21ef19507d02b474ba9b (diff)
downloaddexon-sol-tools-480d28ea26be86d685d81059a0dbe4cd025f0c21.tar
dexon-sol-tools-480d28ea26be86d685d81059a0dbe4cd025f0c21.tar.gz
dexon-sol-tools-480d28ea26be86d685d81059a0dbe4cd025f0c21.tar.bz2
dexon-sol-tools-480d28ea26be86d685d81059a0dbe4cd025f0c21.tar.lz
dexon-sol-tools-480d28ea26be86d685d81059a0dbe4cd025f0c21.tar.xz
dexon-sol-tools-480d28ea26be86d685d81059a0dbe4cd025f0c21.tar.zst
dexon-sol-tools-480d28ea26be86d685d81059a0dbe4cd025f0c21.zip
Merge pull request #959 from 0xProject/bug/order-utils/rounding-error-small-maker
[Order-utils] Order is valid when maker amount is very small
Diffstat (limited to 'packages/order-watcher')
-rw-r--r--packages/order-watcher/test/order_watcher_test.ts20
1 files changed, 9 insertions, 11 deletions
diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts
index 00962bed0..38bfde7ef 100644
--- a/packages/order-watcher/test/order_watcher_test.ts
+++ b/packages/order-watcher/test/order_watcher_test.ts
@@ -501,25 +501,27 @@ describe('OrderWatcher', () => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
- expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderFillRoundingError);
+ expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderCancelled);
});
orderWatcher.subscribe(callback);
await contractWrappers.exchange.cancelOrderAsync(signedOrder);
})().catch(done);
});
- it('should emit orderStateInvalid when within rounding error range', (done: DoneCallback) => {
+ it('should emit orderStateInvalid when within rounding error range after a partial fill', (done: DoneCallback) => {
(async () => {
- const remainingFillableAmountInBaseUnits = new BigNumber(100);
- signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ const fillAmountInBaseUnits = new BigNumber(2);
+ const makerAssetAmount = new BigNumber(1001);
+ const takerAssetAmount = new BigNumber(3);
+ signedOrder = await fillScenarios.createAsymmetricFillableSignedOrderAsync(
makerAssetData,
takerAssetData,
makerAddress,
takerAddress,
- fillableAmount,
+ makerAssetAmount,
+ takerAssetAmount,
);
const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
await orderWatcher.addOrderAsync(signedOrder);
-
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState as OrderStateInvalid;
@@ -527,11 +529,7 @@ describe('OrderWatcher', () => {
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderFillRoundingError);
});
orderWatcher.subscribe(callback);
- await contractWrappers.exchange.fillOrderAsync(
- signedOrder,
- fillableAmount.minus(remainingFillableAmountInBaseUnits),
- takerAddress,
- );
+ await contractWrappers.exchange.fillOrderAsync(signedOrder, fillAmountInBaseUnits, takerAddress);
})().catch(done);
});
describe('erc721', () => {