File Coverage

blib/lib/Blockchain/Ethereum/ABI/Type/Address.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 31 31 100.0


line stmt bran cond sub pod time code
1             package Blockchain::Ethereum::ABI::Type::Address;
2              
3 3     3   1807 use v5.26;
  3         11  
4 3     3   51 use strict;
  3         7  
  3         76  
5 3     3   15 use warnings;
  3         6  
  3         99  
6              
7 3     3   17 use Carp;
  3         7  
  3         213  
8 3     3   19 use parent qw(Blockchain::Ethereum::ABI::Type);
  3         6  
  3         47  
9              
10             sub encode {
11 16     16 1 22 my $self = shift;
12 16 100       38 return $self->_encoded if $self->_encoded;
13 8         24 $self->_push_static($self->pad_left(substr($self->_data, 2)));
14              
15 8         29 return $self->_encoded;
16             }
17              
18             sub decode {
19 8     8 1 14 my $self = shift;
20 8         17 return '0x' . substr $self->_data->[0], -40;
21             }
22              
23             1;
24              
25             __END__