diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-03-31 02:05:35 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-21 04:56:17 +0800 |
commit | 2f639b77bbcad9884b25536787e1d35a2eee2e34 (patch) | |
tree | 7e6cdd50f228abe9c78a35db492b59fe4fa08179 /packages/contracts/test/exchange | |
parent | 8b5b3718213fe329231e6a94dcb77a1fd0e74fd5 (diff) | |
download | dexon-sol-tools-2f639b77bbcad9884b25536787e1d35a2eee2e34.tar dexon-sol-tools-2f639b77bbcad9884b25536787e1d35a2eee2e34.tar.gz dexon-sol-tools-2f639b77bbcad9884b25536787e1d35a2eee2e34.tar.bz2 dexon-sol-tools-2f639b77bbcad9884b25536787e1d35a2eee2e34.tar.lz dexon-sol-tools-2f639b77bbcad9884b25536787e1d35a2eee2e34.tar.xz dexon-sol-tools-2f639b77bbcad9884b25536787e1d35a2eee2e34.tar.zst dexon-sol-tools-2f639b77bbcad9884b25536787e1d35a2eee2e34.zip |
Update Solidity syntax and comments
Diffstat (limited to 'packages/contracts/test/exchange')
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 28 | ||||
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 7 |
2 files changed, 15 insertions, 20 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index b9ad309fc..406a96fa0 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -9,10 +9,10 @@ import * as Web3 from 'web3'; import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token'; import { + CancelContractEventArgs, ExchangeContract, - LogCancelContractEventArgs, - LogErrorContractEventArgs, - LogFillContractEventArgs, + ExchangeErrorContractEventArgs, + FillContractEventArgs, } from '../../src/contract_wrappers/generated/exchange'; import { TokenTransferProxyContract } from '../../src/contract_wrappers/generated/token_transfer_proxy'; import { Balances } from '../../src/utils/balances'; @@ -394,8 +394,8 @@ describe('Exchange', () => { const res = await exWrapper.fillOrderAsync(signedOrder, takerAddress, { takerSellAmount: signedOrder.makerBuyAmount, }); - const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>; - expect(log.args.makerAmountBought).to.be.bignumber.equal(signedOrder.makerBuyAmount.minus(takerSellAmount)); + const log = res.logs[0] as LogWithDecodedArgs<FillContractEventArgs>; + expect(log.args.takerAmountSold).to.be.bignumber.equal(signedOrder.makerBuyAmount.minus(takerSellAmount)); const newBalances = await dmyBalances.getAsync(); expect(newBalances[makerAddress][signedOrder.makerTokenAddress]).to.be.bignumber.equal( @@ -428,7 +428,7 @@ describe('Exchange', () => { }); expect(res.logs).to.have.length(1); - const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>; + const log = res.logs[0] as LogWithDecodedArgs<FillContractEventArgs>; const logArgs = log.args; const expectedFilledMakerTokenAmount = signedOrder.makerSellAmount.div(divisor); const expectedFilledTakerTokenAmount = signedOrder.makerBuyAmount.div(divisor); @@ -441,7 +441,7 @@ describe('Exchange', () => { expect(signedOrder.makerTokenAddress).to.be.equal(logArgs.makerTokenAddress); expect(signedOrder.takerTokenAddress).to.be.equal(logArgs.takerTokenAddress); expect(expectedFilledMakerTokenAmount).to.be.bignumber.equal(logArgs.makerAmountSold); - expect(expectedFilledTakerTokenAmount).to.be.bignumber.equal(logArgs.makerAmountBought); + expect(expectedFilledTakerTokenAmount).to.be.bignumber.equal(logArgs.takerAmountSold); expect(expectedFeeMPaid).to.be.bignumber.equal(logArgs.makerFeePaid); expect(expectedFeeTPaid).to.be.bignumber.equal(logArgs.takerFeePaid); expect(orderUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash); @@ -457,7 +457,7 @@ describe('Exchange', () => { }); expect(res.logs).to.have.length(1); - const log = res.logs[0] as LogWithDecodedArgs<LogFillContractEventArgs>; + const log = res.logs[0] as LogWithDecodedArgs<FillContractEventArgs>; const logArgs = log.args; const expectedFilledMakerTokenAmount = signedOrder.makerSellAmount.div(divisor); const expectedFilledTakerTokenAmount = signedOrder.makerBuyAmount.div(divisor); @@ -470,7 +470,7 @@ describe('Exchange', () => { expect(signedOrder.makerTokenAddress).to.be.equal(logArgs.makerTokenAddress); expect(signedOrder.takerTokenAddress).to.be.equal(logArgs.takerTokenAddress); expect(expectedFilledMakerTokenAmount).to.be.bignumber.equal(logArgs.makerAmountSold); - expect(expectedFilledTakerTokenAmount).to.be.bignumber.equal(logArgs.makerAmountBought); + expect(expectedFilledTakerTokenAmount).to.be.bignumber.equal(logArgs.takerAmountSold); expect(expectedFeeMPaid).to.be.bignumber.equal(logArgs.makerFeePaid); expect(expectedFeeTPaid).to.be.bignumber.equal(logArgs.takerFeePaid); expect(orderUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash); @@ -552,7 +552,7 @@ describe('Exchange', () => { const res = await exWrapper.fillOrderAsync(signedOrder, takerAddress); expect(res.logs).to.have.length(1); - const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>; + const log = res.logs[0] as LogWithDecodedArgs<ExchangeErrorContractEventArgs>; const errCode = log.args.errorId; expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_EXPIRED); }); @@ -563,7 +563,7 @@ describe('Exchange', () => { const res = await exWrapper.fillOrderAsync(signedOrder, takerAddress); expect(res.logs).to.have.length(1); - const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>; + const log = res.logs[0] as LogWithDecodedArgs<ExchangeErrorContractEventArgs>; const errCode = log.args.errorId; expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED); }); @@ -594,7 +594,7 @@ describe('Exchange', () => { const res = await exWrapper.cancelOrderAsync(signedOrder, makerAddress); expect(res.logs).to.have.length(1); - const log = res.logs[0] as LogWithDecodedArgs<LogCancelContractEventArgs>; + const log = res.logs[0] as LogWithDecodedArgs<CancelContractEventArgs>; const logArgs = log.args; expect(signedOrder.makerAddress).to.be.equal(logArgs.makerAddress); @@ -609,7 +609,7 @@ describe('Exchange', () => { const res = await exWrapper.cancelOrderAsync(signedOrder, makerAddress); expect(res.logs).to.have.length(1); - const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>; + const log = res.logs[0] as LogWithDecodedArgs<ExchangeErrorContractEventArgs>; const errCode = log.args.errorId; expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_CANCELLED); }); @@ -621,7 +621,7 @@ describe('Exchange', () => { const res = await exWrapper.cancelOrderAsync(signedOrder, makerAddress); expect(res.logs).to.have.length(1); - const log = res.logs[0] as LogWithDecodedArgs<LogErrorContractEventArgs>; + const log = res.logs[0] as LogWithDecodedArgs<ExchangeErrorContractEventArgs>; const errCode = log.args.errorId; expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_EXPIRED); }); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 295d5b204..145d9ad55 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -7,12 +7,7 @@ import * as _ from 'lodash'; import * as Web3 from 'web3'; import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token'; -import { - ExchangeContract, - LogCancelContractEventArgs, - LogErrorContractEventArgs, - LogFillContractEventArgs, -} from '../../src/contract_wrappers/generated/exchange'; +import { ExchangeContract } from '../../src/contract_wrappers/generated/exchange'; import { TokenRegistryContract } from '../../src/contract_wrappers/generated/token_registry'; import { TokenTransferProxyContract } from '../../src/contract_wrappers/generated/token_transfer_proxy'; import { Balances } from '../../src/utils/balances'; |