aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-09-06 16:39:43 +0800
committerGitHub <noreply@github.com>2017-09-06 16:39:43 +0800
commit07da617c050593a5cf9ce194eefd4f4e8fea7c61 (patch)
tree6156865472010078a9f27b905bcaec7782f6521c /src
parentf0a5ad2d2063fe8ba4682147ec2f73e2763b0275 (diff)
parent35c133caeda613121d7d90f3f1347ebdc8087d66 (diff)
downloaddexon-sol-tools-07da617c050593a5cf9ce194eefd4f4e8fea7c61.tar
dexon-sol-tools-07da617c050593a5cf9ce194eefd4f4e8fea7c61.tar.gz
dexon-sol-tools-07da617c050593a5cf9ce194eefd4f4e8fea7c61.tar.bz2
dexon-sol-tools-07da617c050593a5cf9ce194eefd4f4e8fea7c61.tar.lz
dexon-sol-tools-07da617c050593a5cf9ce194eefd4f4e8fea7c61.tar.xz
dexon-sol-tools-07da617c050593a5cf9ce194eefd4f4e8fea7c61.tar.zst
dexon-sol-tools-07da617c050593a5cf9ce194eefd4f4e8fea7c61.zip
Merge pull request #152 from 0xProject/fix/signature-verification
Add signature verification as a part of order validation
Diffstat (limited to 'src')
-rw-r--r--src/utils/order_validation_utils.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils/order_validation_utils.ts b/src/utils/order_validation_utils.ts
index 445ad43f9..e64666dfc 100644
--- a/src/utils/order_validation_utils.ts
+++ b/src/utils/order_validation_utils.ts
@@ -1,4 +1,5 @@
-import {ExchangeContractErrs, SignedOrder, Order} from '../types';
+import {ExchangeContractErrs, SignedOrder, Order, ZeroExError} from '../types';
+import {ZeroEx} from '../0x.js';
import {TokenWrapper} from '../contract_wrappers/token_wrapper';
import {ExchangeWrapper} from '../contract_wrappers/exchange_wrapper';
import {utils} from '../utils/utils';
@@ -19,6 +20,9 @@ export class OrderValidationUtils {
throw new Error(ExchangeContractErrs.OrderFillAmountZero);
}
const orderHash = utils.getOrderHashHex(signedOrder);
+ if (!ZeroEx.isValidSignature(orderHash, signedOrder.ecSignature, signedOrder.maker)) {
+ throw new Error(ZeroExError.InvalidSignature);
+ }
const unavailableTakerTokenAmount = await this.exchangeWrapper.getUnavailableTakerAmountAsync(orderHash);
if (signedOrder.makerTokenAmount.eq(unavailableTakerTokenAmount)) {
throw new Error(ExchangeContractErrs.OrderRemainingFillAmountZero);