aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-11-28 08:33:51 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-11-29 08:38:11 +0800
commit14c094d050e7b2d0a4b31d02dbe58a54153be7bb (patch)
tree363d74ffde6ad86e981b18be4569d97f234deeb9
parentf196dc9e35d12aad281142371af4d2c32db1fd60 (diff)
downloaddexon-0x-contracts-14c094d050e7b2d0a4b31d02dbe58a54153be7bb.tar
dexon-0x-contracts-14c094d050e7b2d0a4b31d02dbe58a54153be7bb.tar.gz
dexon-0x-contracts-14c094d050e7b2d0a4b31d02dbe58a54153be7bb.tar.bz2
dexon-0x-contracts-14c094d050e7b2d0a4b31d02dbe58a54153be7bb.tar.lz
dexon-0x-contracts-14c094d050e7b2d0a4b31d02dbe58a54153be7bb.tar.xz
dexon-0x-contracts-14c094d050e7b2d0a4b31d02dbe58a54153be7bb.tar.zst
dexon-0x-contracts-14c094d050e7b2d0a4b31d02dbe58a54153be7bb.zip
Use SolidityTypes from `ethereum-types` package.
-rw-r--r--packages/ethereum-types/src/index.ts5
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/address.ts6
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/bool.ts6
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts6
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/int.ts4
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts4
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/string.ts6
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/tuple.ts4
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/uint.ts4
9 files changed, 25 insertions, 20 deletions
diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts
index eff38711a..9430fdc98 100644
--- a/packages/ethereum-types/src/index.ts
+++ b/packages/ethereum-types/src/index.ts
@@ -283,6 +283,11 @@ export interface RawLogEntry {
export enum SolidityTypes {
Address = 'address',
+ Bool = 'bool',
+ Bytes = 'bytes',
+ Int = 'int',
+ String = 'string',
+ Tuple = 'tuple',
Uint256 = 'uint256',
Uint8 = 'uint8',
Uint = 'uint',
diff --git a/packages/utils/src/abi_encoder/evm_data_types/address.ts b/packages/utils/src/abi_encoder/evm_data_types/address.ts
index 950901ea8..07a0bd10c 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/address.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/address.ts
@@ -1,4 +1,4 @@
-import { DataItem } from 'ethereum-types';
+import { DataItem, SolidityTypes } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
@@ -13,7 +13,7 @@ export class Address extends AbstractDataTypes.Blob {
Address._ADDRESS_SIZE_IN_BYTES;
public static matchType(type: string): boolean {
- return type === 'address';
+ return type === SolidityTypes.Address;
}
public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
@@ -42,7 +42,7 @@ export class Address extends AbstractDataTypes.Blob {
}
public getSignature(): string {
- return 'address';
+ return SolidityTypes.Address;
}
/* tslint:enable prefer-function-over-method */
}
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 7e135aba9..7af13506b 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/bool.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/bool.ts
@@ -1,4 +1,4 @@
-import { DataItem } from 'ethereum-types';
+import { DataItem, SolidityTypes } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
@@ -11,7 +11,7 @@ export class Bool extends AbstractDataTypes.Blob {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
public static matchType(type: string): boolean {
- return type === 'bool';
+ return type === SolidityTypes.Bool;
}
public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
@@ -46,7 +46,7 @@ export class Bool extends AbstractDataTypes.Blob {
}
public getSignature(): string {
- return 'bool';
+ return SolidityTypes.Bool;
}
/* tslint:enable prefer-function-over-method */
}
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 fecd1db6b..ac2a1fb6e 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
@@ -1,4 +1,4 @@
-import { DataItem } from 'ethereum-types';
+import { DataItem, SolidityTypes } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
@@ -10,7 +10,7 @@ export class DynamicBytes extends AbstractDataTypes.Blob {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = false;
public static matchType(type: string): boolean {
- return type === 'bytes';
+ return type === SolidityTypes.Bytes;
}
private static _sanityCheckValue(value: string | Buffer): void {
@@ -65,7 +65,7 @@ export class DynamicBytes extends AbstractDataTypes.Blob {
}
public getSignature(): string {
- return 'bytes';
+ return SolidityTypes.Bytes;
}
/* tslint:enable prefer-function-over-method */
}
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 9d328bba9..3e465fc15 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/int.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/int.ts
@@ -1,4 +1,4 @@
-import { DataItem } from 'ethereum-types';
+import { DataItem, SolidityTypes } from 'ethereum-types';
import * as _ from 'lodash';
import { BigNumber } from '../../configured_bignumber';
@@ -53,6 +53,6 @@ export class Int extends AbstractDataTypes.Blob {
}
public getSignature(): string {
- return `int${this._width}`;
+ return `${SolidityTypes.Int}${this._width}`;
}
}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts b/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts
index 68f212f79..ed1f51f7e 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts
@@ -1,4 +1,4 @@
-import { DataItem } from 'ethereum-types';
+import { DataItem, SolidityTypes } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
@@ -37,7 +37,7 @@ export class StaticBytes extends AbstractDataTypes.Blob {
public getSignature(): string {
// Note that `byte` reduces to `bytes1`
- return `bytes${this._width}`;
+ return `${SolidityTypes.Bytes}${this._width}`;
}
public encodeValue(value: string | Buffer): Buffer {
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 08f928d8a..e5b2d5f33 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/string.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/string.ts
@@ -1,4 +1,4 @@
-import { DataItem } from 'ethereum-types';
+import { DataItem, SolidityTypes } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
@@ -10,7 +10,7 @@ export class String extends AbstractDataTypes.Blob {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = false;
public static matchType(type: string): boolean {
- return type === 'string';
+ return type === SolidityTypes.String;
}
public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
@@ -52,7 +52,7 @@ export class String extends AbstractDataTypes.Blob {
}
public getSignature(): string {
- return 'string';
+ return SolidityTypes.String;
}
/* tslint:enable prefer-function-over-method */
}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/tuple.ts b/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
index 3802f96c0..40859f62e 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
@@ -1,4 +1,4 @@
-import { DataItem } from 'ethereum-types';
+import { DataItem, SolidityTypes } from 'ethereum-types';
import { AbstractDataTypes, DataTypeFactory } from '../abstract_data_types';
@@ -6,7 +6,7 @@ export class Tuple extends AbstractDataTypes.Set {
private readonly _signature: string;
public static matchType(type: string): boolean {
- return type === 'tuple';
+ return type === SolidityTypes.Tuple;
}
public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
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 4357f15d2..970400a57 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/uint.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/uint.ts
@@ -1,4 +1,4 @@
-import { DataItem } from 'ethereum-types';
+import { DataItem, SolidityTypes } from 'ethereum-types';
import * as _ from 'lodash';
import { BigNumber } from '../../configured_bignumber';
@@ -52,6 +52,6 @@ export class UInt extends AbstractDataTypes.Blob {
}
public getSignature(): string {
- return `uint${this._width}`;
+ return `${SolidityTypes.Uint}${this._width}`;
}
}