Module: ConversionFunctions

Defined in:
lib/solidity/typed/conversion.rb

Instance Method Summary collapse

Instance Method Details

#address(literal = 0) ⇒ Object

todo/check: use AddressType.try_convert( literal_or_obj ) or such - why? why not?



10
11
12
13
14
15
16
# File 'lib/solidity/typed/conversion.rb', line 10

def address( literal=0 )
    ## hack for now support  address(0) 
    ##  todo/fix:  address( '0x0' ) too!!!!
    return Types::Typed::AddressType.instance.zero   if literal.is_a?(::Integer) && literal == 0

    Types::Typed::AddressType.instance.check_and_normalize_literal( literal )
end