File structure improvements

This commit is contained in:
Aleksandr Kraiz
2022-04-22 07:27:24 +04:00
parent c92b277d80
commit 5c96476849
10 changed files with 176 additions and 154 deletions

35
src/crypt/hashOrder.ts Normal file
View File

@@ -0,0 +1,35 @@
import { ethers } from 'ethers';
import { Order } from '../types';
const hashOrder = (order: Order) => ethers.utils.solidityKeccak256(
[
'uint8',
'address',
'address',
'address',
'address',
'address',
'uint64',
'uint64',
'uint64',
'uint64',
'uint64',
'uint8',
],
[
'0x03',
order.senderAddress,
order.matcherAddress,
order.baseAsset,
order.quoteAsset,
order.matcherFeeAsset,
order.amount,
order.price,
order.matcherFee,
order.nonce,
order.expiration,
order.buySide ? '0x01' : '0x00',
],
);
export default hashOrder;