Search documentation of Cartouche

# Cartouche.Erc20.Call (Cartouche v0.1.2)

Copy Markdown View Source

Module to call operations and receive return value, without sending a transaction.

## Summary

### Functions

balance_of(token, address, call_opts \\ [])

Calls the `balanceOf` operation, returning the result of the Ethereum function call.

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

Calls the `transfer` operation, returning the result of the Ethereum function call.

## Functions

# balance_of(token, address, call_opts \\ [])

    @spec balance_of(
      Cartouche.contract(),
      Cartouche.address(),
      Cartouche.Erc20.call_opts()
    ) ::
      {:ok, number()} | {:error, term()}

Calls the `balanceOf` operation, returning the result of the Ethereum function call.

## Examples

    iex> Cartouche.Erc20.Call.balance_of(<<0xCC>>, <<0xDD>>)
    {:ok, <<>>}

# transfer(token, destination, amount_wei, call_opts \\ [])

    @spec transfer(
      Cartouche.contract(),
      Cartouche.address(),
      non_neg_integer(),
      Cartouche.Erc20.call_opts()
    ) :: {:ok, binary()} | {:error, term()}

Calls the `transfer` operation, returning the result of the Ethereum function call.

## Examples

    iex> Cartouche.Erc20.Call.transfer(<<0xCC>>, <<0xDD>>, 100_000)
    {:ok, <<>>}