line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package REFECO::Blockchain::Contract::Solidity::ABI::Type::Tuple; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
63
|
use v5.26; |
|
5
|
|
|
|
|
21
|
|
4
|
5
|
|
|
5
|
|
26
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
103
|
|
5
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
125
|
|
6
|
5
|
|
|
5
|
|
26
|
no indirect; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
33
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
276
|
use Carp; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
379
|
|
9
|
5
|
|
|
5
|
|
438
|
use parent qw(REFECO::Blockchain::Contract::Solidity::ABI::Type); |
|
5
|
|
|
|
|
328
|
|
|
5
|
|
|
|
|
32
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub configure { |
12
|
33
|
|
|
33
|
0
|
76
|
my $self = shift; |
13
|
33
|
100
|
|
|
|
133
|
return unless $self->data; |
14
|
|
|
|
|
|
|
|
15
|
8
|
|
|
|
|
26
|
my @splited_signatures = $self->split_tuple_signature->@*; |
16
|
|
|
|
|
|
|
|
17
|
8
|
|
|
|
|
34
|
for (my $sig_index = 0; $sig_index < @splited_signatures; $sig_index++) { |
18
|
29
|
|
|
|
|
98
|
push $self->instances->@*, |
19
|
|
|
|
|
|
|
REFECO::Blockchain::Contract::Solidity::ABI::Type::new_type( |
20
|
|
|
|
|
|
|
signature => $splited_signatures[$sig_index], |
21
|
|
|
|
|
|
|
data => $self->data->[$sig_index]); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub split_tuple_signature { |
27
|
18
|
|
|
18
|
0
|
31
|
my $self = shift; |
28
|
18
|
|
|
|
|
54
|
my $tuple_signatures = substr($self->signature, 1, length($self->signature) - 2); |
29
|
18
|
|
|
|
|
249
|
$tuple_signatures =~ s/((\((?>[^)(]*(?2)?)*\))|[^,()]*)(*SKIP),/$1\n/g; |
30
|
18
|
|
|
|
|
89
|
my @types = split('\n', $tuple_signatures); |
31
|
18
|
|
|
|
|
73
|
return \@types; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub encode { |
35
|
35
|
|
|
35
|
0
|
91
|
my $self = shift; |
36
|
35
|
100
|
|
|
|
111
|
return $self->encoded if $self->encoded; |
37
|
|
|
|
|
|
|
|
38
|
22
|
|
|
|
|
85
|
my $offset = $self->get_initial_offset; |
39
|
|
|
|
|
|
|
|
40
|
16
|
|
|
|
|
55
|
for my $instance ($self->instances->@*) { |
41
|
50
|
|
|
|
|
158
|
$instance->encode; |
42
|
50
|
100
|
|
|
|
158
|
if ($instance->is_dynamic) { |
43
|
14
|
|
|
|
|
56
|
$self->push_static($self->encode_offset($offset)); |
44
|
14
|
|
|
|
|
39
|
$self->push_dynamic($instance->encoded); |
45
|
14
|
|
|
|
|
48
|
$offset += scalar $instance->encoded->@*; |
46
|
14
|
|
|
|
|
59
|
next; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
36
|
|
|
|
|
98
|
$self->push_static($instance->encoded); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
16
|
|
|
|
|
49
|
return $self->encoded; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub decode { |
56
|
11
|
|
|
11
|
0
|
18
|
my $self = shift; |
57
|
|
|
|
|
|
|
|
58
|
11
|
100
|
|
|
|
32
|
unless (scalar $self->instances->@* > 0) { |
59
|
4
|
|
|
|
|
18
|
push $self->instances->@*, REFECO::Blockchain::Contract::Solidity::ABI::Type::new_type(signature => $_) for $self->split_tuple_signature->@*; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
11
|
|
|
|
|
54
|
return $self->read_stack_set_data; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub static_size { |
66
|
6
|
|
|
6
|
0
|
10
|
my $self = shift; |
67
|
6
|
50
|
|
|
|
17
|
return 1 if $self->is_dynamic; |
68
|
6
|
|
|
|
|
12
|
my $size = 1; |
69
|
6
|
|
|
|
|
12
|
my $instance_size = 0; |
70
|
6
|
|
|
|
|
17
|
for my $signature ($self->split_tuple_signature->@*) { |
71
|
12
|
|
|
|
|
34
|
my $instance = REFECO::Blockchain::Contract::Solidity::ABI::Type::new_type(signature => $signature); |
72
|
12
|
|
50
|
|
|
51
|
$instance_size += $instance->static_size // 0; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
6
|
|
|
|
|
17
|
return $size * $instance_size; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|