aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/util/crypto.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-01-30 20:21:01 +0800
committerFabio Berger <me@fabioberger.com>2018-01-30 20:21:01 +0800
commit93a5b3f457c1211676296840c285759007a55500 (patch)
treed1682b657c207f447748e08550095bafc79b6997 /packages/contracts/util/crypto.ts
parent4242176d291f54212797de9f5df80b1346724ebb (diff)
downloaddexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.gz
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.bz2
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.lz
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.xz
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.tar.zst
dexon-sol-tools-93a5b3f457c1211676296840c285759007a55500.zip
Fix prettier
Diffstat (limited to 'packages/contracts/util/crypto.ts')
-rw-r--r--packages/contracts/util/crypto.ts46
1 files changed, 23 insertions, 23 deletions
diff --git a/packages/contracts/util/crypto.ts b/packages/contracts/util/crypto.ts
index 9173df643..29bbf206a 100644
--- a/packages/contracts/util/crypto.ts
+++ b/packages/contracts/util/crypto.ts
@@ -4,7 +4,7 @@ import ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
export const crypto = {
- /*
+ /*
* We convert types from JS to Solidity as follows:
* BigNumber -> uint256
* number -> uint8
@@ -12,26 +12,26 @@ export const crypto = {
* boolean -> bool
* valid Ethereum address -> address
*/
- solSHA3(args: any[]): Buffer {
- const argTypes: string[] = [];
- _.each(args, (arg, i) => {
- const isNumber = _.isFinite(arg);
- if (isNumber) {
- argTypes.push('uint8');
- } else if (arg.isBigNumber) {
- argTypes.push('uint256');
- args[i] = new BN(arg.toString(10), 10);
- } else if (ethUtil.isValidAddress(arg)) {
- argTypes.push('address');
- } else if (_.isString(arg)) {
- argTypes.push('string');
- } else if (_.isBoolean(arg)) {
- argTypes.push('bool');
- } else {
- throw new Error(`Unable to guess arg type: ${arg}`);
- }
- });
- const hash = ABI.soliditySHA3(argTypes, args);
- return hash;
- },
+ solSHA3(args: any[]): Buffer {
+ const argTypes: string[] = [];
+ _.each(args, (arg, i) => {
+ const isNumber = _.isFinite(arg);
+ if (isNumber) {
+ argTypes.push('uint8');
+ } else if (arg.isBigNumber) {
+ argTypes.push('uint256');
+ args[i] = new BN(arg.toString(10), 10);
+ } else if (ethUtil.isValidAddress(arg)) {
+ argTypes.push('address');
+ } else if (_.isString(arg)) {
+ argTypes.push('string');
+ } else if (_.isBoolean(arg)) {
+ argTypes.push('bool');
+ } else {
+ throw new Error(`Unable to guess arg type: ${arg}`);
+ }
+ });
+ const hash = ABI.soliditySHA3(argTypes, args);
+ return hash;
+ },
};