diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-04-03 06:28:56 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-21 04:56:17 +0800 |
commit | 7a66da5a51603d4d87d644f3635f8c7f1d00bb36 (patch) | |
tree | a633cb75b01eec7a0ea49078ddd412720c6807d3 | |
parent | 3541f5e1dac692fa12fafd4822dc98aa7afe5c1c (diff) | |
download | dexon-sol-tools-7a66da5a51603d4d87d644f3635f8c7f1d00bb36.tar.gz dexon-sol-tools-7a66da5a51603d4d87d644f3635f8c7f1d00bb36.tar.zst dexon-sol-tools-7a66da5a51603d4d87d644f3635f8c7f1d00bb36.zip |
Fix build errors
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol | 2 | ||||
-rw-r--r-- | packages/contracts/src/utils/exchange_wrapper.ts | 10 | ||||
-rw-r--r-- | packages/contracts/src/utils/log_decoder.ts | 7 | ||||
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 34 | ||||
-rw-r--r-- | yarn.lock | 16 |
5 files changed, 40 insertions, 29 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol index a42519850..82c1cc33a 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol @@ -134,7 +134,7 @@ contract MixinExchangeCore is // Validate order is not cancelled if (order.salt < makerEpoch[order.makerAddress]) { - LogError(uint8(Errors.ORDER_FULLY_FILLED_OR_CANCELLED), orderHash); + LogError(uint8(Errors.ORDER_CANCELLED), orderHash); return 0; } diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index bbe9a1baf..179fe44a5 100644 --- a/packages/contracts/src/utils/exchange_wrapper.ts +++ b/packages/contracts/src/utils/exchange_wrapper.ts @@ -154,14 +154,8 @@ export class ExchangeWrapper { const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash); return tx; } - public async cancelOrdersUpToAsync( - salt: BigNumber, - from: string, - ): Promise<TransactionReceiptWithDecodedLogs> { - const txHash = await this._exchange.cancelOrdersUpTo.sendTransactionAsync( - salt, - { from }, - ); + public async cancelOrdersUpToAsync(salt: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> { + const txHash = await this._exchange.cancelOrdersUpTo.sendTransactionAsync(salt, { from }); const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash); return tx; } diff --git a/packages/contracts/src/utils/log_decoder.ts b/packages/contracts/src/utils/log_decoder.ts index 845e025fe..291b85dd2 100644 --- a/packages/contracts/src/utils/log_decoder.ts +++ b/packages/contracts/src/utils/log_decoder.ts @@ -1,7 +1,6 @@ -import { LogWithDecodedArgs, RawLog } from '@0xproject/types'; +import { AbiDefinition, LogEntry, LogWithDecodedArgs, RawLog } from '@0xproject/types'; import { AbiDecoder, BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; -import * as Web3 from 'web3'; import { artifacts } from './artifacts'; import { Artifact } from './types'; @@ -12,7 +11,7 @@ export class LogDecoder { if (_.isUndefined(networkIdIfExists)) { throw new Error('networkId not specified'); } - const abiArrays: Web3.AbiDefinition[][] = []; + const abiArrays: AbiDefinition[][] = []; _.forEach(artifacts, (artifact: Artifact) => { const networkIfExists = artifact.networks[networkIdIfExists]; if (_.isUndefined(networkIfExists)) { @@ -22,7 +21,7 @@ export class LogDecoder { }); this._abiDecoder = new AbiDecoder(abiArrays); } - public decodeLogOrThrow<ArgsType>(log: Web3.LogEntry): LogWithDecodedArgs<ArgsType> | RawLog { + public decodeLogOrThrow<ArgsType>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog { const logWithDecodedArgsOrLog = this._abiDecoder.tryToDecodeLogOrNoop(log); if (_.isUndefined((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args)) { throw new Error(`Unable to decode log: ${JSON.stringify(log)}`); diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 4dfe3df5d..f3ab94139 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -679,22 +679,22 @@ describe('Exchange', () => { }); }); - describe('cancelOrdersUpTo', () => { + describe('cancelOrdersUpTo', () => { it('should fail to set makerEpoch less than current makerEpoch', async () => { const makerEpoch = new BigNumber(1); await exWrapper.cancelOrdersUpToAsync(makerEpoch, makerAddress); const lesserMakerEpoch = new BigNumber(0); - return expect( - exWrapper.cancelOrdersUpToAsync(lesserMakerEpoch, makerAddress), - ).to.be.rejectedWith(constants.REVERT); + return expect(exWrapper.cancelOrdersUpToAsync(lesserMakerEpoch, makerAddress)).to.be.rejectedWith( + constants.REVERT, + ); }); it('should fail to set makerEpoch equal to existing makerEpoch', async () => { const makerEpoch = new BigNumber(1); await exWrapper.cancelOrdersUpToAsync(makerEpoch, makerAddress); - return expect( - exWrapper.cancelOrdersUpToAsync(makerEpoch, makerAddress), - ).to.be.rejectedWith(constants.REVERT); + return expect(exWrapper.cancelOrdersUpToAsync(makerEpoch, makerAddress)).to.be.rejectedWith( + constants.REVERT, + ); }); it('should cancel only orders with a makerEpoch less than existing makerEpoch', async () => { @@ -709,19 +709,23 @@ describe('Exchange', () => { orderFactory.newSignedOrder({ makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(9), 18), takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(9), 18), - salt: new BigNumber(0)}), + salt: new BigNumber(0), + }), orderFactory.newSignedOrder({ makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(79), 18), takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(79), 18), - salt: new BigNumber(1)}), + salt: new BigNumber(1), + }), orderFactory.newSignedOrder({ makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18), takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18), - salt: new BigNumber(2)}), + salt: new BigNumber(2), + }), orderFactory.newSignedOrder({ makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(7979), 18), takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(7979), 18), - salt: new BigNumber(3)}), + salt: new BigNumber(3), + }), ]); await exWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress); @@ -736,14 +740,18 @@ describe('Exchange', () => { expect(newBalances[makerAddress][signedOrders[3].takerTokenAddress]).to.be.bignumber.equal( balances[makerAddress][signedOrders[3].takerTokenAddress].add(fillTakerTokenAmount), ); - expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(balances[makerAddress][zrx.address].minus(makerFeeAmount)); + expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal( + balances[makerAddress][zrx.address].minus(makerFeeAmount), + ); expect(newBalances[takerAddress][signedOrders[3].takerTokenAddress]).to.be.bignumber.equal( balances[takerAddress][signedOrders[3].takerTokenAddress].minus(fillTakerTokenAmount), ); expect(newBalances[takerAddress][signedOrders[3].makerTokenAddress]).to.be.bignumber.equal( balances[takerAddress][signedOrders[3].makerTokenAddress].add(fillMakerTokenAmount), ); - expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(balances[takerAddress][zrx.address].minus(takerFeeAmount)); + expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal( + balances[takerAddress][zrx.address].minus(takerFeeAmount), + ); expect(newBalances[feeRecipientAddress][zrx.address]).to.be.bignumber.equal( balances[feeRecipientAddress][zrx.address].add(makerFeeAmount.add(takerFeeAmount)), ); @@ -3292,9 +3292,19 @@ ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" -electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.30: - version "1.3.42" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.42.tgz#95c33bf01d0cc405556aec899fe61fd4d76ea0f9" +electron-releases@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/electron-releases/-/electron-releases-2.1.0.tgz#c5614bf811f176ce3c836e368a0625782341fd4e" + +electron-to-chromium@^1.2.7: + version "1.3.30" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.30.tgz#9666f532a64586651fc56a72513692e820d06a80" + dependencies: + electron-releases "^2.1.0" + +electron-to-chromium@^1.3.30: + version "1.3.36" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.36.tgz#0eabf71a9ebea9013fb1cc35a390e068624f27e8" elliptic@6.3.3: version "6.3.3" |