View Source Ethers.Contract.ERC20 (Ethers v0.0.1-dev)

ERC20 token interface

More info: https://ethereum.org/en/developers/docs/standards/tokens/erc-20/

Link to this section Summary

Functions

Executes allowance(address _owner, address _spender) on the contract.

Executes approve(address _spender, uint256 _value) on the contract.

Executes balanceOf(address _owner) on the contract.

Executes decimals() on the contract.

Executes name() on the contract.

Executes symbol() on the contract.

Executes totalSupply() on the contract.

Executes transfer(address _to, uint256 _value) on the contract.

Executes transferFrom(address _from, address _to, uint256 _value) on the contract.

Link to this section Functions

Link to this function

allowance(owner, spender, overrides \\ [])

View Source

Executes allowance(address _owner, address _spender) on the contract.

parameters

Parameters

  • _owner: :address
  • _spender: :address
  • overrides: Overrides and options for the call.
    • :to: The address of the recipient contract. (Required)
    • :action: Type of action for this function (:call, :send or :prepare) Default: :call.
    • :rpc_opts: Options to pass to the RCP client e.g. :url.

return-types

Return Types

  • {:uint, 256}
Link to this function

approve(spender, value, overrides \\ [])

View Source

Executes approve(address _spender, uint256 _value) on the contract.

parameters

Parameters

  • _spender: :address
  • _value: {:uint, 256}
  • overrides: Overrides and options for the call.
    • :to: The address of the recipient contract. (Required)
    • :action: Type of action for this function (:call, :send or :prepare) Default: :send.
    • :rpc_opts: Options to pass to the RCP client e.g. :url.

return-types

Return Types

  • :bool
Link to this function

balance_of(owner, overrides \\ [])

View Source

Executes balanceOf(address _owner) on the contract.

parameters

Parameters

  • _owner: :address
  • overrides: Overrides and options for the call.
    • :to: The address of the recipient contract. (Required)
    • :action: Type of action for this function (:call, :send or :prepare) Default: :call.
    • :rpc_opts: Options to pass to the RCP client e.g. :url.

return-types

Return Types

  • {:uint, 256}
Link to this function

decimals(overrides \\ [])

View Source
@spec decimals(Keyword.t()) ::
  {:ok, [non_neg_integer()]}
  | {:ok, Ethers.Types.t_transaction_hash()}
  | {:ok, Ethers.Contract.t_function_output()}

Executes decimals() on the contract.

parameters

Parameters

  • overrides: Overrides and options for the call.
    • :to: The address of the recipient contract. (Required)
    • :action: Type of action for this function (:call, :send or :prepare) Default: :call.
    • :rpc_opts: Options to pass to the RCP client e.g. :url.

return-types

Return Types

  • {:uint, 8}
@spec name(Keyword.t()) ::
  {:ok, [String.t()]}
  | {:ok, Ethers.Types.t_transaction_hash()}
  | {:ok, Ethers.Contract.t_function_output()}

Executes name() on the contract.

parameters

Parameters

  • overrides: Overrides and options for the call.
    • :to: The address of the recipient contract. (Required)
    • :action: Type of action for this function (:call, :send or :prepare) Default: :call.
    • :rpc_opts: Options to pass to the RCP client e.g. :url.

return-types

Return Types

  • :string
@spec symbol(Keyword.t()) ::
  {:ok, [String.t()]}
  | {:ok, Ethers.Types.t_transaction_hash()}
  | {:ok, Ethers.Contract.t_function_output()}

Executes symbol() on the contract.

parameters

Parameters

  • overrides: Overrides and options for the call.
    • :to: The address of the recipient contract. (Required)
    • :action: Type of action for this function (:call, :send or :prepare) Default: :call.
    • :rpc_opts: Options to pass to the RCP client e.g. :url.

return-types

Return Types

  • :string
Link to this function

total_supply(overrides \\ [])

View Source
@spec total_supply(Keyword.t()) ::
  {:ok, [non_neg_integer()]}
  | {:ok, Ethers.Types.t_transaction_hash()}
  | {:ok, Ethers.Contract.t_function_output()}

Executes totalSupply() on the contract.

parameters

Parameters

  • overrides: Overrides and options for the call.
    • :to: The address of the recipient contract. (Required)
    • :action: Type of action for this function (:call, :send or :prepare) Default: :call.
    • :rpc_opts: Options to pass to the RCP client e.g. :url.

return-types

Return Types

  • {:uint, 256}
Link to this function

transfer(to, value, overrides \\ [])

View Source

Executes transfer(address _to, uint256 _value) on the contract.

parameters

Parameters

  • _to: :address
  • _value: {:uint, 256}
  • overrides: Overrides and options for the call.
    • :to: The address of the recipient contract. (Required)
    • :action: Type of action for this function (:call, :send or :prepare) Default: :send.
    • :rpc_opts: Options to pass to the RCP client e.g. :url.

return-types

Return Types

  • :bool
Link to this function

transfer_from(from, to, value, overrides \\ [])

View Source

Executes transferFrom(address _from, address _to, uint256 _value) on the contract.

parameters

Parameters

  • _from: :address
  • _to: :address
  • _value: {:uint, 256}
  • overrides: Overrides and options for the call.
    • :to: The address of the recipient contract. (Required)
    • :action: Type of action for this function (:call, :send or :prepare) Default: :send.
    • :rpc_opts: Options to pass to the RCP client e.g. :url.

return-types

Return Types

  • :bool