class Web3::Eth::Debug::TransactionCallTrace
Attributes
calls[R]
parent[R]
raw_data[R]
traceAddress[R]
Public Class Methods
new(raw, traceAddress = [], parent = nil)
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 8 def initialize raw, traceAddress = [], parent = nil @raw_data = raw @traceAddress = traceAddress @parent = parent @calls = raw['calls'] ? raw['calls'].each_with_index.map{|c,i| TransactionCallTrace.new c, (traceAddress + [i]), self } : [] end
Public Instance Methods
action()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 20 def action { 'callType' => type.downcase, 'address' => ( suicide? ? parent.smart_contract : raw_data['to']) } 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/eth/debug/transaction_call_trace.rb, line 93 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/eth/debug/transaction_call_trace.rb, line 31 def creates (type=='CREATE' || type=='CREATE2') ? to : nil end
error()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 83 def error raw_data['error'] end
from()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 47 def from raw_data['from'] end
gas()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 63 def gas from_hex raw_data['gas'] end
gas_used()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 67 def gas_used from_hex raw_data['gasUsed'] end
input()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 71 def input raw_data['input'] end
method_hash()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 35 def method_hash if input && input.length>=10 input[2...10] else nil end end
output()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 75 def output raw_data['output'] end
smart_contract()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 27 def smart_contract ['STATICCALL','CALL'].include?(type) ? to : from end
success?()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 87 def success? !raw_data['error'] end
suicide?()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 43 def suicide? type=='SELFDESTRUCT' end
time()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 79 def time raw_data['time'] end
to()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 51 def to raw_data['to'] end
type()
click to toggle source
CALL STATICCALL DELEGATECALL CREATE SELFDESTRUCT
# File lib/web3/eth/debug/transaction_call_trace.rb, line 16 def type raw_data['type'] end
value_eth()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 59 def value_eth wei_to_ether value_wei end
value_wei()
click to toggle source
# File lib/web3/eth/debug/transaction_call_trace.rb, line 55 def value_wei from_hex raw_data['value'] end