aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src/utils')
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts62
-rw-r--r--packages/contracts/src/utils/formatters.ts16
-rw-r--r--packages/contracts/src/utils/order_utils.ts18
-rw-r--r--packages/contracts/src/utils/types.ts14
4 files changed, 55 insertions, 55 deletions
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index 743a9c496..cda012aa9 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -22,12 +22,12 @@ export class ExchangeWrapper {
public async fillOrderAsync(
signedOrder: SignedOrder,
from: string,
- opts: { takerSellAmount?: BigNumber } = {},
+ opts: { takerTokenFillAmount?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createFill(signedOrder, opts.takerSellAmount);
+ const params = orderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
const txHash = await this._exchange.fillOrder.sendTransactionAsync(
params.order,
- params.takerSellAmount,
+ params.takerTokenFillAmount,
params.signature,
{ from },
);
@@ -43,12 +43,12 @@ export class ExchangeWrapper {
public async fillOrKillOrderAsync(
signedOrder: SignedOrder,
from: string,
- opts: { takerSellAmount?: BigNumber } = {},
+ opts: { takerTokenFillAmount?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createFill(signedOrder, opts.takerSellAmount);
+ const params = orderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
const txHash = await this._exchange.fillOrKillOrder.sendTransactionAsync(
params.order,
- params.takerSellAmount,
+ params.takerTokenFillAmount,
params.signature,
{ from },
);
@@ -58,12 +58,12 @@ export class ExchangeWrapper {
public async fillOrderNoThrowAsync(
signedOrder: SignedOrder,
from: string,
- opts: { takerSellAmount?: BigNumber } = {},
+ opts: { takerTokenFillAmount?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createFill(signedOrder, opts.takerSellAmount);
+ const params = orderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
const txHash = await this._exchange.fillOrderNoThrow.sendTransactionAsync(
params.order,
- params.takerSellAmount,
+ params.takerTokenFillAmount,
params.signature,
{ from },
);
@@ -73,12 +73,12 @@ export class ExchangeWrapper {
public async batchFillOrdersAsync(
orders: SignedOrder[],
from: string,
- opts: { takerSellAmounts?: BigNumber[] } = {},
+ opts: { takerTokenFillAmounts?: BigNumber[] } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchFill(orders, opts.takerSellAmounts);
+ const params = formatters.createBatchFill(orders, opts.takerTokenFillAmounts);
const txHash = await this._exchange.batchFillOrders.sendTransactionAsync(
params.orders,
- params.takerSellAmounts,
+ params.takerTokenFillAmounts,
params.signatures,
{ from },
);
@@ -88,12 +88,12 @@ export class ExchangeWrapper {
public async batchFillOrKillOrdersAsync(
orders: SignedOrder[],
from: string,
- opts: { takerSellAmounts?: BigNumber[] } = {},
+ opts: { takerTokenFillAmounts?: BigNumber[] } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchFill(orders, opts.takerSellAmounts);
+ const params = formatters.createBatchFill(orders, opts.takerTokenFillAmounts);
const txHash = await this._exchange.batchFillOrKillOrders.sendTransactionAsync(
params.orders,
- params.takerSellAmounts,
+ params.takerTokenFillAmounts,
params.signatures,
{ from },
);
@@ -103,12 +103,12 @@ export class ExchangeWrapper {
public async batchFillOrdersNoThrowAsync(
orders: SignedOrder[],
from: string,
- opts: { takerSellAmounts?: BigNumber[] } = {},
+ opts: { takerTokenFillAmounts?: BigNumber[] } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchFill(orders, opts.takerSellAmounts);
+ const params = formatters.createBatchFill(orders, opts.takerTokenFillAmounts);
const txHash = await this._exchange.batchFillOrdersNoThrow.sendTransactionAsync(
params.orders,
- params.takerSellAmounts,
+ params.takerTokenFillAmounts,
params.signatures,
{ from },
);
@@ -118,12 +118,12 @@ export class ExchangeWrapper {
public async marketSellOrdersAsync(
orders: SignedOrder[],
from: string,
- opts: { takerSellAmount: BigNumber },
+ opts: { takerTokenFillAmount: BigNumber },
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketSellOrders(orders, opts.takerSellAmount);
+ const params = formatters.createMarketSellOrders(orders, opts.takerTokenFillAmount);
const txHash = await this._exchange.marketSellOrders.sendTransactionAsync(
params.orders,
- params.takerSellAmount,
+ params.takerTokenFillAmount,
params.signatures,
{ from },
);
@@ -133,12 +133,12 @@ export class ExchangeWrapper {
public async marketSellOrdersNoThrowAsync(
orders: SignedOrder[],
from: string,
- opts: { takerSellAmount: BigNumber },
+ opts: { takerTokenFillAmount: BigNumber },
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketSellOrders(orders, opts.takerSellAmount);
+ const params = formatters.createMarketSellOrders(orders, opts.takerTokenFillAmount);
const txHash = await this._exchange.marketSellOrdersNoThrow.sendTransactionAsync(
params.orders,
- params.takerSellAmount,
+ params.takerTokenFillAmount,
params.signatures,
{ from },
);
@@ -148,12 +148,12 @@ export class ExchangeWrapper {
public async marketBuyOrdersAsync(
orders: SignedOrder[],
from: string,
- opts: { takerBuyAmount: BigNumber },
+ opts: { makerTokenFillAmount: BigNumber },
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketBuyOrders(orders, opts.takerBuyAmount);
+ const params = formatters.createMarketBuyOrders(orders, opts.makerTokenFillAmount);
const txHash = await this._exchange.marketBuyOrders.sendTransactionAsync(
params.orders,
- params.takerBuyAmount,
+ params.makerTokenFillAmount,
params.signatures,
{ from },
);
@@ -163,12 +163,12 @@ export class ExchangeWrapper {
public async marketBuyOrdersNoThrowAsync(
orders: SignedOrder[],
from: string,
- opts: { takerBuyAmount: BigNumber },
+ opts: { makerTokenFillAmount: BigNumber },
): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketBuyOrders(orders, opts.takerBuyAmount);
+ const params = formatters.createMarketBuyOrders(orders, opts.makerTokenFillAmount);
const txHash = await this._exchange.marketBuyOrdersNoThrow.sendTransactionAsync(
params.orders,
- params.takerBuyAmount,
+ params.makerTokenFillAmount,
params.signatures,
{ from },
);
@@ -221,7 +221,7 @@ export class ExchangeWrapper {
);
return partialAmount;
}
- public async getMakerAmountBoughtAsync(orderHashHex: string): Promise<BigNumber> {
+ public async getTakerTokenFilledAmount(orderHashHex: string): Promise<BigNumber> {
const filledAmount = new BigNumber(await this._exchange.filled.callAsync(orderHashHex));
return filledAmount;
}
diff --git a/packages/contracts/src/utils/formatters.ts b/packages/contracts/src/utils/formatters.ts
index d70c03cb8..fce10c448 100644
--- a/packages/contracts/src/utils/formatters.ts
+++ b/packages/contracts/src/utils/formatters.ts
@@ -5,27 +5,27 @@ import { orderUtils } from './order_utils';
import { BatchCancelOrders, BatchFillOrders, MarketBuyOrders, MarketSellOrders, SignedOrder } from './types';
export const formatters = {
- createBatchFill(signedOrders: SignedOrder[], takerSellAmounts: BigNumber[] = []) {
+ createBatchFill(signedOrders: SignedOrder[], takerTokenFillAmounts: BigNumber[] = []) {
const batchFill: BatchFillOrders = {
orders: [],
signatures: [],
- takerSellAmounts,
+ takerTokenFillAmounts,
};
_.forEach(signedOrders, signedOrder => {
const orderStruct = orderUtils.getOrderStruct(signedOrder);
batchFill.orders.push(orderStruct);
batchFill.signatures.push(signedOrder.signature);
- if (takerSellAmounts.length < signedOrders.length) {
- batchFill.takerSellAmounts.push(signedOrder.makerBuyAmount);
+ if (takerTokenFillAmounts.length < signedOrders.length) {
+ batchFill.takerTokenFillAmounts.push(signedOrder.takerTokenAmount);
}
});
return batchFill;
},
- createMarketSellOrders(signedOrders: SignedOrder[], takerSellAmount: BigNumber) {
+ createMarketSellOrders(signedOrders: SignedOrder[], takerTokenFillAmount: BigNumber) {
const marketSellOrders: MarketSellOrders = {
orders: [],
signatures: [],
- takerSellAmount,
+ takerTokenFillAmount,
};
_.forEach(signedOrders, signedOrder => {
const orderStruct = orderUtils.getOrderStruct(signedOrder);
@@ -34,11 +34,11 @@ export const formatters = {
});
return marketSellOrders;
},
- createMarketBuyOrders(signedOrders: SignedOrder[], takerBuyAmount: BigNumber) {
+ createMarketBuyOrders(signedOrders: SignedOrder[], makerTokenFillAmount: BigNumber) {
const marketBuyOrders: MarketBuyOrders = {
orders: [],
signatures: [],
- takerBuyAmount,
+ makerTokenFillAmount,
};
_.forEach(signedOrders, signedOrder => {
const orderStruct = orderUtils.getOrderStruct(signedOrder);
diff --git a/packages/contracts/src/utils/order_utils.ts b/packages/contracts/src/utils/order_utils.ts
index 1f808024a..26336c81d 100644
--- a/packages/contracts/src/utils/order_utils.ts
+++ b/packages/contracts/src/utils/order_utils.ts
@@ -7,10 +7,10 @@ import { crypto } from './crypto';
import { OrderStruct, SignatureType, SignedOrder, UnsignedOrder } from './types';
export const orderUtils = {
- createFill: (signedOrder: SignedOrder, takerSellAmount?: BigNumber) => {
+ createFill: (signedOrder: SignedOrder, takerTokenFillAmount?: BigNumber) => {
const fill = {
order: orderUtils.getOrderStruct(signedOrder),
- takerSellAmount: takerSellAmount || signedOrder.makerBuyAmount,
+ takerTokenFillAmount: takerTokenFillAmount || signedOrder.takerTokenAmount,
signature: signedOrder.signature,
};
return fill;
@@ -18,7 +18,7 @@ export const orderUtils = {
createCancel(signedOrder: SignedOrder, takerTokenCancelAmount?: BigNumber) {
const cancel = {
order: orderUtils.getOrderStruct(signedOrder),
- takerTokenCancelAmount: takerTokenCancelAmount || signedOrder.makerBuyAmount,
+ takerTokenCancelAmount: takerTokenCancelAmount || signedOrder.takerTokenAmount,
};
return cancel;
},
@@ -29,8 +29,8 @@ export const orderUtils = {
makerTokenAddress: signedOrder.makerTokenAddress,
takerTokenAddress: signedOrder.takerTokenAddress,
feeRecipientAddress: signedOrder.feeRecipientAddress,
- makerSellAmount: signedOrder.makerSellAmount,
- makerBuyAmount: signedOrder.makerBuyAmount,
+ makerTokenAmount: signedOrder.makerTokenAmount,
+ takerTokenAmount: signedOrder.takerTokenAmount,
makerFee: signedOrder.makerFee,
takerFee: signedOrder.takerFee,
expirationTimeSeconds: signedOrder.expirationTimeSeconds,
@@ -46,8 +46,8 @@ export const orderUtils = {
'address makerTokenAddress',
'address takerTokenAddress',
'address feeRecipientAddress',
- 'uint256 makerSellAmount',
- 'uint256 makerBuyAmount',
+ 'uint256 makerTokenAmount',
+ 'uint256 takerTokenAmount',
'uint256 makerFee',
'uint256 takerFee',
'uint256 expirationTimeSeconds',
@@ -60,8 +60,8 @@ export const orderUtils = {
order.makerTokenAddress,
order.takerTokenAddress,
order.feeRecipientAddress,
- order.makerSellAmount,
- order.makerBuyAmount,
+ order.makerTokenAmount,
+ order.takerTokenAmount,
order.makerFee,
order.takerFee,
order.expirationTimeSeconds,
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index 570f664e0..ed0ebeee9 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -14,19 +14,19 @@ export interface SubmissionContractEventArgs {
export interface BatchFillOrders {
orders: OrderStruct[];
signatures: string[];
- takerSellAmounts: BigNumber[];
+ takerTokenFillAmounts: BigNumber[];
}
export interface MarketSellOrders {
orders: OrderStruct[];
signatures: string[];
- takerSellAmount: BigNumber;
+ takerTokenFillAmount: BigNumber;
}
export interface MarketBuyOrders {
orders: OrderStruct[];
signatures: string[];
- takerBuyAmount: BigNumber;
+ makerTokenFillAmount: BigNumber;
}
export interface BatchCancelOrders {
@@ -43,8 +43,8 @@ export interface DefaultOrderParams {
feeRecipientAddress: string;
makerTokenAddress: string;
takerTokenAddress: string;
- makerSellAmount: BigNumber;
- makerBuyAmount: BigNumber;
+ makerTokenAmount: BigNumber;
+ takerTokenAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
}
@@ -128,8 +128,8 @@ export interface OrderStruct {
makerTokenAddress: string;
takerTokenAddress: string;
feeRecipientAddress: string;
- makerSellAmount: BigNumber;
- makerBuyAmount: BigNumber;
+ makerTokenAmount: BigNumber;
+ takerTokenAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;