line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Blockchain::Ethereum::ABI::Type::Tuple; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
67
|
use v5.26; |
|
5
|
|
|
|
|
20
|
|
4
|
5
|
|
|
5
|
|
28
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
99
|
|
5
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
113
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
39
|
use Carp; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
320
|
|
8
|
5
|
|
|
5
|
|
468
|
use parent qw(Blockchain::Ethereum::ABI::Type); |
|
5
|
|
|
|
|
341
|
|
|
5
|
|
|
|
|
41
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _configure { |
11
|
33
|
|
|
33
|
|
66
|
my $self = shift; |
12
|
33
|
100
|
|
|
|
111
|
return unless $self->_data; |
13
|
|
|
|
|
|
|
|
14
|
8
|
|
|
|
|
35
|
my @splited_signatures = $self->_split_tuple_signature->@*; |
15
|
|
|
|
|
|
|
|
16
|
8
|
|
|
|
|
67
|
for (my $sig_index = 0; $sig_index < @splited_signatures; $sig_index++) { |
17
|
29
|
|
|
|
|
89
|
push $self->_instances->@*, |
18
|
|
|
|
|
|
|
Blockchain::Ethereum::ABI::Type::new_type( |
19
|
|
|
|
|
|
|
signature => $splited_signatures[$sig_index], |
20
|
|
|
|
|
|
|
data => $self->_data->[$sig_index]); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _split_tuple_signature { |
26
|
18
|
|
|
18
|
|
33
|
my $self = shift; |
27
|
18
|
|
|
|
|
48
|
my $tuple_signatures = substr($self->_signature, 1, length($self->_signature) - 2); |
28
|
18
|
|
|
|
|
238
|
$tuple_signatures =~ s/((\((?>[^)(]*(?2)?)*\))|[^,()]*)(*SKIP),/$1\n/g; |
29
|
18
|
|
|
|
|
85
|
my @types = split('\n', $tuple_signatures); |
30
|
18
|
|
|
|
|
80
|
return \@types; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub encode { |
34
|
35
|
|
|
35
|
1
|
60
|
my $self = shift; |
35
|
35
|
100
|
|
|
|
115
|
return $self->_encoded if $self->_encoded; |
36
|
|
|
|
|
|
|
|
37
|
22
|
|
|
|
|
78
|
my $offset = $self->_get_initial_offset; |
38
|
|
|
|
|
|
|
|
39
|
16
|
|
|
|
|
45
|
for my $instance ($self->_instances->@*) { |
40
|
50
|
|
|
|
|
150
|
$instance->encode; |
41
|
50
|
100
|
|
|
|
141
|
if ($instance->is_dynamic) { |
42
|
14
|
|
|
|
|
53
|
$self->_push_static($self->_encode_offset($offset)); |
43
|
14
|
|
|
|
|
41
|
$self->_push_dynamic($instance->_encoded); |
44
|
14
|
|
|
|
|
40
|
$offset += scalar $instance->_encoded->@*; |
45
|
14
|
|
|
|
|
47
|
next; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
36
|
|
|
|
|
167
|
$self->_push_static($instance->_encoded); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
16
|
|
|
|
|
39
|
return $self->_encoded; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub decode { |
55
|
11
|
|
|
11
|
1
|
18
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
11
|
100
|
|
|
|
30
|
unless (scalar $self->_instances->@* > 0) { |
58
|
4
|
|
|
|
|
17
|
push $self->_instances->@*, Blockchain::Ethereum::ABI::Type::new_type(signature => $_) for $self->_split_tuple_signature->@*; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
11
|
|
|
|
|
35
|
return $self->_read_stack_set_data; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _static_size { |
65
|
6
|
|
|
6
|
|
13
|
my $self = shift; |
66
|
6
|
50
|
|
|
|
15
|
return 1 if $self->is_dynamic; |
67
|
6
|
|
|
|
|
45
|
my $size = 1; |
68
|
6
|
|
|
|
|
13
|
my $instance_size = 0; |
69
|
6
|
|
|
|
|
14
|
for my $signature ($self->_split_tuple_signature->@*) { |
70
|
12
|
|
|
|
|
29
|
my $instance = Blockchain::Ethereum::ABI::Type::new_type(signature => $signature); |
71
|
12
|
|
50
|
|
|
55
|
$instance_size += $instance->_static_size // 0; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
6
|
|
|
|
|
17
|
return $size * $instance_size; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |