diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-17 02:15:17 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-17 02:15:17 +0800 |
commit | dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc (patch) | |
tree | a93d0d6864c3e0f37c2663a6ba9ae0d3e7813fe9 /packages/contract-wrappers/test/revert_validation_test.ts | |
parent | d268e19124f086128aa293c5fe847f81891f7121 (diff) | |
parent | 72f5719b3412da7840a7b85e4dce512ecbaece4d (diff) | |
download | dexon-0x-contracts-dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc.tar.gz dexon-0x-contracts-dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc.tar.zst dexon-0x-contracts-dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc.zip |
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/move-features-over-from-zrx-buyer
Diffstat (limited to 'packages/contract-wrappers/test/revert_validation_test.ts')
-rw-r--r-- | packages/contract-wrappers/test/revert_validation_test.ts | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/packages/contract-wrappers/test/revert_validation_test.ts b/packages/contract-wrappers/test/revert_validation_test.ts index da011c1d7..f5f8be6c3 100644 --- a/packages/contract-wrappers/test/revert_validation_test.ts +++ b/packages/contract-wrappers/test/revert_validation_test.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; import { FillScenarios } from '@0xproject/fill-scenarios'; -import { runV2MigrationsAsync } from '@0xproject/migrations'; +import { runMigrationsAsync } from '@0xproject/migrations'; import { assetDataUtils } from '@0xproject/order-utils'; import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; @@ -20,28 +20,19 @@ const expect = chai.expect; describe('Revert Validation ExchangeWrapper', () => { let contractWrappers: ContractWrappers; let userAddresses: string[]; - let zrxTokenAddress: string; let fillScenarios: FillScenarios; - let exchangeContractAddress: string; let makerTokenAddress: string; let takerTokenAddress: string; - let coinbase: string; let makerAddress: string; - let anotherMakerAddress: string; let takerAddress: string; let makerAssetData: string; let takerAssetData: string; - let feeRecipient: string; let txHash: string; let blockchainLifecycle: BlockchainLifecycle; let web3Wrapper: Web3Wrapper; const fillableAmount = new BigNumber(5); const takerTokenFillAmount = new BigNumber(5); let signedOrder: SignedOrder; - const config = { - networkId: constants.TESTRPC_NETWORK_ID, - blockPollingIntervalMs: 0, - }; before(async () => { // vmErrorsOnRPCResponse is useful for quick feedback and testing during development // but is not the default behaviour in production. Here we ensure our failure cases @@ -52,29 +43,31 @@ describe('Revert Validation ExchangeWrapper', () => { }); web3Wrapper = new Web3Wrapper(provider); blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); + // Re-deploy the artifacts in this provider, rather than in the default provider exposed in + // the beforeAll hook. This is due to the fact that the default provider enabled vmErrorsOnRPCResponse + // and we are explicity testing with vmErrorsOnRPCResponse disabled. const txDefaults = { gas: devConstants.GAS_LIMIT, from: devConstants.TESTRPC_FIRST_ADDRESS, }; - const artifactsDir = `src/artifacts`; - // Re-deploy the artifacts in this provider, rather than in the default provider exposed in - // the beforeAll hook. This is due to the fact that the default provider enabled vmErrorsOnRPCResponse - // and we are explicity testing with vmErrorsOnRPCResponse disabled. - await runV2MigrationsAsync(provider, artifactsDir, txDefaults); await blockchainLifecycle.startAsync(); + const contractAddresses = await runMigrationsAsync(provider, txDefaults); + const config = { + networkId: constants.TESTRPC_NETWORK_ID, + contractAddresses, + blockPollingIntervalMs: 10, + }; contractWrappers = new ContractWrappers(provider, config); - exchangeContractAddress = contractWrappers.exchange.getContractAddress(); userAddresses = await web3Wrapper.getAvailableAddressesAsync(); - zrxTokenAddress = tokenUtils.getProtocolTokenAddress(); fillScenarios = new FillScenarios( provider, userAddresses, - zrxTokenAddress, - exchangeContractAddress, - contractWrappers.erc20Proxy.getContractAddress(), - contractWrappers.erc721Proxy.getContractAddress(), + contractAddresses.zrxToken, + contractAddresses.exchange, + contractAddresses.erc20Proxy, + contractAddresses.erc721Proxy, ); - [coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses; + [, makerAddress, takerAddress] = userAddresses; [makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses(); [makerAssetData, takerAssetData] = [ assetDataUtils.encodeERC20AssetData(makerTokenAddress), @@ -112,7 +105,7 @@ describe('Revert Validation ExchangeWrapper', () => { makerTokenBalance, ); await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - expect( + return expect( contractWrappers.exchange.fillOrderAsync(signedOrder, takerTokenFillAmount, takerAddress, { shouldValidate: true, }), |