aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-06-09 21:58:14 +0800
committerGitHub <noreply@github.com>2017-06-09 21:58:14 +0800
commit1572f2828ac8be9cd70d8d3cf52f879fc68d5523 (patch)
tree603e038c4b0261228145adc6c156c97b73260304 /src/contract_wrappers
parent77174341d2498f772b60554fdc29100e001415c6 (diff)
parent389894088d2372e1eb9bf4d39bde2efe8ab38713 (diff)
downloaddexon-sol-tools-1572f2828ac8be9cd70d8d3cf52f879fc68d5523.tar
dexon-sol-tools-1572f2828ac8be9cd70d8d3cf52f879fc68d5523.tar.gz
dexon-sol-tools-1572f2828ac8be9cd70d8d3cf52f879fc68d5523.tar.bz2
dexon-sol-tools-1572f2828ac8be9cd70d8d3cf52f879fc68d5523.tar.lz
dexon-sol-tools-1572f2828ac8be9cd70d8d3cf52f879fc68d5523.tar.xz
dexon-sol-tools-1572f2828ac8be9cd70d8d3cf52f879fc68d5523.tar.zst
dexon-sol-tools-1572f2828ac8be9cd70d8d3cf52f879fc68d5523.zip
Merge branch 'master' into json-schema
Diffstat (limited to 'src/contract_wrappers')
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index be6234ff9..522be4588 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -28,6 +28,8 @@ import {utils} from '../utils/utils';
import {ContractWrapper} from './contract_wrapper';
import * as ExchangeArtifacts from '../artifacts/Exchange.json';
import {ecSignatureSchema} from '../schemas/ec_signature_schema';
+import {orderFillRequestsSchema} from '../schemas/order_fill_requests_schema';
+import {orderCancellationRequestsSchema} from '../schemas/order_cancel_schema';
import {orderFillOrKillRequestsSchema} from '../schemas/order_fill_or_kill_requests_schema';
import {signedOrderSchema, orderSchema} from '../schemas/order_schemas';
import {constants} from '../utils/constants';
@@ -167,14 +169,11 @@ export class ExchangeWrapper extends ContractWrapper {
shouldCheckTransfer: boolean, takerAddress: string): Promise<void> {
assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this.web3Wrapper);
- _.forEach(orderFillRequests,
- async (orderFillRequest: OrderFillRequest, i: number) => {
- assert.doesConformToSchema(`orderFillRequests[${i}].signedOrder`, orderFillRequest.signedOrder,
- signedOrderSchema);
- assert.isBigNumber(`orderFillRequests[${i}].takerTokenFillAmount`, orderFillRequest.takerTokenFillAmount);
+ assert.doesConformToSchema('orderFillRequests', orderFillRequests, orderFillRequestsSchema);
+ for (const orderFillrequest of orderFillRequests) {
await this.validateFillOrderAndThrowIfInvalidAsync(
orderFillRequest.signedOrder, orderFillRequest.takerTokenFillAmount, takerAddress);
- });
+ }
if (_.isEmpty(orderFillRequests)) {
return; // no-op
}
@@ -362,12 +361,8 @@ export class ExchangeWrapper extends ContractWrapper {
assert.assert(_.uniq(makers).length === 1, ExchangeContractErrs.MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH);
const maker = makers[0];
await assert.isSenderAddressAsync('maker', maker, this.web3Wrapper);
- _.forEach(orderCancellationRequests,
- async (cancellationRequest: OrderCancellationRequest, i: number) => {
- assert.doesConformToSchema(`orderCancellationRequests[${i}].order`, cancellationRequest.order, orderSchema);
- assert.isBigNumber(`orderCancellationRequests[${i}].takerTokenCancelAmount`,
- cancellationRequest.takerTokenCancelAmount,
- );
+ assert.doesConformToSchema('orderCancellationRequests', orderCancellationRequests, orderCancellationRequestsSchema);
+ for (const cancellationRequest of orderCancellationRequests) {
await this.validateCancelOrderAndThrowIfInvalidAsync(
cancellationRequest.order, cancellationRequest.takerTokenCancelAmount,
);