line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package REFECO::Blockchain::Contract::Solidity::ABI::Type::String; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1870
|
use v5.26; |
|
3
|
|
|
|
|
12
|
|
4
|
3
|
|
|
3
|
|
19
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
68
|
|
5
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
89
|
|
6
|
3
|
|
|
3
|
|
15
|
no indirect; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
20
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
195
|
use parent qw(REFECO::Blockchain::Contract::Solidity::ABI::Type); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
15
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub encode { |
11
|
11
|
|
|
11
|
0
|
24
|
my $self = shift; |
12
|
11
|
100
|
|
|
|
30
|
return $self->encoded if $self->encoded; |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
|
|
14
|
my $hex = unpack("H*", $self->data); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# for dynamic length basic types the length must be included |
17
|
4
|
|
|
|
|
43
|
$self->push_dynamic($self->encode_length(length(pack("H*", $hex)))); |
18
|
4
|
|
|
|
|
17
|
$self->push_dynamic($self->pad_right($hex)); |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
13
|
return $self->encoded; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub decode { |
24
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
25
|
1
|
|
|
|
|
5
|
my @data = $self->data->@*; |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
4
|
my $size = hex shift @data; |
28
|
1
|
|
|
|
|
3
|
my $string_data = join('', @data); |
29
|
1
|
|
|
|
|
9
|
my $packed_string = pack("H*", $string_data); |
30
|
1
|
|
|
|
|
7
|
return substr($packed_string, 0, $size); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|