File Coverage

blib/lib/Blockchain/Contract/Solidity/ABI/Type/Address.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 8 8 100.0
pod 0 2 0.0
total 33 35 94.2


line stmt bran cond sub pod time code
1             package Blockchain::Contract::Solidity::ABI::Type::Address;
2              
3 3     3   1709 use v5.26;
  3         12  
4 3     3   17 use strict;
  3         7  
  3         67  
5 3     3   14 use warnings;
  3         7  
  3         71  
6 3     3   14 no indirect;
  3         6  
  3         16  
7              
8 3     3   168 use Carp;
  3         7  
  3         223  
9 3     3   20 use parent qw(Blockchain::Contract::Solidity::ABI::Type);
  3         6  
  3         17  
10              
11             sub encode {
12 16     16 0 31 my $self = shift;
13 16 100       40 return $self->encoded if $self->encoded;
14 8         42 $self->push_static($self->pad_left(substr($self->data, 2)));
15              
16 8         28 return $self->encoded;
17             }
18              
19             sub decode {
20 8     8 0 14 my $self = shift;
21 8         21 return '0x' . substr $self->data->[0], -40;
22             }
23              
24             1;
25