View Source Etherex.Contract.Manager (Etherex v1.1.0)
This module provides an abstraction layer over the default Etherex contract. This abstraction allows the user to interact with contracts only using addresses and transaction hashes.
Link to this section Summary
Functions
Performs a call to a function of a deployed contract. This call does not generate a transaction in the blockchain.
Performs a call to a function of a deployed contract, This call generates a transaction in the blockchain.
Returns a specification to start this module under a supervisor.
Deploys a contract of a given type in the blockchain. This contract should be previously registered. Returns the transaction in which the contract will be deployed.
Retrieves the address of the given transaction if it is already in a mined.
Given the registered name, retrieves the contract information once compiled.
Given a transaction, retrieves the list of events logged in it for all known contracts.
Returns []
if no events. Returns nil
if transaction is pending.
Callback implementation for GenServer.init/1
.
Compiles and registers a contract in the process.
Starts the contract manager process.
Stops the contract manager process.
Link to this section Types
@type address() :: Etherex.address()
@type block_parameter() :: Etherex.block_parameter()
@type bytecode() :: Etherex.bytecode()
@type contract() :: Etherex.contract()
@type error() :: Etherex.error()
@type event() :: Etherex.event()
@type hash() :: Etherex.hash()
@type opts() :: Etherex.opts()
Link to this section Functions
@spec call( contract :: address(), caller :: address(), function :: atom(), arguments :: list(), opts() ) :: {:ok, any()} | {:error, error()}
Performs a call to a function of a deployed contract. This call does not generate a transaction in the blockchain.
call_transaction(contract, caller, function, arguments, opts \\ [])
View Source@spec call_transaction( contract :: address(), caller :: address(), function :: atom(), list(), opts() ) :: {:ok, hash()} | {:error, error()}
Performs a call to a function of a deployed contract, This call generates a transaction in the blockchain.
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec deploy(name :: atom(), caller :: address(), arguments :: list(), opts()) :: {:ok, hash()} | {:error, error()}
Deploys a contract of a given type in the blockchain. This contract should be previously registered. Returns the transaction in which the contract will be deployed.
Retrieves the address of the given transaction if it is already in a mined.
Given the registered name, retrieves the contract information once compiled.
Given a transaction, retrieves the list of events logged in it for all known contracts.
Returns []
if no events. Returns nil
if transaction is pending.
Events are not returned in order.
@spec init([]) :: {:ok, state()}
Callback implementation for GenServer.init/1
.
Compiles and registers a contract in the process.
@spec start() :: {:ok, pid()}
Starts the contract manager process.
Stops the contract manager process.