class Receipt

Attributes

block_number[R]

required attributes / fields

contract_address[R]

optional

from[R]

required attributes / fields

nonce[R]

required attributes / fields

to[R]

required attributes / fields

value[R]

required attributes / fields

Public Class Methods

[]( tx ) click to toggle source
# File lib/universum/receipt.rb, line 11
def self.[]( tx ) find( tx ); end
all() click to toggle source
# File lib/universum/receipt.rb, line 16
def self.all() @@directory.values; end
find( tx ) click to toggle source
# File lib/universum/receipt.rb, line 7
def self.find( tx )
   key = "#{tx.from}/#{tx.nonce}"
   @@directory[ key ];
end
new( tx:, block:, contract: nil ) click to toggle source
# File lib/universum/receipt.rb, line 25
def initialize( tx:,
                block:,
                contract: nil )
   @nonce = tx.nonce
   @from  = tx.from
   @to    = tx.to
   @value = tx.value
   ## todo/fix: add data too!!!

   @block_number    = block.number
   ## todo/fix: add block_hash

   if contract
     ## note: for easier debugging add class name in () to address (needs to get stripped away in lookup)
     @contract_address = "#{contract.address.hex} (#{contract.class.name})"
   else
     @contract_address = nil
   end
end
store( o ) click to toggle source
# File lib/universum/receipt.rb, line 13
def self.store( o )
   key = "#{o.from}/#{o.nonce}"
   @@directory.store( key, o ); end

Public Instance Methods

contract() click to toggle source
# File lib/universum/receipt.rb, line 45
def contract   # convenience helper (quick contract lookup)
  if @contract_address
    Contract.find( @contract_address )
  else
    nil
  end
end