diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-02 21:44:53 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-02 21:44:53 +0800 |
commit | 406aedfdc2062ecbdbc6db4a53ae2bb945fb79d3 (patch) | |
tree | d2b21e04c65608dcef473da44b902a9efa12016e /packages/contracts/util/crypto.ts | |
parent | 67c834841ea0f8fb4d8d194c0f68802f48e764ee (diff) | |
parent | 4a57f2a762619932a882d08e62006e83a584a684 (diff) | |
download | dexon-sol-tools-406aedfdc2062ecbdbc6db4a53ae2bb945fb79d3.tar dexon-sol-tools-406aedfdc2062ecbdbc6db4a53ae2bb945fb79d3.tar.gz dexon-sol-tools-406aedfdc2062ecbdbc6db4a53ae2bb945fb79d3.tar.bz2 dexon-sol-tools-406aedfdc2062ecbdbc6db4a53ae2bb945fb79d3.tar.lz dexon-sol-tools-406aedfdc2062ecbdbc6db4a53ae2bb945fb79d3.tar.xz dexon-sol-tools-406aedfdc2062ecbdbc6db4a53ae2bb945fb79d3.tar.zst dexon-sol-tools-406aedfdc2062ecbdbc6db4a53ae2bb945fb79d3.zip |
Merge branch 'development' into fix/doc_bugs
* development: (21 commits)
Adjust the tests
Move tutorials to adhere to current dir structure
Make tests slightly nicer
Remove only
Improve the comments
Improve the comments
Add comments to Arbitrage contract
Don't pass tokenGet and tokenGive because we can get them from 0x order
Pretty-print ED contracts
Make external
Fix a typo
Change type to uint256
Make setAllowances external
Fix the comment
Put all ED contracts in one folder
Move tutorials contracts to src folder
Remove false-positive linter failure because of chai-as-pronmised incorrect types
Assert that the balances don't change if arbitrage fails
Initial implementation of Arbitrage contract with tests
Set max to 2 ETH/2 ZRX
...
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; }, }; |