aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/src/contract_wrappers
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2019-01-12 07:22:13 +0800
committerJacob Evans <jacob@dekz.net>2019-01-12 07:22:13 +0800
commit507c47c42cdc0cd2164b22bf84d14bfd2e59b1ea (patch)
tree4db01a14800a5f65b73b1d33d9cb9449b4054ade /packages/contract-wrappers/src/contract_wrappers
parent943c378309a84ed142852c6584b53958df7817c8 (diff)
downloaddexon-0x-contracts-507c47c42cdc0cd2164b22bf84d14bfd2e59b1ea.tar.gz
dexon-0x-contracts-507c47c42cdc0cd2164b22bf84d14bfd2e59b1ea.tar.zst
dexon-0x-contracts-507c47c42cdc0cd2164b22bf84d14bfd2e59b1ea.zip
bug(exchange-wrapper): matchOrdersAsync input param mutation
Diffstat (limited to 'packages/contract-wrappers/src/contract_wrappers')
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
index c9556971a..e61f5bbdc 100644
--- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
@@ -743,18 +743,20 @@ export class ExchangeWrapper extends ContractWrapper {
rightSignedOrder.takerAssetData !== leftSignedOrder.makerAssetData
) {
throw new Error(ExchangeWrapperError.AssetDataMismatch);
- } else {
- // Smart contracts assigns the asset data from the left order to the right one so we can save gas on reducing the size of call data
- rightSignedOrder.makerAssetData = '0x';
- rightSignedOrder.takerAssetData = '0x';
}
+ // Smart contracts assigns the asset data from the left order to the right one so we can save gas on reducing the size of call data
+ const optimizedRightSignedOrder = {
+ ...rightSignedOrder,
+ makerAssetData: '0x',
+ takerAssetData: '0x',
+ };
const exchangeInstance = await this._getExchangeContractAsync();
if (orderTransactionOpts.shouldValidate) {
await exchangeInstance.matchOrders.callAsync(
leftSignedOrder,
- rightSignedOrder,
+ optimizedRightSignedOrder,
leftSignedOrder.signature,
- rightSignedOrder.signature,
+ optimizedRightSignedOrder.signature,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
@@ -765,9 +767,9 @@ export class ExchangeWrapper extends ContractWrapper {
}
const txHash = await exchangeInstance.matchOrders.sendTransactionAsync(
leftSignedOrder,
- rightSignedOrder,
+ optimizedRightSignedOrder,
leftSignedOrder.signature,
- rightSignedOrder.signature,
+ optimizedRightSignedOrder.signature,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,