diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-02 08:57:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-02 08:57:58 +0800 |
commit | 4a57f2a762619932a882d08e62006e83a584a684 (patch) | |
tree | 9fe34c12d965d4621ac710943a1c76784dfb9b64 /packages/contracts/util/crypto.ts | |
parent | 451a0dacbe85d7a0d16ef007c1eb945a4c1977cb (diff) | |
parent | 6edd7682a92519b58ef906489bcb6303dd53e609 (diff) | |
download | dexon-0x-contracts-4a57f2a762619932a882d08e62006e83a584a684.tar.gz dexon-0x-contracts-4a57f2a762619932a882d08e62006e83a584a684.tar.zst dexon-0x-contracts-4a57f2a762619932a882d08e62006e83a584a684.zip |
Merge pull request #425 from 0xProject/feature/build_watch
Arbitrage tutorial contract
Diffstat (limited to 'packages/contracts/util/crypto.ts')
-rw-r--r-- | packages/contracts/util/crypto.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/contracts/util/crypto.ts b/packages/contracts/util/crypto.ts index 9173df643..97b8f5643 100644 --- a/packages/contracts/util/crypto.ts +++ b/packages/contracts/util/crypto.ts @@ -13,6 +13,12 @@ export const crypto = { * valid Ethereum address -> address */ solSHA3(args: any[]): Buffer { + return crypto._solHash(args, ABI.soliditySHA3); + }, + solSHA256(args: any[]): Buffer { + return crypto._solHash(args, ABI.soliditySHA256); + }, + _solHash(args: any[], hashFunction: (types: string[], values: any[]) => Buffer) { const argTypes: string[] = []; _.each(args, (arg, i) => { const isNumber = _.isFinite(arg); @@ -31,7 +37,7 @@ export const crypto = { throw new Error(`Unable to guess arg type: ${arg}`); } }); - const hash = ABI.soliditySHA3(argTypes, args); + const hash = hashFunction(argTypes, args); return hash; }, }; |