View Source Ethers.Contracts.ERC20 (Ethers v0.0.2)
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.
Same as allowance/3
but raises Ethers.ExecutionError
on errors.
Executes approve(address _spender, uint256 _value)
on the contract.
Same as approve/3
but raises Ethers.ExecutionError
on errors.
Executes balanceOf(address _owner)
on the contract.
Same as balance_of/2
but raises Ethers.ExecutionError
on errors.
Prepares contract constructor values.
Executes decimals()
on the contract.
Same as decimals/1
but raises Ethers.ExecutionError
on errors.
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.
Same as symbol/1
but raises Ethers.ExecutionError
on errors.
Executes totalSupply()
on the contract.
Same as total_supply/1
but raises Ethers.ExecutionError
on errors.
Executes transfer(address _to, uint256 _value)
on the contract.
Same as transfer/3
but raises Ethers.ExecutionError
on errors.
Executes transferFrom(address _from, address _to, uint256 _value)
on the contract.
Same as transfer_from/4
but raises Ethers.ExecutionError
on errors.
Link to this section Functions
@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}
@spec allowance!(Ethers.Types.t_address(), Ethers.Types.t_address(), Keyword.t()) :: [non_neg_integer()] | Ethers.Types.t_hash() | Ethers.Contract.t_function_output() | no_return()
Same as allowance/3
but raises Ethers.ExecutionError
on errors.
@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
@spec approve!(Ethers.Types.t_address(), non_neg_integer(), Keyword.t()) :: [boolean()] | Ethers.Types.t_hash() | Ethers.Contract.t_function_output() | no_return()
Same as approve/3
but raises Ethers.ExecutionError
on errors.
@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}
@spec balance_of!(Ethers.Types.t_address(), Keyword.t()) :: [non_neg_integer()] | Ethers.Types.t_hash() | Ethers.Contract.t_function_output() | no_return()
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
@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}
@spec decimals!(Keyword.t()) :: [non_neg_integer()] | Ethers.Types.t_hash() | Ethers.Contract.t_function_output() | no_return()
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
@spec name!(Keyword.t()) :: [String.t()] | Ethers.Types.t_hash() | Ethers.Contract.t_function_output() | no_return()
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
@spec symbol!(Keyword.t()) :: [String.t()] | Ethers.Types.t_hash() | Ethers.Contract.t_function_output() | no_return()
Same as symbol/1
but raises Ethers.ExecutionError
on errors.
@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}
@spec total_supply!(Keyword.t()) :: [non_neg_integer()] | Ethers.Types.t_hash() | Ethers.Contract.t_function_output() | no_return()
Same as total_supply/1
but raises Ethers.ExecutionError
on errors.
@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
@spec transfer!(Ethers.Types.t_address(), non_neg_integer(), Keyword.t()) :: [boolean()] | Ethers.Types.t_hash() | Ethers.Contract.t_function_output() | no_return()
Same as transfer/3
but raises Ethers.ExecutionError
on errors.
@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
@spec transfer_from!( Ethers.Types.t_address(), Ethers.Types.t_address(), non_neg_integer(), Keyword.t() ) :: [boolean()] | Ethers.Types.t_hash() | Ethers.Contract.t_function_output() | no_return()
Same as transfer_from/4
but raises Ethers.ExecutionError
on errors.