Class: Contract
Constant Summary collapse
- @@directory =
{}
Class Method Summary collapse
- .[](key) ⇒ Object
- .all ⇒ Object
-
.at(key) ⇒ Object
another “classic” alias for find_by_address.
-
.find(key) ⇒ Object
make find_by_address the default finder.
- .find_by_address(key) ⇒ Object
-
.payable(*args) ⇒ Object
function sig(nature) macro for types (dummy for now) e.g.
-
.store(key, o) ⇒ Object
store (add) new contract object (o) to hash / directory.
Instance Method Summary collapse
- #assert(condition) ⇒ Object
- #block ⇒ Object
- #blockhash(number) ⇒ Object
- #log(event) ⇒ Object
- #msg ⇒ Object
-
#receive ⇒ Object
todo/double check: auto-add payable default fallback - why? why not?.
-
#this ⇒ Object
returns current contract.
Methods included from Address
#_add, #_sub, #address, #balance, #send, #transfer, zero
Class Method Details
.[](key) ⇒ Object
198 |
# File 'lib/universum/universum.rb', line 198 def self.[]( key ) find_by_address( key ); end |
.all ⇒ Object
201 |
# File 'lib/universum/universum.rb', line 201 def self.all() @@directory.values; end |
.at(key) ⇒ Object
another “classic” alias for find_by_address
197 |
# File 'lib/universum/universum.rb', line 197 def self.at( key) find_by_address( key ); end |
.find(key) ⇒ Object
make find_by_address the default finder
196 |
# File 'lib/universum/universum.rb', line 196 def self.find( key ) find_by_address( key ); end |
.find_by_address(key) ⇒ Object
191 192 193 194 195 |
# File 'lib/universum/universum.rb', line 191 def self.find_by_address( key ) ## clean key (allow "embedded" class name e.g 0x4de2ee8 (SatoshiDice)) key = key.gsub(/\(.+\)/, '' ).strip @@directory[ key ]; end |
.payable(*args) ⇒ Object
215 |
# File 'lib/universum/universum.rb', line 215 def self.payable( *args ); end |
.store(key, o) ⇒ Object
store (add) new contract object (o) to hash / directory
200 |
# File 'lib/universum/universum.rb', line 200 def self.store( key, o ) @@directory.store( key, o ); end |
Instance Method Details
#assert(condition) ⇒ Object
225 226 227 228 229 230 231 |
# File 'lib/universum/universum.rb', line 225 def assert( condition ) if condition == true ## do nothing else raise 'Contract Assertion Failed; Contract Halted (Stopped)' end end |
#blockhash(number) ⇒ Object
238 239 240 241 |
# File 'lib/universum/universum.rb', line 238 def blockhash( number ) ## todo/fix: only allow going back 255 blocks; check if number is in range!!! Universum.blockhash( number ) end |
#log(event) ⇒ Object
235 |
# File 'lib/universum/universum.rb', line 235 def log( event ) Universum.log( event ); end |
#receive ⇒ Object
todo/double check: auto-add payable default fallback - why? why not?
221 222 |
# File 'lib/universum/universum.rb', line 221 def receive ## @payable default fallback - use different name - why? why not? (e.g. handle/process/etc.) end |