Method: Types::Address#send
- Defined in:
- lib/soliscript/simulacrum.rb
#send(value) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/soliscript/simulacrum.rb', line 125 def send( value ) ## note: always use simple string in account lookup!!! from = Account[ Simulacrum.msg.sender.as_data ] to = _account ## check for more datatypes or (simply) use to_int or to_i - why? why not? value = value.is_a?( UInt ) ? value.as_data : value ## check for below 0 - why? why not? if value > from.balance raise ArgumentError, "insufficent funds - account has #{from.balance} and required min. #{value}; sorry" end from.balance -= value to.balance += value end |