diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-07-08 07:10:07 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-07-11 15:30:14 +0800 |
commit | a8c9945a0fd85cbb95741b5fed385455786700ce (patch) | |
tree | 576a2434c1f8c844150288b554c9a6848ceefa75 | |
parent | be1f7db2dfd20e20b45660e1efb4f2b9193bc429 (diff) | |
download | dexon-sol-tools-a8c9945a0fd85cbb95741b5fed385455786700ce.tar dexon-sol-tools-a8c9945a0fd85cbb95741b5fed385455786700ce.tar.gz dexon-sol-tools-a8c9945a0fd85cbb95741b5fed385455786700ce.tar.bz2 dexon-sol-tools-a8c9945a0fd85cbb95741b5fed385455786700ce.tar.lz dexon-sol-tools-a8c9945a0fd85cbb95741b5fed385455786700ce.tar.xz dexon-sol-tools-a8c9945a0fd85cbb95741b5fed385455786700ce.tar.zst dexon-sol-tools-a8c9945a0fd85cbb95741b5fed385455786700ce.zip |
Migrate events
-rw-r--r-- | src/artifacts/exchange/Exchange_v1.json | 20 | ||||
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 7 | ||||
-rw-r--r-- | src/types.ts | 20 | ||||
-rw-r--r-- | test/exchange_wrapper_test.ts | 8 |
4 files changed, 28 insertions, 27 deletions
diff --git a/src/artifacts/exchange/Exchange_v1.json b/src/artifacts/exchange/Exchange_v1.json index a9180d31a..c341612ea 100644 --- a/src/artifacts/exchange/Exchange_v1.json +++ b/src/artifacts/exchange/Exchange_v1.json @@ -477,32 +477,32 @@ }, { "indexed": false, - "name": "tokenM", + "name": "makerToken", "type": "address" }, { "indexed": false, - "name": "tokenT", + "name": "takerToken", "type": "address" }, { "indexed": false, - "name": "filledValueM", + "name": "filledMakerTokenAmount", "type": "uint256" }, { "indexed": false, - "name": "filledValueT", + "name": "filledTakerTokenAmount", "type": "uint256" }, { "indexed": false, - "name": "feeMPaid", + "name": "paidMakerFee", "type": "uint256" }, { "indexed": false, - "name": "feeTPaid", + "name": "paidTakerFee", "type": "uint256" }, { @@ -534,22 +534,22 @@ }, { "indexed": false, - "name": "tokenM", + "name": "makerToken", "type": "address" }, { "indexed": false, - "name": "tokenT", + "name": "takerToken", "type": "address" }, { "indexed": false, - "name": "cancelledValueM", + "name": "cancelledMakerTokenAmount", "type": "uint256" }, { "indexed": false, - "name": "cancelledValueT", + "name": "cancelledTakerTokenAmount", "type": "uint256" }, { diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index da7e22f61..a930135a4 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -201,7 +201,7 @@ export class ExchangeWrapper extends ContractWrapper { ); this._throwErrorLogsAsErrors(response.logs); const logFillArgs = response.logs[0].args as LogFillContractEventArgs; - const filledTakerTokenAmount = new BigNumber(logFillArgs.filledValueT); + const filledTakerTokenAmount = new BigNumber(logFillArgs.filledTakerTokenAmount); return filledTakerTokenAmount; } /** @@ -283,7 +283,8 @@ export class ExchangeWrapper extends ContractWrapper { this._throwErrorLogsAsErrors(response.logs); let filledTakerTokenAmount = new BigNumber(0); _.each(response.logs, log => { - filledTakerTokenAmount = filledTakerTokenAmount.plus((log.args as LogFillContractEventArgs).filledValueT); + filledTakerTokenAmount = filledTakerTokenAmount.plus( + (log.args as LogFillContractEventArgs).filledTakerTokenAmount); }); return filledTakerTokenAmount; } @@ -518,7 +519,7 @@ export class ExchangeWrapper extends ContractWrapper { ); this._throwErrorLogsAsErrors(response.logs); const logFillArgs = response.logs[0].args as LogCancelContractEventArgs; - const cancelledTakerTokenAmount = new BigNumber(logFillArgs.cancelledValueT); + const cancelledTakerTokenAmount = new BigNumber(logFillArgs.cancelledTakerTokenAmount); return cancelledTakerTokenAmount; } /** diff --git a/src/types.ts b/src/types.ts index 9e97d1c9d..851627a09 100644 --- a/src/types.ts +++ b/src/types.ts @@ -234,22 +234,22 @@ export interface LogFillContractEventArgs { maker: string; taker: string; feeRecipient: string; - tokenM: string; - tokenT: string; - filledValueM: BigNumber.BigNumber; - filledValueT: BigNumber.BigNumber; - feeMPaid: BigNumber.BigNumber; - feeTPaid: BigNumber.BigNumber; + makerToken: string; + takerToken: string; + filledMakerTokenAmount: BigNumber.BigNumber; + filledTakerTokenAmount: BigNumber.BigNumber; + paidMakerFee: BigNumber.BigNumber; + paidTakerFee: BigNumber.BigNumber; tokens: string; orderHash: string; } export interface LogCancelContractEventArgs { maker: string; feeRecipient: string; - tokenM: string; - tokenT: string; - cancelledValueM: BigNumber.BigNumber; - cancelledValueT: BigNumber.BigNumber; + makerToken: string; + takerToken: string; + cancelledMakerTokenAmount: BigNumber.BigNumber; + cancelledTakerTokenAmount: BigNumber.BigNumber; tokens: string; orderHash: string; } diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 53032efd6..ed2e45abf 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -785,10 +785,10 @@ describe('ExchangeWrapper', () => { ); zeroExEvent.watch((err: Error, event: ContractEvent) => { const args = event.args as LogFillContractEventArgs; - expect(args.filledValueM.isBigNumber).to.be.true(); - expect(args.filledValueT.isBigNumber).to.be.true(); - expect(args.feeMPaid.isBigNumber).to.be.true(); - expect(args.feeTPaid.isBigNumber).to.be.true(); + expect(args.filledMakerTokenAmount.isBigNumber).to.be.true(); + expect(args.filledTakerTokenAmount.isBigNumber).to.be.true(); + expect(args.paidMakerFee.isBigNumber).to.be.true(); + expect(args.paidTakerFee.isBigNumber).to.be.true(); done(); }); await zeroEx.exchange.fillOrderAsync( |