aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-06-10 10:01:28 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-06-13 02:45:02 +0800
commitee8c9b764d0ee153efa91075b35f3192b72be119 (patch)
tree0d74a5df1e25f58fe16e998c34404fbbdeb21c98 /packages/contracts/src/utils
parent787015f5370718e31c7990446fb1da298ed13e6b (diff)
downloaddexon-sol-tools-ee8c9b764d0ee153efa91075b35f3192b72be119.tar
dexon-sol-tools-ee8c9b764d0ee153efa91075b35f3192b72be119.tar.gz
dexon-sol-tools-ee8c9b764d0ee153efa91075b35f3192b72be119.tar.bz2
dexon-sol-tools-ee8c9b764d0ee153efa91075b35f3192b72be119.tar.lz
dexon-sol-tools-ee8c9b764d0ee153efa91075b35f3192b72be119.tar.xz
dexon-sol-tools-ee8c9b764d0ee153efa91075b35f3192b72be119.tar.zst
dexon-sol-tools-ee8c9b764d0ee153efa91075b35f3192b72be119.zip
Pop id from assetData before dispatching to AssetProxies
Diffstat (limited to 'packages/contracts/src/utils')
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts2
-rw-r--r--packages/contracts/src/utils/formatters.ts16
-rw-r--r--packages/contracts/src/utils/order_utils.ts3
3 files changed, 18 insertions, 3 deletions
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index a8ca5183e..6603538b9 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -165,7 +165,7 @@ export class ExchangeWrapper {
public async marketBuyOrdersNoThrowAsync(
orders: SignedOrder[],
from: string,
- opts: { makerAssetFillAmount: BigNumber },
+ opts: { makerAssetFillAmount: BigNumber; gas?: number },
): Promise<TransactionReceiptWithDecodedLogs> {
const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
const txHash = await this._exchange.marketBuyOrdersNoThrow.sendTransactionAsync(
diff --git a/packages/contracts/src/utils/formatters.ts b/packages/contracts/src/utils/formatters.ts
index 1035f2d7c..b25dec27c 100644
--- a/packages/contracts/src/utils/formatters.ts
+++ b/packages/contracts/src/utils/formatters.ts
@@ -28,8 +28,14 @@ export const formatters = {
signatures: [],
takerAssetFillAmount,
};
- _.forEach(signedOrders, signedOrder => {
+ _.forEach(signedOrders, (signedOrder, i) => {
const orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
+ if (i !== 0) {
+ orderWithoutExchangeAddress.takerAssetData = `0x${_.repeat(
+ '0',
+ signedOrders[0].takerAssetData.length - 2,
+ )}`;
+ }
marketSellOrders.orders.push(orderWithoutExchangeAddress);
marketSellOrders.signatures.push(signedOrder.signature);
});
@@ -41,8 +47,14 @@ export const formatters = {
signatures: [],
makerAssetFillAmount,
};
- _.forEach(signedOrders, signedOrder => {
+ _.forEach(signedOrders, (signedOrder, i) => {
const orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
+ if (i !== 0) {
+ orderWithoutExchangeAddress.makerAssetData = `0x${_.repeat(
+ '0',
+ signedOrders[0].makerAssetData.length - 2,
+ )}`;
+ }
marketBuyOrders.orders.push(orderWithoutExchangeAddress);
marketBuyOrders.signatures.push(signedOrder.signature);
});
diff --git a/packages/contracts/src/utils/order_utils.ts b/packages/contracts/src/utils/order_utils.ts
index 2a8791e4c..a9f994d80 100644
--- a/packages/contracts/src/utils/order_utils.ts
+++ b/packages/contracts/src/utils/order_utils.ts
@@ -1,6 +1,7 @@
import { OrderWithoutExchangeAddress, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
+import { constants } from './constants';
import { CancelOrder, MatchOrder } from './types';
export const orderUtils = {
@@ -43,6 +44,8 @@ export const orderUtils = {
leftSignature: signedOrderLeft.signature,
rightSignature: signedOrderRight.signature,
};
+ fill.right.makerAssetData = constants.NULL_BYTES;
+ fill.right.takerAssetData = constants.NULL_BYTES;
return fill;
},
};