aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src/abi_encoder/evm_data_types/int.ts
diff options
context:
space:
mode:
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.ts6
1 files changed, 3 insertions, 3 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 8d98e195b..f8be1f778 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/int.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/int.ts
@@ -10,7 +10,7 @@ import * as EncoderMath from '../utils/math';
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}$',
+ '^int(8|16|24|32|40|48|56|64|72|80|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;
@@ -38,8 +38,8 @@ export class IntDataType extends AbstractBlobDataType {
throw new Error(`Tried to instantiate Int with bad input: ${dataItem}`);
}
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);
+ this._minValue = new BigNumber(2).exponentiatedBy(this._width - 1).times(-1);
+ this._maxValue = new BigNumber(2).exponentiatedBy(this._width - 1).minus(1);
}
public encodeValue(value: BigNumber | string | number): Buffer {