ERC20s

Note

functions that require multiple RPC calls will attempt to do so concurrently for maximum efficiency

Examples

erc20s

Reference

async ctc.evm.async_get_erc20_balance_of(address, token, block=None, normalize=True, provider=None, **rpc_kwargs)
Parameters
  • address (<class 'str'>) –

  • token (<class 'str'>) –

  • block (Union[SupportsRound, str, int, Literal['latest'], Literal['earliest'], Literal['pending'], NoneType]) –

  • normalize (<class 'bool'>) –

  • provider (Union[str, PartialProvider, Provider, NoneType]) –

  • rpc_kwargs (Any) –

Return type

Union[int, float]

async ctc.evm.async_get_erc20_balance_of_addresses(addresses, token, block=None, normalize=True, provider=None, **rpc_kwargs)
async ctc.evm.async_get_erc20_balance_of_by_block(address, token, blocks, normalize=True, provider=None, empty_token=0, **rpc_kwargs)
async ctc.evm.async_get_erc20_decimals(token, block=None, **rpc_kwargs)

get decimals of an erc20

Parameters
  • token (<class 'str'>) –

  • block (Union[SupportsRound, str, int, Literal['latest'], Literal['earliest'], Literal['pending'], NoneType]) –

  • rpc_kwargs (Any) –

Return type

<class ‘int’>

async ctc.evm.async_get_erc20_holdings_from_transfers(transfers, block=None, dtype=None, normalize=False)
Parameters
  • transfers (Any) –

  • block (Union[SupportsRound, str, int, Literal['latest'], Literal['earliest'], Literal['pending'], NoneType]) –

  • dtype (Union[Type[int], Type[float], NoneType]) –

  • normalize (<class 'bool'>) –

Return type

Any

async ctc.evm.async_get_erc20_name(token, block=None, **rpc_kwargs)

get name of an erc20

Parameters
  • token (<class 'str'>) –

  • block (Union[SupportsRound, str, int, Literal['latest'], Literal['earliest'], Literal['pending'], NoneType]) –

  • rpc_kwargs (Any) –

Return type

<class ‘str’>

async ctc.evm.async_get_erc20_symbol(token, block=None, **rpc_kwargs)

get symbol of an erc20

Parameters
  • token (<class 'str'>) –

  • block (Union[SupportsRound, str, int, Literal['latest'], Literal['earliest'], Literal['pending'], NoneType]) –

  • rpc_kwargs (Any) –

Return type

<class ‘str’>

async ctc.evm.async_get_erc20_total_supply(token, block=None, normalize=True, provider=None, **rpc_kwargs)
Parameters
  • token (<class 'str'>) –

  • block (Union[SupportsRound, str, int, Literal['latest'], Literal['earliest'], Literal['pending'], NoneType]) –

  • normalize (<class 'bool'>) –

  • provider (Union[str, PartialProvider, Provider, NoneType]) –

  • rpc_kwargs (Any) –

Return type

Union[int, float]

async ctc.evm.async_get_erc20_total_supply_by_block(token, blocks, normalize=True, provider=None, **rpc_kwargs)
async ctc.evm.async_get_erc20_transfers(token_address, start_block=None, end_block=None, normalize=True, convert_from_str=True, **event_kwargs)
Parameters
  • token_address (<class 'str'>) –

  • start_block (Union[SupportsRound, str, int, Literal['latest'], Literal['earliest'], Literal['pending'], NoneType]) –

  • end_block (Union[SupportsRound, str, int, Literal['latest'], Literal['earliest'], Literal['pending'], NoneType]) –

  • normalize (<class 'bool'>) –

  • convert_from_str (<class 'bool'>) –

  • event_kwargs (Any) –

Return type

Any

async ctc.evm.async_get_erc20s_balance_of(address, tokens, block=None, normalize=True, provider=None, **rpc_kwargs)
async ctc.evm.async_get_erc20s_decimals(tokens, block=None, **rpc_kwargs)

get decimals of multiple erc20s

async ctc.evm.async_get_erc20s_names(tokens, block=None, **rpc_kwargs)

get name of multiple erc20s

async ctc.evm.async_get_erc20s_symbols(tokens, block=None, **rpc_kwargs)

get symbol of multiple erc20s

async ctc.evm.async_get_erc20s_total_supplies(tokens, block=None, normalize=True, provider=None, **rpc_kwargs)
async ctc.evm.async_normalize_erc20_quantities(quantities, token=None, provider=None, decimals=None, block=None)
Parameters
  • quantities (Sequence[SupportsInt] | Series) –

  • token (ERC20Address | None) –

  • provider (ProviderSpec) –

  • decimals (Optional[SupportsInt]) –

  • block (Optional[BlockNumberReference]) –

Return type

list[float]

async ctc.evm.async_normalize_erc20_quantity(quantity, token=None, provider=None, decimals=None, block=None)

convert raw erc20 quantity by adjusting radix by (10 ** decimals)

Parameters
  • quantity (<class 'SupportsFloat'>) –

  • token (Union[str, NoneType]) –

  • provider (Union[str, PartialProvider, Provider, NoneType]) –

  • decimals (Union[SupportsInt, NoneType]) –

  • block (Union[SupportsRound, str, int, Literal['latest'], Literal['earliest'], Literal['pending'], NoneType]) –

Return type

<class ‘float’>