diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-02 08:29:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-02 08:29:44 +0800 |
commit | d50fbac5f937602d7a90343ea8ff88cee5c4542f (patch) | |
tree | d1c818e64b75c1f4fed1c7d797892fb0d35dd779 /packages/contracts/src/utils/match_order_tester.ts | |
parent | 62e60e2ba6d07b9b892b4f2e92a5421c54f5fa20 (diff) | |
parent | d3c64bd5b493dc1779a24c7c051c255106a4292a (diff) | |
download | dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar.gz dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar.bz2 dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar.lz dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar.xz dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.tar.zst dexon-sol-tools-d50fbac5f937602d7a90343ea8ff88cee5c4542f.zip |
Merge pull request #636 from 0xProject/refactor/order-utils/for-v2
Refactor order-utils for v2
Diffstat (limited to 'packages/contracts/src/utils/match_order_tester.ts')
-rw-r--r-- | packages/contracts/src/utils/match_order_tester.ts | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/packages/contracts/src/utils/match_order_tester.ts b/packages/contracts/src/utils/match_order_tester.ts index ec8931a20..09c0d8083 100644 --- a/packages/contracts/src/utils/match_order_tester.ts +++ b/packages/contracts/src/utils/match_order_tester.ts @@ -1,5 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { SignedOrder } from '@0xproject/types'; +import { assetProxyUtils, crypto, orderHashUtils } from '@0xproject/order-utils'; +import { AssetProxyId, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; @@ -15,17 +16,13 @@ import { ExchangeContract, FillContractEventArgs, } from '../contract_wrappers/generated/exchange'; -import { assetProxyUtils } from '../utils/asset_proxy_utils'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; -import { crypto } from '../utils/crypto'; import { ERC20Wrapper } from '../utils/erc20_wrapper'; import { ERC721Wrapper } from '../utils/erc721_wrapper'; import { ExchangeWrapper } from '../utils/exchange_wrapper'; import { OrderFactory } from '../utils/order_factory'; -import { orderUtils } from '../utils/order_utils'; import { - AssetProxyId, ContractName, ERC20BalancesByOwner, ERC721TokenIdsByOwner, @@ -123,7 +120,7 @@ export class MatchOrderTester { const feeRecipientAddressRight = signedOrderRight.feeRecipientAddress; // Verify Left order preconditions const orderTakerAssetFilledAmountLeft = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( - orderUtils.getOrderHashHex(signedOrderLeft), + orderHashUtils.getOrderHashHex(signedOrderLeft), ); const expectedOrderFilledAmountLeft = initialTakerAssetFilledAmountLeft ? initialTakerAssetFilledAmountLeft @@ -131,7 +128,7 @@ export class MatchOrderTester { expect(expectedOrderFilledAmountLeft).to.be.bignumber.equal(orderTakerAssetFilledAmountLeft); // Verify Right order preconditions const orderTakerAssetFilledAmountRight = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( - orderUtils.getOrderHashHex(signedOrderRight), + orderHashUtils.getOrderHashHex(signedOrderRight), ); const expectedOrderFilledAmountRight = initialTakerAssetFilledAmountRight ? initialTakerAssetFilledAmountRight @@ -182,7 +179,7 @@ export class MatchOrderTester { orderTakerAssetFilledAmountRight: BigNumber, ): Promise<TransferAmounts> { let amountBoughtByLeftMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( - orderUtils.getOrderHashHex(signedOrderLeft), + orderHashUtils.getOrderHashHex(signedOrderLeft), ); amountBoughtByLeftMaker = amountBoughtByLeftMaker.minus(orderTakerAssetFilledAmountLeft); const amountSoldByLeftMaker = amountBoughtByLeftMaker @@ -193,7 +190,7 @@ export class MatchOrderTester { .dividedToIntegerBy(signedOrderRight.makerAssetAmount); const amountReceivedByTaker = amountSoldByLeftMaker.minus(amountReceivedByRightMaker); let amountBoughtByRightMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( - orderUtils.getOrderHashHex(signedOrderRight), + orderHashUtils.getOrderHashHex(signedOrderRight), ); amountBoughtByRightMaker = amountBoughtByRightMaker.minus(orderTakerAssetFilledAmountRight); const amountSoldByRightMaker = amountBoughtByRightMaker |