aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/util
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-02-03 01:30:17 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-03-02 04:21:08 +0800
commit2d0940589eb9659cea5179d5b1665ce717ecdf2e (patch)
treebad9c7e51020ec1f3a3cef25993bf9163c7e8c2f /packages/contracts/util
parent451a0dacbe85d7a0d16ef007c1eb945a4c1977cb (diff)
downloaddexon-sol-tools-2d0940589eb9659cea5179d5b1665ce717ecdf2e.tar
dexon-sol-tools-2d0940589eb9659cea5179d5b1665ce717ecdf2e.tar.gz
dexon-sol-tools-2d0940589eb9659cea5179d5b1665ce717ecdf2e.tar.bz2
dexon-sol-tools-2d0940589eb9659cea5179d5b1665ce717ecdf2e.tar.lz
dexon-sol-tools-2d0940589eb9659cea5179d5b1665ce717ecdf2e.tar.xz
dexon-sol-tools-2d0940589eb9659cea5179d5b1665ce717ecdf2e.tar.zst
dexon-sol-tools-2d0940589eb9659cea5179d5b1665ce717ecdf2e.zip
Initial implementation of Arbitrage contract with tests
Diffstat (limited to 'packages/contracts/util')
-rw-r--r--packages/contracts/util/crypto.ts8
-rw-r--r--packages/contracts/util/types.ts3
2 files changed, 10 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;
},
};
diff --git a/packages/contracts/util/types.ts b/packages/contracts/util/types.ts
index d6e4c587d..61a19acb4 100644
--- a/packages/contracts/util/types.ts
+++ b/packages/contracts/util/types.ts
@@ -96,6 +96,9 @@ export enum ContractName {
EtherToken = 'WETH9',
MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress = 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress',
MaliciousToken = 'MaliciousToken',
+ AccountLevels = 'AccountLevels',
+ EtherDelta = 'EtherDelta',
+ Arbitrage = 'Arbitrage',
}
export interface Artifact {