aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/contract-wrappers/test/calldata_optimization_utils_test.ts10
-rw-r--r--packages/fill-scenarios/src/fill_scenarios.ts8
-rw-r--r--packages/order-utils/src/constants.ts1
-rw-r--r--packages/order-utils/src/order_factory.ts42
4 files changed, 28 insertions, 33 deletions
diff --git a/packages/contract-wrappers/test/calldata_optimization_utils_test.ts b/packages/contract-wrappers/test/calldata_optimization_utils_test.ts
index 107d913ba..a4cea772f 100644
--- a/packages/contract-wrappers/test/calldata_optimization_utils_test.ts
+++ b/packages/contract-wrappers/test/calldata_optimization_utils_test.ts
@@ -3,12 +3,11 @@ import * as chai from 'chai';
import * as _ from 'lodash';
import 'mocha';
-import { constants } from '../src/utils/constants';
+import { assert } from '../src/utils/assert';
import { calldataOptimizationUtils } from '../src/utils/calldata_optimization_utils';
+import { constants } from '../src/utils/constants';
import { chaiSetup } from './utils/chai_setup';
-import { assert } from '../src/utils/assert';
-import { NULL_BYTES } from '@0xproject/utils';
chaiSetup.configure();
const expect = chai.expect;
@@ -20,16 +19,11 @@ const generateFakeOrders = (makerAssetData: string, takerAssetData: string) =>
_.map(_.range(FAKE_ORDERS_COUNT), index => {
const order = orderFactory.createOrder(
constants.NULL_ADDRESS,
- constants.NULL_ADDRESS,
- constants.NULL_ADDRESS,
- constants.ZERO_AMOUNT,
- constants.ZERO_AMOUNT,
constants.ZERO_AMOUNT,
makerAssetData,
constants.ZERO_AMOUNT,
takerAssetData,
constants.NULL_ADDRESS,
- constants.NULL_ADDRESS,
);
return {
...order,
diff --git a/packages/fill-scenarios/src/fill_scenarios.ts b/packages/fill-scenarios/src/fill_scenarios.ts
index 8f2766e24..f35094560 100644
--- a/packages/fill-scenarios/src/fill_scenarios.ts
+++ b/packages/fill-scenarios/src/fill_scenarios.ts
@@ -194,15 +194,15 @@ export class FillScenarios {
const signedOrder = await orderFactory.createSignedOrderAsync(
this._web3Wrapper.getProvider(),
makerAddress,
- takerAddress,
- senderAddress,
- makerFee,
- takerFee,
makerFillableAmount,
makerAssetData,
takerFillableAmount,
takerAssetData,
this._exchangeAddress,
+ takerAddress,
+ senderAddress,
+ makerFee,
+ takerFee,
feeRecepientAddress,
expirationTimeSeconds,
);
diff --git a/packages/order-utils/src/constants.ts b/packages/order-utils/src/constants.ts
index 92eb89d70..ea3f8b932 100644
--- a/packages/order-utils/src/constants.ts
+++ b/packages/order-utils/src/constants.ts
@@ -11,4 +11,5 @@ export const constants = {
SELECTOR_LENGTH: 4,
BASE_16: 16,
INFINITE_TIMESTAMP_SEC: new BigNumber(2524604400), // Close to infinite
+ ZERO_AMOUNT: new BigNumber(0),
};
diff --git a/packages/order-utils/src/order_factory.ts b/packages/order-utils/src/order_factory.ts
index 4be7a1913..444e5a0b2 100644
--- a/packages/order-utils/src/order_factory.ts
+++ b/packages/order-utils/src/order_factory.ts
@@ -13,21 +13,19 @@ import { MessagePrefixType } from './types';
export const orderFactory = {
createOrder(
makerAddress: string,
- takerAddress: string,
- senderAddress: string,
- makerFee: BigNumber,
- takerFee: BigNumber,
makerAssetAmount: BigNumber,
makerAssetData: string,
takerAssetAmount: BigNumber,
takerAssetData: string,
exchangeAddress: string,
- feeRecipientAddress: string,
- expirationTimeSecondsIfExists?: BigNumber,
+ takerAddress: string = constants.NULL_ADDRESS,
+ senderAddress: string = constants.NULL_ADDRESS,
+ makerFee: BigNumber = constants.ZERO_AMOUNT,
+ takerFee: BigNumber = constants.ZERO_AMOUNT,
+ feeRecipientAddress: string = constants.NULL_ADDRESS,
+ salt: BigNumber = generatePseudoRandomSalt(),
+ expirationTimeSeconds: BigNumber = constants.INFINITE_TIMESTAMP_SEC,
): Order {
- const expirationTimeSeconds = _.isUndefined(expirationTimeSecondsIfExists)
- ? constants.INFINITE_TIMESTAMP_SEC
- : expirationTimeSecondsIfExists;
const order = {
makerAddress,
takerAddress,
@@ -38,7 +36,7 @@ export const orderFactory = {
takerAssetAmount,
makerAssetData,
takerAssetData,
- salt: generatePseudoRandomSalt(),
+ salt,
exchangeAddress,
feeRecipientAddress,
expirationTimeSeconds,
@@ -48,31 +46,33 @@ export const orderFactory = {
async createSignedOrderAsync(
provider: Provider,
makerAddress: string,
- takerAddress: string,
- senderAddress: string,
- makerFee: BigNumber,
- takerFee: BigNumber,
makerAssetAmount: BigNumber,
makerAssetData: string,
takerAssetAmount: BigNumber,
takerAssetData: string,
exchangeAddress: string,
- feeRecipientAddress: string,
- expirationTimeSecondsIfExists?: BigNumber,
+ takerAddress?: string,
+ senderAddress?: string,
+ makerFee?: BigNumber,
+ takerFee?: BigNumber,
+ feeRecipientAddress?: string,
+ salt?: BigNumber,
+ expirationTimeSeconds?: BigNumber,
): Promise<SignedOrder> {
const order = orderFactory.createOrder(
makerAddress,
- takerAddress,
- senderAddress,
- makerFee,
- takerFee,
makerAssetAmount,
makerAssetData,
takerAssetAmount,
takerAssetData,
exchangeAddress,
+ takerAddress,
+ senderAddress,
+ makerFee,
+ takerFee,
feeRecipientAddress,
- expirationTimeSecondsIfExists,
+ salt,
+ expirationTimeSeconds,
);
const orderHash = orderHashUtils.getOrderHashHex(order);
const messagePrefixOpts = {