class Web3::Eth::Contract::ContractConstructor
Constants
- CONSTRUCTOR_SEQ
Public Class Methods
new(abi)
click to toggle source
Calls superclass method
Web3::Eth::Contract::ContractMethod::new
# File lib/web3/eth/contract.rb, line 108 def initialize abi super abi end
Public Instance Methods
parse_method_args(transaction)
click to toggle source
# File lib/web3/eth/contract.rb, line 112 def parse_method_args transaction return [] if input_types.empty? input = transaction.input d = fetch_constructor_data input result = (d && !d.empty? && try_parse(d)) unless result start = input.length-1-min_data_size(input_types) while start>=0 && !result result = try_parse input, start start -= 1 end end result end
Private Instance Methods
fetch_constructor_data(input)
click to toggle source
# File lib/web3/eth/contract.rb, line 134 def fetch_constructor_data input data = input[CONSTRUCTOR_SEQ,1] while data && (d = data[CONSTRUCTOR_SEQ,1]) data = d end data end
try_parse(input, start = 0)
click to toggle source
# File lib/web3/eth/contract.rb, line 142 def try_parse input, start = 0 d = start==0 ? input : input.slice(start, input.length-start-1) decode_abi input_types, [d].pack('H*'), true rescue Exception => err nil end