diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-07-04 03:04:07 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-07-04 03:04:07 +0800 |
commit | 4bcad260244f5399c07530db7ac18a8335246e34 (patch) | |
tree | 31ee128f35ed162847bd6892e2fb175487c033dd /src | |
parent | 15bd31e629b0a5d2bf8e611b356123dd68a4f6e7 (diff) | |
download | dexon-0x-contracts-4bcad260244f5399c07530db7ac18a8335246e34.tar dexon-0x-contracts-4bcad260244f5399c07530db7ac18a8335246e34.tar.gz dexon-0x-contracts-4bcad260244f5399c07530db7ac18a8335246e34.tar.bz2 dexon-0x-contracts-4bcad260244f5399c07530db7ac18a8335246e34.tar.lz dexon-0x-contracts-4bcad260244f5399c07530db7ac18a8335246e34.tar.xz dexon-0x-contracts-4bcad260244f5399c07530db7ac18a8335246e34.tar.zst dexon-0x-contracts-4bcad260244f5399c07530db7ac18a8335246e34.zip |
Stop passing exchangeContractAddress to utils.getOrderHashHex
Diffstat (limited to 'src')
-rw-r--r-- | src/0x.ts | 2 | ||||
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 9 | ||||
-rw-r--r-- | src/utils/utils.ts | 4 |
3 files changed, 5 insertions, 10 deletions
@@ -182,7 +182,7 @@ export class ZeroEx { */ public getOrderHashHex(order: Order|SignedOrder): string { assert.doesConformToSchema('order', order, orderSchema); - const orderHashHex = utils.getOrderHashHex(order, order.exchangeContractAddress); + const orderHashHex = utils.getOrderHashHex(order); return orderHashHex; } /** diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index fa946d6ad..f596cb429 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -679,11 +679,6 @@ export class ExchangeWrapper extends ContractWrapper { ); return isValidSignature; } - private async _getOrderHashHexAsync(order: Order|SignedOrder): Promise<string> { - const exchangeInstance = await this._getExchangeContractAsync(order.exchangeContractAddress); - const orderHashHex = utils.getOrderHashHex(order, exchangeInstance.address); - return orderHashHex; - } private async _getOrderHashHexUsingContractCallAsync(order: Order|SignedOrder): Promise<string> { const exchangeInstance = await this._getExchangeContractAsync(order.exchangeContractAddress); const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order); @@ -720,7 +715,7 @@ export class ExchangeWrapper extends ContractWrapper { if (takerTokenCancelAmount.eq(0)) { throw new Error(ExchangeContractErrs.ORDER_CANCEL_AMOUNT_ZERO); } - const orderHash = await this._getOrderHashHexAsync(order); + const orderHash = utils.getOrderHashHex(order); const unavailableAmount = await this.getUnavailableTakerAmountAsync(orderHash, order.exchangeContractAddress); if (order.takerTokenAmount.minus(unavailableAmount).eq(0)) { throw new Error(ExchangeContractErrs.ORDER_ALREADY_CANCELLED_OR_FILLED); @@ -734,7 +729,7 @@ export class ExchangeWrapper extends ContractWrapper { exchangeContractAddress: string, fillTakerAmount: BigNumber.BigNumber) { // Check that fillValue available >= fillTakerAmount - const orderHashHex = utils.getOrderHashHex(signedOrder, exchangeContractAddress); + const orderHashHex = utils.getOrderHashHex(signedOrder); const unavailableTakerAmount = await this.getUnavailableTakerAmountAsync(orderHashHex, exchangeContractAddress); const remainingTakerAmount = signedOrder.takerTokenAmount.minus(unavailableTakerAmount); if (remainingTakerAmount < fillTakerAmount) { diff --git a/src/utils/utils.ts b/src/utils/utils.ts index bad5b6498..a20fa2243 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -29,9 +29,9 @@ export const utils = { spawnSwitchErr(name: string, value: any): Error { return new Error(`Unexpected switch value: ${value} encountered for ${name}`); }, - getOrderHashHex(order: Order|SignedOrder, exchangeContractAddr: string): string { + getOrderHashHex(order: Order|SignedOrder): string { const orderParts = [ - {value: exchangeContractAddr, type: SolidityTypes.address}, + {value: order.exchangeContractAddress, type: SolidityTypes.address}, {value: order.maker, type: SolidityTypes.address}, {value: order.taker, type: SolidityTypes.address}, {value: order.makerTokenAddress, type: SolidityTypes.address}, |