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   1769 use v5.26;
  3         13  
4 3     3   19 use strict;
  3         6  
  3         66  
5 3     3   15 use warnings;
  3         7  
  3         73  
6 3     3   15 no indirect;
  3         6  
  3         24  
7              
8 3     3   166 use Carp;
  3         8  
  3         227  
9 3     3   21 use parent qw(Blockchain::Contract::Solidity::ABI::Type);
  3         6  
  3         21  
10              
11             sub encode {
12 16     16 0 32 my $self = shift;
13 16 100       38 return $self->encoded if $self->encoded;
14 8         29 $self->push_static($self->pad_left(substr($self->data, 2)));
15              
16 8         27 return $self->encoded;
17             }
18              
19             sub decode {
20 8     8 0 14 my $self = shift;
21 8         22 return '0x' . substr $self->data->[0], -40;
22             }
23              
24             1;
25