aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/test')
-rw-r--r--packages/contracts/test/exchange/core.ts27
1 files changed, 14 insertions, 13 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index c7724c511..ae136816e 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -19,6 +19,7 @@ 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';
@@ -393,7 +394,7 @@ describe('Exchange', () => {
const res = await exWrapper.fillOrderAsync(signedOrder, taker, {
takerTokenFillAmount: signedOrder.takerTokenAmount,
});
- const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>;
+ const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogFillContractEventArgs>;
expect(log.args.takerTokenFilledAmount).to.be.bignumber.equal(
signedOrder.takerTokenAmount.minus(takerTokenFillAmount),
);
@@ -429,7 +430,7 @@ describe('Exchange', () => {
});
expect(res.logs).to.have.length(1);
- const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>;
+ const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogFillContractEventArgs>;
const logArgs = log.args;
const expectedFilledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor);
const expectedFilledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor);
@@ -460,7 +461,7 @@ describe('Exchange', () => {
});
expect(res.logs).to.have.length(1);
- const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>;
+ const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogFillContractEventArgs>;
const logArgs = log.args;
const expectedFilledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor);
const expectedFilledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor);
@@ -688,8 +689,8 @@ describe('Exchange', () => {
const res = await exWrapper.fillOrderAsync(signedOrder, taker);
expect(res.logs).to.have.length(1);
- const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>;
- const errCode = log.args.errorId;
+ const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogErrorContractEventArgs>;
+ const errCode = log.args.errorId.toNumber();
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_EXPIRED);
});
@@ -699,8 +700,8 @@ describe('Exchange', () => {
const res = await exWrapper.fillOrderAsync(signedOrder, taker);
expect(res.logs).to.have.length(1);
- const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>;
- const errCode = log.args.errorId;
+ const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogErrorContractEventArgs>;
+ const errCode = log.args.errorId.toNumber();
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED_OR_CANCELLED);
});
});
@@ -760,7 +761,7 @@ describe('Exchange', () => {
const res = await exWrapper.fillOrderAsync(signedOrder, taker, {
takerTokenFillAmount: signedOrder.takerTokenAmount,
});
- const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>;
+ const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogFillContractEventArgs>;
expect(log.args.takerTokenFilledAmount).to.be.bignumber.equal(
signedOrder.takerTokenAmount.minus(takerTokenCancelAmount),
);
@@ -805,7 +806,7 @@ describe('Exchange', () => {
});
expect(res.logs).to.have.length(1);
- const log = res.logs[0] as LogWithDecodedArgs<LogCancelContractEventArgs>;
+ const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogCancelContractEventArgs>;
const logArgs = log.args;
const expectedCancelledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor);
const expectedCancelledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor);
@@ -826,8 +827,8 @@ describe('Exchange', () => {
const res = await exWrapper.cancelOrderAsync(signedOrder, maker);
expect(res.logs).to.have.length(1);
- const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>;
- const errCode = log.args.errorId;
+ const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogErrorContractEventArgs>;
+ const errCode = log.args.errorId.toNumber();
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED_OR_CANCELLED);
});
@@ -838,8 +839,8 @@ describe('Exchange', () => {
const res = await exWrapper.cancelOrderAsync(signedOrder, maker);
expect(res.logs).to.have.length(1);
- const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>;
- const errCode = log.args.errorId;
+ const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs<LogErrorContractEventArgs>;
+ const errCode = log.args.errorId.toNumber();
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_EXPIRED);
});
});