aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src/abi_encoder/evm_data_types/int.ts
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-11-29 05:22:18 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-11-29 08:38:11 +0800
commita172ab158e2eaca8256ef881c3f2d4098987ec8a (patch)
tree4187301296e4f7fb37cb6907c5b857a3aa86fa1b /packages/utils/src/abi_encoder/evm_data_types/int.ts
parent5c13353fb2512411c0f2c8cba9395235188f5df8 (diff)
downloaddexon-0x-contracts-a172ab158e2eaca8256ef881c3f2d4098987ec8a.tar
dexon-0x-contracts-a172ab158e2eaca8256ef881c3f2d4098987ec8a.tar.gz
dexon-0x-contracts-a172ab158e2eaca8256ef881c3f2d4098987ec8a.tar.bz2
dexon-0x-contracts-a172ab158e2eaca8256ef881c3f2d4098987ec8a.tar.lz
dexon-0x-contracts-a172ab158e2eaca8256ef881c3f2d4098987ec8a.tar.xz
dexon-0x-contracts-a172ab158e2eaca8256ef881c3f2d4098987ec8a.tar.zst
dexon-0x-contracts-a172ab158e2eaca8256ef881c3f2d4098987ec8a.zip
Explicit imports for EVM Data Types
Diffstat (limited to 'packages/utils/src/abi_encoder/evm_data_types/int.ts')
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/int.ts16
1 files changed, 8 insertions, 8 deletions
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 244b720e3..aee8320a6 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/int.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/int.ts
@@ -7,36 +7,36 @@ import { RawCalldata } from '../calldata';
import { constants } from '../utils/constants';
import * as EncoderMath from '../utils/math';
-export class Int extends AbstractDataTypes.Blob {
+export class IntDataType extends AbstractDataTypes.Blob {
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}$',
);
private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
private static readonly _MAX_WIDTH: number = 256;
- private static readonly _DEFAULT_WIDTH: number = Int._MAX_WIDTH;
+ private static readonly _DEFAULT_WIDTH: number = IntDataType._MAX_WIDTH;
private readonly _width: number;
private readonly _minValue: BigNumber;
private readonly _maxValue: BigNumber;
public static matchType(type: string): boolean {
- return Int._MATCHER.test(type);
+ return IntDataType._MATCHER.test(type);
}
private static _decodeWidthFromType(type: string): number {
- const matches = Int._MATCHER.exec(type);
+ const matches = IntDataType._MATCHER.exec(type);
const width =
!_.isNull(matches) && matches.length === 2 && !_.isUndefined(matches[1])
? parseInt(matches[1], constants.DEC_BASE)
- : Int._DEFAULT_WIDTH;
+ : IntDataType._DEFAULT_WIDTH;
return width;
}
public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
- super(dataItem, dataTypeFactory, Int._SIZE_KNOWN_AT_COMPILE_TIME);
- if (!Int.matchType(dataItem.type)) {
+ super(dataItem, dataTypeFactory, IntDataType._SIZE_KNOWN_AT_COMPILE_TIME);
+ if (!IntDataType.matchType(dataItem.type)) {
throw new Error(`Tried to instantiate Int with bad input: ${dataItem}`);
}
- this._width = Int._decodeWidthFromType(dataItem.type);
+ this._width = IntDataType._decodeWidthFromType(dataItem.type);
this._minValue = new BigNumber(2).toPower(this._width - 1).times(-1);
this._maxValue = new BigNumber(2).toPower(this._width - 1).sub(1);
}