blob: ced3ef08be8ccdcb25621c622e241c8a961ee863 (
plain) (
blame)
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
33
|
/* tslint:disable prefer-function-over-method */
import { DataItem } from 'ethereum-types';
import { BigNumber } from '../../configured_bignumber';
import { DataTypeFactory } from '../abstract_data_types';
import { Number } from './number';
export class UInt extends Number {
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}$',
);
public static matchType(type: string): boolean {
return UInt._matcher.test(type);
}
public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
super(dataItem, UInt._matcher, dataTypeFactory);
}
public getMaxValue(): BigNumber {
return new BigNumber(2).toPower(this._width).sub(1);
}
public getMinValue(): BigNumber {
return new BigNumber(0);
}
public getSignature(): string {
return `uint${this._width}`;
}
}
|