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