Module: ConversionFunctions
- Defined in:
- lib/solidity/typed/conversion.rb
Instance Method Summary collapse
-
#address(obj) ⇒ Object
todo/check: use AddressType.try_convert( literal_or_obj ) or such - why? why not?.
- #bytes(obj) ⇒ Object (also: #bytes4)
- #uint(obj) ⇒ Object (also: #uint256, #uint224, #uint112)
Instance Method Details
#address(obj) ⇒ Object
todo/check: use AddressType.try_convert( literal_or_obj ) or such - why? why not?
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/solidity/typed/conversion.rb', line 10 def address( obj ) ## hack for now support address(0) ## todo/fix: address( '0x0' ) too!!!! return Types::Address.zero if obj.is_a?(::Integer) && obj == 0 ## note: for now assume contract is always "construct"ed (and, thus, has an address assigned) return Types::Address.new( obj.__address__ ) if obj.is_a?( Contract ) Types::Address.new( obj ) end |