line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Blockchain::Ethereum::ABI::Type::Int; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
2787
|
use v5.26; |
|
5
|
|
|
|
|
20
|
|
4
|
5
|
|
|
5
|
|
27
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
100
|
|
5
|
5
|
|
|
5
|
|
22
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
124
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
26
|
use Carp; |
|
5
|
|
|
|
|
21
|
|
|
5
|
|
|
|
|
285
|
|
8
|
5
|
|
|
5
|
|
7395
|
use Math::BigInt; |
|
5
|
|
|
|
|
178125
|
|
|
5
|
|
|
|
|
26
|
|
9
|
5
|
|
|
5
|
|
131901
|
use parent qw(Blockchain::Ethereum::ABI::Type); |
|
5
|
|
|
|
|
25
|
|
|
5
|
|
|
|
|
50
|
|
10
|
|
|
|
|
|
|
|
11
|
5
|
|
|
5
|
|
414
|
use constant DEFAULT_INT_SIZE => 256; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
2057
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub encode { |
14
|
87
|
|
|
87
|
1
|
145
|
my $self = shift; |
15
|
87
|
100
|
|
|
|
181
|
return $self->_encoded if $self->_encoded; |
16
|
|
|
|
|
|
|
|
17
|
39
|
|
|
|
|
140
|
my $bdata = Math::BigInt->new($self->_data); |
18
|
|
|
|
|
|
|
|
19
|
39
|
100
|
|
|
|
3562
|
croak "Invalid numeric data @{[$self->_data]}" if $bdata->is_nan; |
|
1
|
|
|
|
|
12
|
|
20
|
|
|
|
|
|
|
|
21
|
38
|
100
|
66
|
|
|
292
|
croak "Invalid data length, signature: @{[$self->fixed_length]}, data length: @{[$bdata->length]}" |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
6
|
|
22
|
|
|
|
|
|
|
if $self->fixed_length && $bdata->length > $self->fixed_length; |
23
|
|
|
|
|
|
|
|
24
|
37
|
100
|
66
|
|
|
171
|
croak "Invalid negative numeric data @{[$self->_data]}" |
|
2
|
|
|
|
|
6
|
|
25
|
|
|
|
|
|
|
if $bdata->is_neg && $self->_signature =~ /^uint|bool/; |
26
|
|
|
|
|
|
|
|
27
|
35
|
100
|
100
|
|
|
279
|
croak "Invalid bool data it must be 1 or 0 but given @{[$self->_data]}" |
|
1
|
|
100
|
|
|
3
|
|
28
|
|
|
|
|
|
|
if !$bdata->is_zero && !$bdata->is_one && $self->_signature =~ /^bool/; |
29
|
|
|
|
|
|
|
|
30
|
34
|
|
|
|
|
414
|
$self->_push_static($self->pad_left($bdata->to_hex)); |
31
|
|
|
|
|
|
|
|
32
|
34
|
|
|
|
|
148
|
return $self->_encoded; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub decode { |
36
|
14
|
|
|
14
|
1
|
22
|
my $self = shift; |
37
|
14
|
|
|
|
|
30
|
return Math::BigInt->from_hex($self->_data->[0]); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub fixed_length { |
41
|
77
|
|
|
77
|
1
|
755
|
my $self = shift; |
42
|
77
|
100
|
|
|
|
182
|
if ($self->_signature =~ /[a-z](\d+)/) { |
43
|
59
|
|
|
|
|
304
|
return $1; |
44
|
|
|
|
|
|
|
} |
45
|
18
|
|
|
|
|
75
|
return DEFAULT_INT_SIZE; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |