aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-02-10 05:43:32 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:16 +0800
commit4c76ad072a043253085fc0f08f47afb30bb6f834 (patch)
tree6947520aba3b7b735bca57439be2d7b814dc91e1 /packages/contracts/test
parentedf837ed622d782e43b0d25dd46a27469b9b0381 (diff)
downloaddexon-0x-contracts-4c76ad072a043253085fc0f08f47afb30bb6f834.tar.gz
dexon-0x-contracts-4c76ad072a043253085fc0f08f47afb30bb6f834.tar.zst
dexon-0x-contracts-4c76ad072a043253085fc0f08f47afb30bb6f834.zip
Move log decoding logic to exchange wrapper
Diffstat (limited to 'packages/contracts/test')
-rw-r--r--packages/contracts/test/exchange/core.ts19
1 files changed, 9 insertions, 10 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index ae136816e..e21879c9e 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -19,7 +19,6 @@ import { Balances } from '../../src/utils/balances';
import { constants } from '../../src/utils/constants';
import { crypto } from '../../src/utils/crypto';
import { ExchangeWrapper } from '../../src/utils/exchange_wrapper';
-import { LogDecoder } from '../../src/utils/log_decoder';
import { OrderFactory } from '../../src/utils/order_factory';
import { BalancesByOwner, ContractName, ExchangeContractErrs } from '../../src/utils/types';
import { chaiSetup } from '../utils/chai_setup';
@@ -394,7 +393,7 @@ describe('Exchange', () => {
const res = await exWrapper.fillOrderAsync(signedOrder, taker, {
takerTokenFillAmount: signedOrder.takerTokenAmount,
});
- const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogFillContractEventArgs>;
+ const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>;
expect(log.args.takerTokenFilledAmount).to.be.bignumber.equal(
signedOrder.takerTokenAmount.minus(takerTokenFillAmount),
);
@@ -430,7 +429,7 @@ describe('Exchange', () => {
});
expect(res.logs).to.have.length(1);
- const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogFillContractEventArgs>;
+ const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>;
const logArgs = log.args;
const expectedFilledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor);
const expectedFilledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor);
@@ -461,7 +460,7 @@ describe('Exchange', () => {
});
expect(res.logs).to.have.length(1);
- const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogFillContractEventArgs>;
+ const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>;
const logArgs = log.args;
const expectedFilledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor);
const expectedFilledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor);
@@ -689,7 +688,7 @@ describe('Exchange', () => {
const res = await exWrapper.fillOrderAsync(signedOrder, taker);
expect(res.logs).to.have.length(1);
- const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogErrorContractEventArgs>;
+ const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>;
const errCode = log.args.errorId.toNumber();
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_EXPIRED);
});
@@ -700,7 +699,7 @@ describe('Exchange', () => {
const res = await exWrapper.fillOrderAsync(signedOrder, taker);
expect(res.logs).to.have.length(1);
- const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogErrorContractEventArgs>;
+ const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>;
const errCode = log.args.errorId.toNumber();
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED_OR_CANCELLED);
});
@@ -761,7 +760,7 @@ describe('Exchange', () => {
const res = await exWrapper.fillOrderAsync(signedOrder, taker, {
takerTokenFillAmount: signedOrder.takerTokenAmount,
});
- const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogFillContractEventArgs>;
+ const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>;
expect(log.args.takerTokenFilledAmount).to.be.bignumber.equal(
signedOrder.takerTokenAmount.minus(takerTokenCancelAmount),
);
@@ -806,7 +805,7 @@ describe('Exchange', () => {
});
expect(res.logs).to.have.length(1);
- const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogCancelContractEventArgs>;
+ const log = res.logs[0] as LogWithDecodedArgs<LogCancelContractEventArgs>;
const logArgs = log.args;
const expectedCancelledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor);
const expectedCancelledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor);
@@ -827,7 +826,7 @@ describe('Exchange', () => {
const res = await exWrapper.cancelOrderAsync(signedOrder, maker);
expect(res.logs).to.have.length(1);
- const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogErrorContractEventArgs>;
+ const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>;
const errCode = log.args.errorId.toNumber();
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED_OR_CANCELLED);
});
@@ -839,7 +838,7 @@ describe('Exchange', () => {
const res = await exWrapper.cancelOrderAsync(signedOrder, maker);
expect(res.logs).to.have.length(1);
- const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogErrorContractEventArgs>;
+ const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>;
const errCode = log.args.errorId.toNumber();
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_EXPIRED);
});