diff options
Diffstat (limited to 'packages/contracts/test/exchange/transactions.ts')
-rw-r--r-- | packages/contracts/test/exchange/transactions.ts | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index fc7aa8404..9af8b522b 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { generatePseudoRandomSalt } from '@0xproject/order-utils'; -import { Order, SignedOrder } from '@0xproject/types'; +import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils'; +import { AssetProxyId, Order, OrderWithoutExchangeAddress, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as ethUtil from 'ethereumjs-util'; @@ -11,7 +11,6 @@ import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c2 import { ExchangeContract } from '../../src/contract_wrappers/generated/exchange'; import { WhitelistContract } from '../../src/contract_wrappers/generated/whitelist'; import { artifacts } from '../../src/utils/artifacts'; -import { assetProxyUtils } from '../../src/utils/asset_proxy_utils'; import { chaiSetup } from '../../src/utils/chai_setup'; import { constants } from '../../src/utils/constants'; import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; @@ -19,13 +18,7 @@ import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; import { OrderFactory } from '../../src/utils/order_factory'; import { orderUtils } from '../../src/utils/order_utils'; import { TransactionFactory } from '../../src/utils/transaction_factory'; -import { - AssetProxyId, - ERC20BalancesByOwner, - ExchangeStatus, - SignatureType, - SignedTransaction, -} from '../../src/utils/types'; +import { ERC20BalancesByOwner, ExchangeStatus, SignedTransaction } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); @@ -48,7 +41,7 @@ describe('Exchange transactions', () => { let erc20Balances: ERC20BalancesByOwner; let signedOrder: SignedOrder; let signedTx: SignedTransaction; - let order: Order; + let orderWithoutExchangeAddress: OrderWithoutExchangeAddress; let orderFactory: OrderFactory; let makerTransactionFactory: TransactionFactory; let takerTransactionFactory: TransactionFactory; @@ -121,11 +114,11 @@ describe('Exchange transactions', () => { beforeEach(async () => { erc20Balances = await erc20Wrapper.getBalancesAsync(); signedOrder = orderFactory.newSignedOrder(); - order = orderUtils.getOrderStruct(signedOrder); + orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder); takerAssetFillAmount = signedOrder.takerAssetAmount.div(2); const data = exchange.fillOrder.getABIEncodedTransactionData( - order, + orderWithoutExchangeAddress, takerAssetFillAmount, signedOrder.signature, ); @@ -189,7 +182,7 @@ describe('Exchange transactions', () => { describe('cancelOrder', () => { beforeEach(async () => { - const data = exchange.cancelOrder.getABIEncodedTransactionData(order); + const data = exchange.cancelOrder.getABIEncodedTransactionData(orderWithoutExchangeAddress); signedTx = makerTransactionFactory.newSignedTransaction(data); }); @@ -248,12 +241,12 @@ describe('Exchange transactions', () => { await whitelist.updateWhitelistStatus.sendTransactionAsync(takerAddress, isApproved, { from: owner }), ); - const orderStruct = orderUtils.getOrderStruct(signedOrder); + orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder); const takerAssetFillAmount = signedOrder.takerAssetAmount; const salt = generatePseudoRandomSalt(); return expect( whitelist.fillOrderIfWhitelisted.sendTransactionAsync( - orderStruct, + orderWithoutExchangeAddress, takerAssetFillAmount, salt, signedOrder.signature, @@ -268,12 +261,12 @@ describe('Exchange transactions', () => { await whitelist.updateWhitelistStatus.sendTransactionAsync(makerAddress, isApproved, { from: owner }), ); - const orderStruct = orderUtils.getOrderStruct(signedOrder); + orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder); const takerAssetFillAmount = signedOrder.takerAssetAmount; const salt = generatePseudoRandomSalt(); return expect( whitelist.fillOrderIfWhitelisted.sendTransactionAsync( - orderStruct, + orderWithoutExchangeAddress, takerAssetFillAmount, salt, signedOrder.signature, @@ -292,12 +285,12 @@ describe('Exchange transactions', () => { await whitelist.updateWhitelistStatus.sendTransactionAsync(takerAddress, isApproved, { from: owner }), ); - const orderStruct = orderUtils.getOrderStruct(signedOrder); + orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder); const takerAssetFillAmount = signedOrder.takerAssetAmount; const salt = generatePseudoRandomSalt(); await web3Wrapper.awaitTransactionSuccessAsync( await whitelist.fillOrderIfWhitelisted.sendTransactionAsync( - orderStruct, + orderWithoutExchangeAddress, takerAssetFillAmount, salt, signedOrder.signature, |