Etherex.Contract (Etherex v1.0.0-rc18) View Source

Types and functions related to bytecode and contracts.

Link to this section Summary

Types

Bytecode and specification of a contract.

Data of the instance of a contract deployed in a blockchain.

Functions

See Etherex.compile_solidity/1.

Given a contract, returns its address if the creation transaction has already been mined.

Given a contract, returns its deployed bytecode.

Given a contract, returns the contract creation transaction hash.

Given a contract, returns its creator address.

See Etherex.get_events/2.

Link to this section Types

Specs

bytecode() :: %{code: String.t(), interface: [ABI.FunctionSelector.t()]}

Bytecode and specification of a contract.

Specs

contract()

Data of the instance of a contract deployed in a blockchain.

Link to this section Functions

Link to this function

call(contract, caller, function, arguments, block_or_opts \\ :latest, opts \\ [])

View Source

Specs

call(
  contract :: contract(),
  caller :: Etherex.Type.address(),
  function :: String.t(),
  arguments :: list(),
  block_or_opts :: Etherex.Type.block_parameter() | Etherex.Type.opts(),
  opts :: Etherex.Type.opts()
) :: {:ok, any()} | {:error, Etherex.Type.error()}

See Etherex.call/5

Link to this function

call_transaction(contract, caller, function, arguments, opts \\ [])

View Source

Specs

call_transaction(
  contract :: contract(),
  caller :: Etherex.Type.address(),
  function :: String.t(),
  arguments :: list(),
  opts :: Etherex.Type.opts()
) :: {:ok, Etherex.Type.hash()} | {:error, Etherex.Type.error()}

Seel Etherex.call_transaction/4.

Link to this function

compile_solidity(source_or_filename)

View Source

Specs

compile_solidity(String.t()) ::
  {:ok, bytecode()} | {:error, Etherex.Type.error()}

See Etherex.compile_solidity/1.

Link to this function

deploy(bytecode, creator, arguments, opts \\ [])

View Source

Specs

deploy(
  bytecode :: bytecode(),
  creator :: Etherex.Type.address(),
  arguments :: list(),
  opts :: Keyword.t()
) :: {:ok, contract()} | {:error, Etherex.Type.error()}

See Etherex.deploy/3.

Link to this function

estimate_gas(contract, caller, function, arguments, opts \\ [])

View Source

Specs

estimate_gas(
  contract :: contract(),
  caller :: Etherex.Type.address(),
  function :: String.t(),
  arguments :: list(),
  opts :: Etherex.Type.opts()
) :: {:ok, Etherex.Type.quantity()} | {:error, Etherex.Type.error()}

See Etherex.estimate_gas/4.

Specs

get_address(contract()) ::
  {:ok, Etherex.Type.address() | nil} | {:error, Etherex.Type.error()}

Given a contract, returns its address if the creation transaction has already been mined.

Specs

get_bytecode(contract()) :: bytecode()

Given a contract, returns its deployed bytecode.

Link to this function

get_constructor_spec(bytecode)

View Source

Specs

get_constructor_spec(bytecode()) :: ABI.FunctionSelector.t() | nil
Link to this function

get_contract_address(hash)

View Source

Specs

get_contract_address(Etherex.Type.hash()) ::
  {:ok, Etherex.Type.address() | nil} | {:error, Etherex.Type.error()}

Specs

get_creation_hash(contract()) :: Etherex.Type.hash()

Given a contract, returns the contract creation transaction hash.

Specs

get_creator(contract()) :: Etherex.Type.address()

Given a contract, returns its creator address.

Link to this function

get_event_specs(bytecode)

View Source

Specs

get_event_specs(bytecode()) :: [ABI.FunctionSelector.t()]
Link to this function

get_events(contract, hash)

View Source

Specs

get_events(contract :: contract(), hash :: Etherex.Type.hash()) ::
  {:ok, [Etherex.Type.event()]}

See Etherex.get_events/2.

Link to this function

get_function_spec(bytecode, name)

View Source

Specs

get_function_spec(bytecode(), String.t()) :: ABI.FunctionSelector.t() | nil