File Coverage

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


line stmt bran cond sub pod time code
1             package Blockchain::Ethereum::ABI::Type::Address;
2              
3 5     5   276448 use v5.26;
  5         20  
4 5     5   29 use strict;
  5         10  
  5         208  
5 5     5   27 use warnings;
  5         8  
  5         519  
6              
7             # ABSTRACT: Solidity address type interface
8             our $AUTHORITY = 'cpan:REFECO'; # AUTHORITY
9             our $VERSION = '0.021'; # VERSION
10              
11 5     5   101 use parent 'Blockchain::Ethereum::ABI::Type';
  5         14  
  5         61  
12              
13 58     58   75 sub _configure { return }
14              
15             sub encode {
16 70     70 1 78 my $self = shift;
17              
18 70 100       97 return $self->_encoded if $self->_encoded;
19 26         86 $self->_push_static($self->pad_left(substr($self->{data}, 2)));
20              
21 26         67 return $self->_encoded;
22             }
23              
24             sub decode {
25 26     26 1 31 my $self = shift;
26              
27 26         118 return '0x' . substr $self->{data}->[0], -40;
28             }
29              
30             1;
31              
32             __END__