class Web3::Hpb::CallTrace
Attributes
raw_data[R]
Public Class Methods
new(trace_data)
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 10 def initialize trace_data @raw_data = trace_data trace_data.each do |k, v| self.instance_variable_set("@#{k}", v) self.class.send(:define_method, k, proc {self.instance_variable_get("@#{k}")}) end end
Public Instance Methods
balance_hpb()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 77 def balance_hpb wei_to_hpb action['balance'].to_i(16) end
call_input_data()
click to toggle source
suffix # 0xa1 0x65 'b' 'z' 'z' 'r' '0' 0x58 0x20 <32 bytes swarm hash> 0x00 0x29 look solidity.readthedocs.io/en/latest/metadata.html for details
# File lib/web3/hpb/call_trace.rb, line 62 def call_input_data if creates && input input[/a165627a7a72305820\w{64}0029(\w*)/,1] elsif input && input.length>10 input[10..input.length] else [] end end
creates()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 56 def creates action && result && action['init'] && result['address'] end
from()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 28 def from action['from'] end
gas_used()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 44 def gas_used result && from_hex(result['gasUsed']) end
input()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 36 def input action['input'] || action['init'] end
method_hash()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 48 def method_hash if input && input.length>=10 input[2...10] else nil end end
output()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 40 def output result && result['output'] end
success?()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 81 def success? !raw_data['error'] end
suicide?()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 73 def suicide? type=='suicide' end
to()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 32 def to action['to'] end
value_hpb()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 24 def value_hpb wei_to_hpb from_hex action['value'] end
value_wei()
click to toggle source
# File lib/web3/hpb/call_trace.rb, line 20 def value_wei from_hex action['value'] end