Class: Web3::Eth::Contract::ContractConstructor

Inherits:
ContractMethod show all
Defined in:
lib/web3/eth/contract.rb

Constant Summary

Constants included from Abi::Constant

Abi::Constant::BYTE_EMPTY, Abi::Constant::BYTE_ONE, Abi::Constant::BYTE_ZERO, Abi::Constant::CONTRACT_CODE_SIZE_LIMIT, Abi::Constant::HASH_ZERO, Abi::Constant::INT_MAX, Abi::Constant::INT_MIN, Abi::Constant::PRIVKEY_ZERO, Abi::Constant::PRIVKEY_ZERO_HEX, Abi::Constant::PUBKEY_ZERO, Abi::Constant::TT160, Abi::Constant::TT256, Abi::Constant::TT32, Abi::Constant::TT40, Abi::Constant::TT64M1, Abi::Constant::UINT_MAX, Abi::Constant::UINT_MIN

Instance Attribute Summary

Attributes inherited from ContractMethod

#abi, #constant, #input_types, #name, #output_types, #signature, #signature_hash

Instance Method Summary collapse

Methods inherited from ContractMethod

#do_call, #parse_component_type, #parse_event_args

Methods included from Utility

#from_hex, #hex, #remove_0x_head, #wei_to_ether

Methods included from Abi::Utils

#base58_check_to_bytes, #big_endian_to_int, #bytearray_to_int, #bytes_to_base58_check, #bytes_to_int_array, #ceil32, #coerce_addr_to_hex, #coerce_to_bytes, #coerce_to_int, #decode_hex, #decode_int, #double_sha256, #encode_hex, #encode_int, #function_signature, #hash160, #hash160_hex, #int_array_to_bytes, #int_to_addr, #int_to_big_endian, #keccak256, #keccak256_rlp, #keccak512, #lpad, #mk_contract_address, #mk_metropolis_contract_address, #mod_exp, #mod_mul, #normalize_address, #normalize_hex_without_prefix, #parse_int_or_hex, #ripemd160, #rpad, #sha256, #signature_hash, #to_signed, #zpad, #zpad_hex, #zpad_int, #zunpad

Methods included from Abi::AbiCoder

#decode_abi, #decode_primitive_type, #decode_type, #decode_typed_data, #encode_abi, #encode_primitive_type, #encode_type, #min_data_size, #zero_padding

Constructor Details

#initialize(abi) ⇒ ContractConstructor

Returns a new instance of ContractConstructor.



108
109
110
# File 'lib/web3/eth/contract.rb', line 108

def initialize abi
  super abi
end

Instance Method Details

#parse_method_args(transaction) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# 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