diff options
author | Jacob Evans <jacob@dekz.net> | 2018-04-30 16:05:45 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-05-01 12:43:47 +0800 |
commit | b36587fac833f4fa35aaed49e4ee05f6ce347a02 (patch) | |
tree | 1f902e97de4b33c885ca2ae5d6bd01119944e539 /packages/0x.js/test/order_validation_test.ts | |
parent | 47604384d4042c3c61f29a635491f8165236e763 (diff) | |
download | dexon-sol-tools-b36587fac833f4fa35aaed49e4ee05f6ce347a02.tar dexon-sol-tools-b36587fac833f4fa35aaed49e4ee05f6ce347a02.tar.gz dexon-sol-tools-b36587fac833f4fa35aaed49e4ee05f6ce347a02.tar.bz2 dexon-sol-tools-b36587fac833f4fa35aaed49e4ee05f6ce347a02.tar.lz dexon-sol-tools-b36587fac833f4fa35aaed49e4ee05f6ce347a02.tar.xz dexon-sol-tools-b36587fac833f4fa35aaed49e4ee05f6ce347a02.tar.zst dexon-sol-tools-b36587fac833f4fa35aaed49e4ee05f6ce347a02.zip |
Execute taker side in trade simulation
Fill if the taker address is open
Diffstat (limited to 'packages/0x.js/test/order_validation_test.ts')
-rw-r--r-- | packages/0x.js/test/order_validation_test.ts | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/packages/0x.js/test/order_validation_test.ts b/packages/0x.js/test/order_validation_test.ts index c894774b8..9b843b930 100644 --- a/packages/0x.js/test/order_validation_test.ts +++ b/packages/0x.js/test/order_validation_test.ts @@ -68,6 +68,40 @@ describe('OrderValidation', () => { ); await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder); }); + it('should succeed if the maker is buying ZRX and has no ZRX balance', async () => { + const makerFee = new BigNumber(2); + const takerFee = new BigNumber(2); + const signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync( + makerTokenAddress, + zrxTokenAddress, + makerFee, + takerFee, + makerAddress, + takerAddress, + fillableAmount, + feeRecipient, + ); + const zrxMakerBalance = await zeroEx.token.getBalanceAsync(zrxTokenAddress, makerAddress); + await zeroEx.token.transferAsync(zrxTokenAddress, makerAddress, takerAddress, zrxMakerBalance); + await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder); + }); + it('should succeed if the maker is buying ZRX and has no ZRX balance and there is no specified taker', async () => { + const makerFee = new BigNumber(2); + const takerFee = new BigNumber(2); + const signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync( + makerTokenAddress, + zrxTokenAddress, + makerFee, + takerFee, + makerAddress, + constants.NULL_ADDRESS, + fillableAmount, + feeRecipient, + ); + const zrxMakerBalance = await zeroEx.token.getBalanceAsync(zrxTokenAddress, makerAddress); + await zeroEx.token.transferAsync(zrxTokenAddress, makerAddress, takerAddress, zrxMakerBalance); + await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder); + }); it('should succeed if the order is asymmetric and fillable', async () => { const makerFillableAmount = fillableAmount; const takerFillableAmount = fillableAmount.minus(4); @@ -469,4 +503,4 @@ describe('OrderValidation', () => { expect(partialTakerFee).to.be.bignumber.equal(takerPartialFee); }); }); -}); +}); // tslint:disable-line:max-file-line-count |