Initial implementation of Arbitrage contract with tests

This commit is contained in:
Leonid Logvinov
2018-02-02 18:30:17 +01:00
parent 451a0dacbe
commit 2d0940589e
9 changed files with 508 additions and 1 deletions

View File

@@ -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;
},
};

View File

@@ -96,6 +96,9 @@ export enum ContractName {
EtherToken = 'WETH9',
MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress = 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress',
MaliciousToken = 'MaliciousToken',
AccountLevels = 'AccountLevels',
EtherDelta = 'EtherDelta',
Arbitrage = 'Arbitrage',
}
export interface Artifact {