# `Cartouche.Erc20.Call`
[🔗](https://github.com/zenhive/cartouche/blob/main/lib/cartouche/erc_20.ex#L169)

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

## API Functions
| Function | Arity | Description | Param Kinds |
| --- | --- | --- | --- |
| `transfer` | 4 | Call ERC-20 `transfer(address,uint256)` without sending a transaction. | `token: value`, `destination: value`, `amount_wei: value`, `call_opts: value` |
| `balance_of` | 3 | Call ERC-20 `balanceOf(address)` and decode the token base-unit balance. | `token: value`, `address: value`, `call_opts: value` |

# `balance_of`

```elixir
@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`

```elixir
@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, <<>>}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
