aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2019-02-06 10:03:52 +0800
committerGreg Hysen <greg.hysen@gmail.com>2019-02-06 10:10:17 +0800
commit023ea5b3a13f015ffad037cc6f21a686d2b95023 (patch)
tree1512fc278e876fa129b8bd64cb134985bf1cb047 /packages/utils
parent2ad6bd394504fe8d89ce6189aef18bb705ad7625 (diff)
downloaddexon-0x-contracts-023ea5b3a13f015ffad037cc6f21a686d2b95023.tar.gz
dexon-0x-contracts-023ea5b3a13f015ffad037cc6f21a686d2b95023.tar.zst
dexon-0x-contracts-023ea5b3a13f015ffad037cc6f21a686d2b95023.zip
Ran prettier + linter
Diffstat (limited to 'packages/utils')
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/data_type.ts3
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/bool.ts2
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts2
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/int.ts4
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/string.ts2
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/uint.ts4
-rw-r--r--packages/utils/src/abi_encoder/utils/constants.ts5
7 files changed, 12 insertions, 10 deletions
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts b/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts
index bd4711baf..db4f02b89 100644
--- a/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts
+++ b/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts
@@ -47,7 +47,8 @@ export abstract class DataType {
const hasSelector = !_.isUndefined(selector);
const rawCalldata = new RawCalldata(calldata, hasSelector);
const rules_ = _.isUndefined(rules) ? constants.DEFAULT_DECODING_RULES : rules;
- const value = rawCalldata.getSizeInBytes() > 0 ? this.generateValue(rawCalldata, rules_) : this.getDefaultValue(rules_);
+ const value =
+ rawCalldata.getSizeInBytes() > 0 ? this.generateValue(rawCalldata, rules_) : this.getDefaultValue(rules_);
return value;
}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/bool.ts b/packages/utils/src/abi_encoder/evm_data_types/bool.ts
index 54b516bb0..24887c509 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/bool.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/bool.ts
@@ -10,7 +10,7 @@ import { constants } from '../utils/constants';
export class BoolDataType extends AbstractBlobDataType {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
- private static readonly _DEFAULT_VALUE: boolean =false;
+ private static readonly _DEFAULT_VALUE: boolean = false;
public static matchType(type: string): boolean {
return type === SolidityTypes.Bool;
diff --git a/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts b/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts
index 0dd40fed2..7a49a84b4 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts
@@ -9,7 +9,7 @@ import { constants } from '../utils/constants';
export class DynamicBytesDataType extends AbstractBlobDataType {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = false;
- private static readonly _DEFAULT_VALUE = "0x";
+ private static readonly _DEFAULT_VALUE = '0x';
public static matchType(type: string): boolean {
return type === SolidityTypes.Bytes;
diff --git a/packages/utils/src/abi_encoder/evm_data_types/int.ts b/packages/utils/src/abi_encoder/evm_data_types/int.ts
index c7e4318eb..02278f666 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/int.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/int.ts
@@ -51,7 +51,7 @@ export class IntDataType extends AbstractBlobDataType {
public decodeValue(calldata: RawCalldata): BigNumber | number {
const valueBuf = calldata.popWord();
const value = EncoderMath.safeDecodeNumericValue(valueBuf, this._minValue, this._maxValue);
- if (this._width === constants.NUMBER_OF_BYTES_IN_UINT8) {
+ if (this._width === constants.NUMBER_OF_BYTES_IN_INT8) {
return value.toNumber();
}
return value;
@@ -59,7 +59,7 @@ export class IntDataType extends AbstractBlobDataType {
public getDefaultValue(): BigNumber | number {
const defaultValue = IntDataType._DEFAULT_VALUE;
- if (this._width === constants.NUMBER_OF_BYTES_IN_UINT8) {
+ if (this._width === constants.NUMBER_OF_BYTES_IN_INT8) {
return defaultValue.toNumber();
}
return defaultValue;
diff --git a/packages/utils/src/abi_encoder/evm_data_types/string.ts b/packages/utils/src/abi_encoder/evm_data_types/string.ts
index 886f398f9..f54d739b4 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/string.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/string.ts
@@ -9,7 +9,7 @@ import { constants } from '../utils/constants';
export class StringDataType extends AbstractBlobDataType {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = false;
- private static readonly _DEFAULT_VALUE = "";
+ private static readonly _DEFAULT_VALUE = '';
public static matchType(type: string): boolean {
return type === SolidityTypes.String;
diff --git a/packages/utils/src/abi_encoder/evm_data_types/uint.ts b/packages/utils/src/abi_encoder/evm_data_types/uint.ts
index 9dc141a59..d530606b9 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/uint.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/uint.ts
@@ -50,7 +50,7 @@ export class UIntDataType extends AbstractBlobDataType {
public decodeValue(calldata: RawCalldata): BigNumber | number {
const valueBuf = calldata.popWord();
const value = EncoderMath.safeDecodeNumericValue(valueBuf, UIntDataType._MIN_VALUE, this._maxValue);
- if (this._width === constants.NUMBER_OF_BYTES_IN_INT8) {
+ if (this._width === constants.NUMBER_OF_BYTES_IN_UINT8) {
return value.toNumber();
}
return value;
@@ -58,7 +58,7 @@ export class UIntDataType extends AbstractBlobDataType {
public getDefaultValue(): BigNumber | number {
const defaultValue = UIntDataType._DEFAULT_VALUE;
- if (this._width === constants.NUMBER_OF_BYTES_IN_INT8) {
+ if (this._width === constants.NUMBER_OF_BYTES_IN_UINT8) {
return defaultValue.toNumber();
}
return defaultValue;
diff --git a/packages/utils/src/abi_encoder/utils/constants.ts b/packages/utils/src/abi_encoder/utils/constants.ts
index db190c3a6..b45b5b8e8 100644
--- a/packages/utils/src/abi_encoder/utils/constants.ts
+++ b/packages/utils/src/abi_encoder/utils/constants.ts
@@ -1,6 +1,7 @@
-import { DecodingRules, EncodingRules } from './rules';
import * as ethUtil from 'ethereumjs-util';
+import { DecodingRules, EncodingRules } from './rules';
+
export const constants = {
EVM_WORD_WIDTH_IN_BYTES: 32,
EVM_WORD_WIDTH_IN_BITS: 256,
@@ -19,4 +20,4 @@ export const constants = {
EMPTY_EVM_WORD_BUFFER: ethUtil.toBuffer('0x0000000000000000000000000000000000000000000000000000000000000000'),
NUMBER_OF_BYTES_IN_UINT8: 8,
NUMBER_OF_BYTES_IN_INT8: 8,
-}
+};