Search documentation of Cartouche

# Cartouche.Erc20.CallData (Cartouche v0.1.3)

Copy Markdown View Source

Module to encode `calldata` for given adaptor operations.

## Summary

### Functions

balance_of(address)

Encodes the call data for a `balanceOf` operation.

transfer(destination, amount_wei)

Encodes the call data for a `transfer` operation.

## Functions

# balance_of(address)

    @spec balance_of(Cartouche.address()) :: binary()

Encodes the call data for a `balanceOf` operation.

## Examples

    iex> Cartouche.Erc20.CallData.balance_of(<<0xDD>>) |> Cartouche.Hex.encode_hex()
    "0x"

# transfer(destination, amount_wei)

    @spec transfer(Cartouche.address(), non_neg_integer()) :: binary()

Encodes the call data for a `transfer` operation.

## Examples

    iex> Cartouche.Erc20.CallData.transfer(<<0xDD>>, 100_000)
    ...> |> Cartouche.Hex.encode_hex()
    "0x8035f0ce"