Cartouche.Erc20.CallData (Cartouche v0.2.1)

Copy Markdown View Source

Module to encode calldata for given adaptor operations.

API Functions

FunctionArityDescriptionParam Kinds
transfer2Encode ERC-20 transfer(address,uint256) calldata.destination: value, amount_wei: value
balance_of1Encode ERC-20 balanceOf(address) calldata.address: value

Summary

Functions

Encodes the call data for a balanceOf operation.

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"