diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-07-08 06:18:19 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-07-08 08:45:39 +0800 |
commit | f3e66110beebc40d667f37a25b12393d64d03294 (patch) | |
tree | f6e25d386119db6988956b6978943b9a85e7893c | |
parent | bc300a37972eff08217dfcbf86b9e4a65f943402 (diff) | |
download | dexon-sol-tools-f3e66110beebc40d667f37a25b12393d64d03294.tar dexon-sol-tools-f3e66110beebc40d667f37a25b12393d64d03294.tar.gz dexon-sol-tools-f3e66110beebc40d667f37a25b12393d64d03294.tar.bz2 dexon-sol-tools-f3e66110beebc40d667f37a25b12393d64d03294.tar.lz dexon-sol-tools-f3e66110beebc40d667f37a25b12393d64d03294.tar.xz dexon-sol-tools-f3e66110beebc40d667f37a25b12393d64d03294.tar.zst dexon-sol-tools-f3e66110beebc40d667f37a25b12393d64d03294.zip |
Migrate cencelOrder
-rw-r--r-- | src/artifacts/exchange/Exchange_v1.json | 6 | ||||
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 18 | ||||
-rw-r--r-- | src/types.ts | 7 |
3 files changed, 16 insertions, 15 deletions
diff --git a/src/artifacts/exchange/Exchange_v1.json b/src/artifacts/exchange/Exchange_v1.json index df7c3c6d6..46c4cbd2b 100644 --- a/src/artifacts/exchange/Exchange_v1.json +++ b/src/artifacts/exchange/Exchange_v1.json @@ -13,14 +13,14 @@ "type": "uint256[6]" }, { - "name": "cancelValueT", + "name": "canceltakerTokenAmount", "type": "uint256" } ], - "name": "cancel", + "name": "cancelOrder", "outputs": [ { - "name": "cancelledValueT", + "name": "cancelledTakerTokenAmount", "type": "uint256" } ], diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index fa4b5904b..2000ebc16 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -482,27 +482,27 @@ export class ExchangeWrapper extends ContractWrapper { */ @decorators.contractCallErrorHandler public async cancelOrderAsync( - order: Order|SignedOrder, takerTokenCancelAmount: BigNumber.BigNumber): Promise<BigNumber.BigNumber> { + order: Order|SignedOrder, canceltakerTokenAmount: BigNumber.BigNumber): Promise<BigNumber.BigNumber> { assert.doesConformToSchema('order', order, orderSchema); - assert.isBigNumber('takerTokenCancelAmount', takerTokenCancelAmount); + assert.isBigNumber('takerTokenCancelAmount', canceltakerTokenAmount); await assert.isSenderAddressAsync('order.maker', order.maker, this._web3Wrapper); const exchangeInstance = await this._getExchangeContractAsync(order.exchangeContractAddress); - await this._validateCancelOrderAndThrowIfInvalidAsync(order, takerTokenCancelAmount); + await this._validateCancelOrderAndThrowIfInvalidAsync(order, canceltakerTokenAmount); const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order); - const gas = await exchangeInstance.cancel.estimateGas( + const gas = await exchangeInstance.cancelOrder.estimateGas( orderAddresses, orderValues, - takerTokenCancelAmount, + canceltakerTokenAmount, { from: order.maker, }, ); - const response: ContractResponse = await exchangeInstance.cancel( + const response: ContractResponse = await exchangeInstance.cancelOrder( orderAddresses, orderValues, - takerTokenCancelAmount, + canceltakerTokenAmount, { from: order.maker, gas, @@ -510,8 +510,8 @@ export class ExchangeWrapper extends ContractWrapper { ); this._throwErrorLogsAsErrors(response.logs); const logFillArgs = response.logs[0].args as LogCancelContractEventArgs; - const cancelledAmount = new BigNumber(logFillArgs.cancelledValueT); - return cancelledAmount; + const cancelledTakerTokenAmount = new BigNumber(logFillArgs.cancelledValueT); + return cancelledTakerTokenAmount; } /** * Batch version of cancelOrderAsync. Atomically cancels multiple orders in a single transaction. diff --git a/src/types.ts b/src/types.ts index 66881e170..fce42352f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -89,10 +89,11 @@ export interface ExchangeContract extends ContractInstance { estimateGas: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], fillAmount: BigNumber.BigNumber, shouldCheckTransfer: boolean, v: number[], r: string[], s: string[], txOpts?: TxOpts) => number; }; - cancel: { - (orderAddresses: OrderAddresses, orderValues: OrderValues, cancelAmount: BigNumber.BigNumber, + cancelOrder: { + (orderAddresses: OrderAddresses, orderValues: OrderValues, canceltakerTokenAmount: BigNumber.BigNumber, txOpts?: TxOpts): ContractResponse; - estimateGas: (orderAddresses: OrderAddresses, orderValues: OrderValues, cancelAmount: BigNumber.BigNumber, + estimateGas: (orderAddresses: OrderAddresses, orderValues: OrderValues, + canceltakerTokenAmount: BigNumber.BigNumber, txOpts?: TxOpts) => number; }; batchCancel: { |