aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contract-wrappers')
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts10
-rw-r--r--packages/contract-wrappers/src/utils/calldata_optimization_utils.ts (renamed from packages/contract-wrappers/src/utils/market_orders_optimization_utils.ts)6
-rw-r--r--packages/contract-wrappers/test/calldata_optimization_utils_test.ts (renamed from packages/contract-wrappers/test/market_orders_optimization_utils_test.ts)16
3 files changed, 16 insertions, 16 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts
index 7d51889cf..13ef0fe01 100644
--- a/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts
@@ -10,8 +10,8 @@ import { orderTxOptsSchema } from '../schemas/order_tx_opts_schema';
import { txOptsSchema } from '../schemas/tx_opts_schema';
import { TransactionOpts } from '../types';
import { assert } from '../utils/assert';
+import { calldataOptimizationUtils } from '../utils/calldata_optimization_utils';
import { constants } from '../utils/constants';
-import { marketOrdersOptimizationUtils } from '../utils/market_orders_optimization_utils';
import { ContractWrapper } from './contract_wrapper';
import { ForwarderContract } from './generated/forwarder';
@@ -80,8 +80,8 @@ export class ForwarderWrapper extends ContractWrapper {
const normalizedTakerAddress = takerAddress.toLowerCase();
const normalizedFeeRecipientAddress = feeRecipientAddress.toLowerCase();
// optimize orders
- const optimizedMarketOrders = marketOrdersOptimizationUtils.optimizeMarketOrders(signedOrders);
- const optimizedFeeOrders = marketOrdersOptimizationUtils.optimizeFeeOrders(signedFeeOrders);
+ const optimizedMarketOrders = calldataOptimizationUtils.optimizeForwarderOrders(signedOrders);
+ const optimizedFeeOrders = calldataOptimizationUtils.optimizeForwarderFeeOrders(signedFeeOrders);
// send transaction
const forwarderContractInstance = await this._getForwarderContractAsync();
const txHash = await forwarderContractInstance.marketSellOrdersWithEth.sendTransactionAsync(
@@ -148,8 +148,8 @@ export class ForwarderWrapper extends ContractWrapper {
const normalizedTakerAddress = takerAddress.toLowerCase();
const normalizedFeeRecipientAddress = feeRecipientAddress.toLowerCase();
// optimize orders
- const optimizedMarketOrders = marketOrdersOptimizationUtils.optimizeMarketOrders(signedOrders);
- const optimizedFeeOrders = marketOrdersOptimizationUtils.optimizeFeeOrders(signedFeeOrders);
+ const optimizedMarketOrders = calldataOptimizationUtils.optimizeForwarderOrders(signedOrders);
+ const optimizedFeeOrders = calldataOptimizationUtils.optimizeForwarderFeeOrders(signedFeeOrders);
// send transaction
const forwarderContractInstance = await this._getForwarderContractAsync();
const txHash = await forwarderContractInstance.marketBuyOrdersWithEth.sendTransactionAsync(
diff --git a/packages/contract-wrappers/src/utils/market_orders_optimization_utils.ts b/packages/contract-wrappers/src/utils/calldata_optimization_utils.ts
index e35b2eadc..3172cf531 100644
--- a/packages/contract-wrappers/src/utils/market_orders_optimization_utils.ts
+++ b/packages/contract-wrappers/src/utils/calldata_optimization_utils.ts
@@ -3,14 +3,14 @@ import * as _ from 'lodash';
import { constants } from './constants';
-export const marketOrdersOptimizationUtils = {
+export const calldataOptimizationUtils = {
/**
* Takes an array of orders and outputs an array of equivalent orders where all takerAssetData are '0x' and
* all makerAssetData are '0x' except for that of the first order, which retains its original value
* @param orders An array of SignedOrder objects
* @returns optimized orders
*/
- optimizeMarketOrders(orders: SignedOrder[]): SignedOrder[] {
+ optimizeForwarderOrders(orders: SignedOrder[]): SignedOrder[] {
const optimizedOrders = _.map(orders, (order, index) =>
transformOrder(order, {
makerAssetData: index === 0 ? order.makerAssetData : constants.NULL_BYTES,
@@ -25,7 +25,7 @@ export const marketOrdersOptimizationUtils = {
* @param orders An array of SignedOrder objects
* @returns optimized orders
*/
- optimizeFeeOrders(orders: SignedOrder[]): SignedOrder[] {
+ optimizeForwarderFeeOrders(orders: SignedOrder[]): SignedOrder[] {
const optimizedOrders = _.map(orders, (order, index) =>
transformOrder(order, {
makerAssetData: constants.NULL_BYTES,
diff --git a/packages/contract-wrappers/test/market_orders_optimization_utils_test.ts b/packages/contract-wrappers/test/calldata_optimization_utils_test.ts
index 742294df2..107d913ba 100644
--- a/packages/contract-wrappers/test/market_orders_optimization_utils_test.ts
+++ b/packages/contract-wrappers/test/calldata_optimization_utils_test.ts
@@ -4,7 +4,7 @@ import * as _ from 'lodash';
import 'mocha';
import { constants } from '../src/utils/constants';
-import { marketOrdersOptimizationUtils } from '../src/utils/market_orders_optimization_utils';
+import { calldataOptimizationUtils } from '../src/utils/calldata_optimization_utils';
import { chaiSetup } from './utils/chai_setup';
import { assert } from '../src/utils/assert';
@@ -37,29 +37,29 @@ const generateFakeOrders = (makerAssetData: string, takerAssetData: string) =>
};
});
-describe('marketOrdersOptimizationUtils', () => {
+describe('calldataOptimizationUtils', () => {
const fakeMakerAssetData = 'fakeMakerAssetData';
const fakeTakerAssetData = 'fakeTakerAssetData';
const orders = generateFakeOrders(fakeMakerAssetData, fakeTakerAssetData);
- describe('#optimizeMarketOrders', () => {
+ describe('#optimizeForwarderOrders', () => {
it('should make makerAssetData `0x` unless first order', () => {
- const optimizedOrders = marketOrdersOptimizationUtils.optimizeMarketOrders(orders);
+ const optimizedOrders = calldataOptimizationUtils.optimizeForwarderOrders(orders);
expect(optimizedOrders[0].makerAssetData).to.equal(fakeMakerAssetData);
const ordersWithoutHead = _.slice(optimizedOrders, 1);
_.forEach(ordersWithoutHead, order => expect(order.makerAssetData).to.equal(constants.NULL_BYTES));
});
it('should make all takerAssetData `0x`', () => {
- const optimizedOrders = marketOrdersOptimizationUtils.optimizeMarketOrders(orders);
+ const optimizedOrders = calldataOptimizationUtils.optimizeForwarderOrders(orders);
_.forEach(optimizedOrders, order => expect(order.takerAssetData).to.equal(constants.NULL_BYTES));
});
});
- describe('#optimizeFeeOrders', () => {
+ describe('#optimizeForwarderFeeOrders', () => {
it('should make all makerAssetData `0x`', () => {
- const optimizedOrders = marketOrdersOptimizationUtils.optimizeFeeOrders(orders);
+ const optimizedOrders = calldataOptimizationUtils.optimizeForwarderFeeOrders(orders);
_.forEach(optimizedOrders, order => expect(order.makerAssetData).to.equal(constants.NULL_BYTES));
});
it('should make all takerAssetData `0x`', () => {
- const optimizedOrders = marketOrdersOptimizationUtils.optimizeFeeOrders(orders);
+ const optimizedOrders = calldataOptimizationUtils.optimizeForwarderFeeOrders(orders);
_.forEach(optimizedOrders, order => expect(order.takerAssetData).to.equal(constants.NULL_BYTES));
});
});