aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-11-29 05:35:53 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-11-29 08:38:11 +0800
commitb8ea322541e291b84f261bffcc77baf85dae08c1 (patch)
tree3c3a4e5adf7aaa0af037b172d74f529c824b8d7b
parenta172ab158e2eaca8256ef881c3f2d4098987ec8a (diff)
downloaddexon-sol-tools-b8ea322541e291b84f261bffcc77baf85dae08c1.tar
dexon-sol-tools-b8ea322541e291b84f261bffcc77baf85dae08c1.tar.gz
dexon-sol-tools-b8ea322541e291b84f261bffcc77baf85dae08c1.tar.bz2
dexon-sol-tools-b8ea322541e291b84f261bffcc77baf85dae08c1.tar.lz
dexon-sol-tools-b8ea322541e291b84f261bffcc77baf85dae08c1.tar.xz
dexon-sol-tools-b8ea322541e291b84f261bffcc77baf85dae08c1.tar.zst
dexon-sol-tools-b8ea322541e291b84f261bffcc77baf85dae08c1.zip
Explicit imports for abstract data types.
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/index.ts4
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts2
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/index.ts3
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts2
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/set.ts6
-rw-r--r--packages/utils/src/abi_encoder/evm_data_type_factory.ts3
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/address.ts5
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/array.ts5
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/bool.ts5
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts5
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/int.ts5
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/method.ts6
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/pointer.ts6
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts5
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/string.ts5
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/tuple.ts5
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/uint.ts5
17 files changed, 42 insertions, 35 deletions
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/index.ts b/packages/utils/src/abi_encoder/abstract_data_types/index.ts
deleted file mode 100644
index d1c7d93e4..000000000
--- a/packages/utils/src/abi_encoder/abstract_data_types/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './interfaces';
-export * from './data_type';
-import * as AbstractDataTypes from './types';
-export { AbstractDataTypes };
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts
index 965738056..cd2119673 100644
--- a/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts
+++ b/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts
@@ -7,7 +7,7 @@ import { DecodingRules } from '../../utils/rules';
import { DataType } from '../data_type';
import { DataTypeFactory } from '../interfaces';
-export abstract class Blob extends DataType {
+export abstract class AbstractBlobDataType extends DataType {
protected _sizeKnownAtCompileTime: boolean;
public constructor(dataItem: DataItem, factory: DataTypeFactory, sizeKnownAtCompileTime: boolean) {
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/index.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/index.ts
deleted file mode 100644
index 958582dae..000000000
--- a/packages/utils/src/abi_encoder/abstract_data_types/types/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './blob';
-export * from './pointer';
-export * from './set';
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts
index 3d38deb94..b6a6a7613 100644
--- a/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts
+++ b/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts
@@ -9,7 +9,7 @@ import { DecodingRules } from '../../utils/rules';
import { DataType } from '../data_type';
import { DataTypeFactory } from '../interfaces';
-export abstract class Pointer extends DataType {
+export abstract class AbstractPointerDataType extends DataType {
protected _destination: DataType;
protected _parent: DataType;
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
index f50ed8298..4c8bb7b1a 100644
--- a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
+++ b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
@@ -10,9 +10,9 @@ import { DecodingRules } from '../../utils/rules';
import { DataType } from '../data_type';
import { DataTypeFactory, MemberIndexByName } from '../interfaces';
-import { Pointer } from './pointer';
+import { AbstractPointerDataType } from './pointer';
-export abstract class Set extends DataType {
+export abstract class AbstractSetDataType extends DataType {
protected readonly _arrayLength: number | undefined;
protected readonly _arrayElementType: string | undefined;
private readonly _memberIndexByName: MemberIndexByName;
@@ -88,7 +88,7 @@ export abstract class Set extends DataType {
}
// If any member of the set is a pointer then the set is not static.
const dependentMember = _.find(this._members, (member: DataType) => {
- return member instanceof Pointer;
+ return member instanceof AbstractPointerDataType;
});
const isStatic = _.isUndefined(dependentMember);
return isStatic;
diff --git a/packages/utils/src/abi_encoder/evm_data_type_factory.ts b/packages/utils/src/abi_encoder/evm_data_type_factory.ts
index 4d04d4ed7..4cc124e0a 100644
--- a/packages/utils/src/abi_encoder/evm_data_type_factory.ts
+++ b/packages/utils/src/abi_encoder/evm_data_type_factory.ts
@@ -2,7 +2,8 @@
import { DataItem, MethodAbi } from 'ethereum-types';
import * as _ from 'lodash';
-import { DataType, DataTypeFactory } from './abstract_data_types';
+import { DataType } from './abstract_data_types/data_type';
+import { DataTypeFactory } from './abstract_data_types/interfaces';
import { AddressDataType } from './evm_data_types/address';
import { ArrayDataType } from './evm_data_types/array';
import { BoolDataType } from './evm_data_types/bool';
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 769c5a81c..17363b5f3 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/address.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/address.ts
@@ -2,11 +2,12 @@ import { DataItem, SolidityTypes } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
-import { AbstractDataTypes, DataTypeFactory } from '../abstract_data_types';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
import { RawCalldata } from '../calldata';
import { constants } from '../utils/constants';
-export class AddressDataType extends AbstractDataTypes.Blob {
+export class AddressDataType extends AbstractBlobDataType {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
private static readonly _ADDRESS_SIZE_IN_BYTES = 20;
private static readonly _DECODED_ADDRESS_OFFSET_IN_BYTES = constants.EVM_WORD_WIDTH_IN_BYTES -
diff --git a/packages/utils/src/abi_encoder/evm_data_types/array.ts b/packages/utils/src/abi_encoder/evm_data_types/array.ts
index 1736bcef0..7595cb667 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/array.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/array.ts
@@ -1,10 +1,11 @@
import { DataItem } from 'ethereum-types';
import * as _ from 'lodash';
-import { AbstractDataTypes, DataTypeFactory } from '../abstract_data_types';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractSetDataType } from '../abstract_data_types/types/set';
import { constants } from '../utils/constants';
-export class ArrayDataType extends AbstractDataTypes.Set {
+export class ArrayDataType extends AbstractSetDataType {
private static readonly _MATCHER = RegExp('^(.+)\\[([0-9]*)\\]$');
private readonly _arraySignature: string;
private readonly _elementType: string;
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 32eda9c39..778a01d8a 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/bool.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/bool.ts
@@ -3,11 +3,12 @@ import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { BigNumber } from '../../configured_bignumber';
-import { AbstractDataTypes, DataTypeFactory } from '../abstract_data_types';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
import { RawCalldata } from '../calldata';
import { constants } from '../utils/constants';
-export class BoolDataType extends AbstractDataTypes.Blob {
+export class BoolDataType extends AbstractBlobDataType {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
public static matchType(type: string): boolean {
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 c8ff47c3d..ac8e2b716 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
@@ -2,11 +2,12 @@ import { DataItem, SolidityTypes } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
-import { AbstractDataTypes, DataTypeFactory } from '../abstract_data_types';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
import { RawCalldata } from '../calldata';
import { constants } from '../utils/constants';
-export class DynamicBytesDataType extends AbstractDataTypes.Blob {
+export class DynamicBytesDataType extends AbstractBlobDataType {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = false;
public static matchType(type: string): boolean {
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 aee8320a6..6b5c3bf78 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/int.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/int.ts
@@ -2,12 +2,13 @@ import { DataItem, SolidityTypes } from 'ethereum-types';
import * as _ from 'lodash';
import { BigNumber } from '../../configured_bignumber';
-import { AbstractDataTypes, DataTypeFactory } from '../abstract_data_types';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
import { RawCalldata } from '../calldata';
import { constants } from '../utils/constants';
import * as EncoderMath from '../utils/math';
-export class IntDataType extends AbstractDataTypes.Blob {
+export class IntDataType extends AbstractBlobDataType {
private static readonly _MATCHER = RegExp(
'^int(8|16|24|32|40|48|56|64|72|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256){0,1}$',
);
diff --git a/packages/utils/src/abi_encoder/evm_data_types/method.ts b/packages/utils/src/abi_encoder/evm_data_types/method.ts
index de8809edf..b1cd1377f 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/method.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/method.ts
@@ -2,13 +2,15 @@ import { DataItem, MethodAbi } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
-import { AbstractDataTypes, DataType, DataTypeFactory } from '../abstract_data_types';
+import { DataType } from '../abstract_data_types/data_type';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractSetDataType } from '../abstract_data_types/types/set';
import { constants } from '../utils/constants';
import { DecodingRules, EncodingRules } from '../utils/rules';
import { TupleDataType } from './tuple';
-export class MethodDataType extends AbstractDataTypes.Set {
+export class MethodDataType extends AbstractSetDataType {
private readonly _methodSignature: string;
private readonly _methodSelector: string;
private readonly _returnDataType: DataType;
diff --git a/packages/utils/src/abi_encoder/evm_data_types/pointer.ts b/packages/utils/src/abi_encoder/evm_data_types/pointer.ts
index 7ca428760..389e75927 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/pointer.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/pointer.ts
@@ -1,8 +1,10 @@
import { DataItem } from 'ethereum-types';
-import { AbstractDataTypes, DataType, DataTypeFactory } from '../abstract_data_types';
+import { DataType } from '../abstract_data_types/data_type';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractPointerDataType } from '../abstract_data_types/types/pointer';
-export class PointerDataType extends AbstractDataTypes.Pointer {
+export class PointerDataType extends AbstractPointerDataType {
constructor(destDataType: DataType, parentDataType: DataType, dataTypeFactory: DataTypeFactory) {
const destDataItem = destDataType.getDataItem();
const dataItem: DataItem = { name: `ptr<${destDataItem.name}>`, type: `ptr<${destDataItem.type}>` };
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 3b270630e..28584d445 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
@@ -2,11 +2,12 @@ import { DataItem, SolidityTypes } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
-import { AbstractDataTypes, DataTypeFactory } from '../abstract_data_types';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
import { RawCalldata } from '../calldata';
import { constants } from '../utils/constants';
-export class StaticBytesDataType extends AbstractDataTypes.Blob {
+export class StaticBytesDataType extends AbstractBlobDataType {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
private static readonly _MATCHER = RegExp(
'^(byte|bytes(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32))$',
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 d7e9ec7fe..7b6af747b 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/string.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/string.ts
@@ -2,11 +2,12 @@ import { DataItem, SolidityTypes } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
-import { AbstractDataTypes, DataTypeFactory } from '../abstract_data_types';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
import { RawCalldata } from '../calldata';
import { constants } from '../utils/constants';
-export class StringDataType extends AbstractDataTypes.Blob {
+export class StringDataType extends AbstractBlobDataType {
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = false;
public static matchType(type: string): boolean {
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 5ba875b9e..31593c882 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
@@ -1,8 +1,9 @@
import { DataItem, SolidityTypes } from 'ethereum-types';
-import { AbstractDataTypes, DataTypeFactory } from '../abstract_data_types';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractSetDataType } from '../abstract_data_types/types/set';
-export class TupleDataType extends AbstractDataTypes.Set {
+export class TupleDataType extends AbstractSetDataType {
private readonly _signature: string;
public static matchType(type: string): boolean {
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 a5989ea11..45cb366f7 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/uint.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/uint.ts
@@ -2,12 +2,13 @@ import { DataItem, SolidityTypes } from 'ethereum-types';
import * as _ from 'lodash';
import { BigNumber } from '../../configured_bignumber';
-import { AbstractDataTypes, DataTypeFactory } from '../abstract_data_types';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
import { RawCalldata } from '../calldata';
import { constants } from '../utils/constants';
import * as EncoderMath from '../utils/math';
-export class UIntDataType extends AbstractDataTypes.Blob {
+export class UIntDataType extends AbstractBlobDataType {
private static readonly _MATCHER = RegExp(
'^uint(8|16|24|32|40|48|56|64|72|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256){0,1}$',
);