View Source Signet.Erc20 (Signet v1.3.8)

A wrapper for an ERC-20 contract, allowing the code to interact by pulling data from the contract, or sending transaction to it.

Summary

Functions

Returns a list of known error codes (ABI signatures), which can be used when parsing error messages from contract calls.

Types

@type call_opts() :: nil
@type exec_opts() :: {:signer, atom()} | call_opts()

Functions

Link to this function

call_trx(token, call_data, call_opts)

View Source
@spec call_trx(Signet.contract(), binary(), [call_opts()]) :: term()
@spec errors() :: [String.t()]

Returns a list of known error codes (ABI signatures), which can be used when parsing error messages from contract calls.

Link to this function

exec_trx(token, call_data, exec_opts)

View Source
@spec exec_trx(Signet.contract(), binary(), [exec_opts()]) :: term()
Link to this function

transfer(token, destination, amount_wei, exec_opts \\ [])

View Source
@spec transfer(Signet.contract(), Signet.address(), non_neg_integer(), [exec_opts()]) ::
  {:ok, binary()} | {:error, term()}

Executes a transfer transaction.

Arguments:

  • destination: The destination address
  • amount_wei: The amount, in token wei, to transfer.
  • exec_opts: Execution options, such as the gas price for the transaction.

Examples

iex> {:ok, _trx_id} = Signet.Erc20.transfer(<<0xCC>>, <<0xDD>>, 100_000)