aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/src/order_hash.ts
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-06-08 07:03:14 +0800
committerJacob Evans <jacob@dekz.net>2018-06-08 07:09:30 +0800
commita8d328bfc926a62d61830334fadc43fc5d013e0e (patch)
treed07cc75b63623a5a795b74c02b52d56edf392e90 /packages/order-utils/src/order_hash.ts
parenta59e9f024e76122c76600d938b565ea47938b287 (diff)
downloaddexon-0x-contracts-a8d328bfc926a62d61830334fadc43fc5d013e0e.tar.gz
dexon-0x-contracts-a8d328bfc926a62d61830334fadc43fc5d013e0e.tar.zst
dexon-0x-contracts-a8d328bfc926a62d61830334fadc43fc5d013e0e.zip
Basic EIP712 encoder
Diffstat (limited to 'packages/order-utils/src/order_hash.ts')
-rw-r--r--packages/order-utils/src/order_hash.ts19
1 files changed, 1 insertions, 18 deletions
diff --git a/packages/order-utils/src/order_hash.ts b/packages/order-utils/src/order_hash.ts
index b2414febc..46cce4b3b 100644
--- a/packages/order-utils/src/order_hash.ts
+++ b/packages/order-utils/src/order_hash.ts
@@ -75,24 +75,7 @@ export const orderHashUtils = {
* @return The resulting orderHash from hashing the supplied order as a Buffer
*/
getOrderHashBuffer(order: SignedOrder | Order): Buffer {
- const makerAssetDataHash = crypto.solSHA3([ethUtil.toBuffer(order.makerAssetData)]);
- const takerAssetDataHash = crypto.solSHA3([ethUtil.toBuffer(order.takerAssetData)]);
-
- const orderParamsHashBuff = crypto.solSHA3([
- orderHashUtils._getOrderSchemaBuffer(),
- EIP712Utils.pad32Address(order.makerAddress),
- EIP712Utils.pad32Address(order.takerAddress),
- EIP712Utils.pad32Address(order.feeRecipientAddress),
- EIP712Utils.pad32Address(order.senderAddress),
- order.makerAssetAmount,
- order.takerAssetAmount,
- order.makerFee,
- order.takerFee,
- order.expirationTimeSeconds,
- order.salt,
- makerAssetDataHash,
- takerAssetDataHash,
- ]);
+ const orderParamsHashBuff = EIP712Utils.structHash(EIP712_ORDER_SCHEMA, order);
const orderHashBuff = EIP712Utils.createEIP712Message(orderParamsHashBuff, order.exchangeAddress);
return orderHashBuff;
},