View Source Ethers.Contracts.ERC20 (Ethers v0.0.3)

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.

Prepares contract constructor values.

Executes decimals() on the contract.

Default address of the contract. Returns nil if not specified.

Executes name() on the contract.

Same as name/1 but raises Ethers.ExecutionError on errors.

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
@spec allowance(Ethers.Types.t_address(), Ethers.Types.t_address(), Keyword.t()) ::
  {:ok, [non_neg_integer()]}
  | {:ok, Ethers.Types.t_hash()}
  | {:ok, Ethers.Contract.t_function_output()}
  | {:error, term()}

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

Default action for this function is :call. To override default action see Execution Options in Ethers.Contract.

parameters

Parameters

  • _owner: :address
  • _spender: :address
  • overrides: Overrides and options for the call. See Execution Options in Ethers.Contract.

return-types

Return Types

  • {:uint, 256}
Link to this function

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

View Source

Same as allowance/3 but raises Ethers.ExecutionError on errors.

Link to this function

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

View Source
@spec approve(Ethers.Types.t_address(), non_neg_integer(), Keyword.t()) ::
  {:ok, [boolean()]}
  | {:ok, Ethers.Types.t_hash()}
  | {:ok, Ethers.Contract.t_function_output()}
  | {:error, term()}

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

Default action for this function is :send. To override default action see Execution Options in Ethers.Contract.

parameters

Parameters

  • _spender: :address
  • _value: {:uint, 256}
  • overrides: Overrides and options for the call. See Execution Options in Ethers.Contract.

return-types

Return Types

  • :bool
Link to this function

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

View Source

Same as approve/3 but raises Ethers.ExecutionError on errors.

Link to this function

balance_of(owner, overrides \\ [])

View Source
@spec balance_of(Ethers.Types.t_address(), Keyword.t()) ::
  {:ok, [non_neg_integer()]}
  | {:ok, Ethers.Types.t_hash()}
  | {:ok, Ethers.Contract.t_function_output()}
  | {:error, term()}

Executes balanceOf(address _owner) on the contract.

Default action for this function is :call. To override default action see Execution Options in Ethers.Contract.

parameters

Parameters

  • _owner: :address
  • overrides: Overrides and options for the call. See Execution Options in Ethers.Contract.

return-types

Return Types

  • {:uint, 256}
Link to this function

balance_of!(owner, overrides \\ [])

View Source

Same as balance_of/2 but raises Ethers.ExecutionError on errors.

@spec constructor() :: binary()

Prepares contract constructor values.

To deploy a contracts see Ethers.deploy/3.

parameters

Parameters

Link to this function

decimals(overrides \\ [])

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

Executes decimals() on the contract.

Default action for this function is :call. To override default action see Execution Options in Ethers.Contract.

parameters

Parameters

  • overrides: Overrides and options for the call. See Execution Options in Ethers.Contract.

return-types

Return Types

  • {:uint, 8}
Link to this function

decimals!(overrides \\ [])

View Source

Same as decimals/1 but raises Ethers.ExecutionError on errors.

@spec default_address() :: Ethers.Types.t_address() | nil

Default address of the contract. Returns nil if not specified.

To specify a default address see Ethers.Contract

@spec name(Keyword.t()) ::
  {:ok, [String.t()]}
  | {:ok, Ethers.Types.t_hash()}
  | {:ok, Ethers.Contract.t_function_output()}
  | {:error, term()}

Executes name() on the contract.

Default action for this function is :call. To override default action see Execution Options in Ethers.Contract.

parameters

Parameters

  • overrides: Overrides and options for the call. See Execution Options in Ethers.Contract.

return-types

Return Types

  • :string

Same as name/1 but raises Ethers.ExecutionError on errors.

@spec symbol(Keyword.t()) ::
  {:ok, [String.t()]}
  | {:ok, Ethers.Types.t_hash()}
  | {:ok, Ethers.Contract.t_function_output()}
  | {:error, term()}

Executes symbol() on the contract.

Default action for this function is :call. To override default action see Execution Options in Ethers.Contract.

parameters

Parameters

  • overrides: Overrides and options for the call. See Execution Options in Ethers.Contract.

return-types

Return Types

  • :string
Link to this function

symbol!(overrides \\ [])

View Source

Same as symbol/1 but raises Ethers.ExecutionError on errors.

Link to this function

total_supply(overrides \\ [])

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

Executes totalSupply() on the contract.

Default action for this function is :call. To override default action see Execution Options in Ethers.Contract.

parameters

Parameters

  • overrides: Overrides and options for the call. See Execution Options in Ethers.Contract.

return-types

Return Types

  • {:uint, 256}
Link to this function

total_supply!(overrides \\ [])

View Source

Same as total_supply/1 but raises Ethers.ExecutionError on errors.

Link to this function

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

View Source
@spec transfer(Ethers.Types.t_address(), non_neg_integer(), Keyword.t()) ::
  {:ok, [boolean()]}
  | {:ok, Ethers.Types.t_hash()}
  | {:ok, Ethers.Contract.t_function_output()}
  | {:error, term()}

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

Default action for this function is :send. To override default action see Execution Options in Ethers.Contract.

parameters

Parameters

  • _to: :address
  • _value: {:uint, 256}
  • overrides: Overrides and options for the call. See Execution Options in Ethers.Contract.

return-types

Return Types

  • :bool
Link to this function

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

View Source

Same as transfer/3 but raises Ethers.ExecutionError on errors.

Link to this function

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

View Source
@spec transfer_from(
  Ethers.Types.t_address(),
  Ethers.Types.t_address(),
  non_neg_integer(),
  Keyword.t()
) ::
  {:ok, [boolean()]}
  | {:ok, Ethers.Types.t_hash()}
  | {:ok, Ethers.Contract.t_function_output()}
  | {:error, term()}

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

Default action for this function is :send. To override default action see Execution Options in Ethers.Contract.

parameters

Parameters

  • _from: :address
  • _to: :address
  • _value: {:uint, 256}
  • overrides: Overrides and options for the call. See Execution Options in Ethers.Contract.

return-types

Return Types

  • :bool
Link to this function

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

View Source

Same as transfer_from/4 but raises Ethers.ExecutionError on errors.