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

ERC20 token interface

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

Summary

Functions

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

Prepares allowance(address owner, address spender) call parameters on the contract.

Prepares approve(address spender, uint256 value) call parameters on the contract.

Prepares balanceOf(address account) call parameters on the contract.

Prepares contract constructor values for deployment.

Prepares decimals() call parameters on the contract.

Prepares name() call parameters on the contract.

Prepares symbol() call parameters on the contract.

Prepares totalSupply() call parameters on the contract.

Prepares transfer(address to, uint256 value) call parameters on the contract.

Prepares transferFrom(address from, address to, uint256 value) call parameters on the contract.

Functions

__default_address__()

@spec __default_address__() :: nil

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

To specify a default address see Ethers.Contract

allowance(owner, spender)

Prepares allowance(address owner, address spender) call parameters on the contract.

This function should only be called for result and never in a transaction on its own. (Use Ethers.call/2)

State mutability: view

Function Parameter Types

  • owner: :address
  • spender: :address

Return Types (when called with Ethers.call/2)

  • {:uint, 256}

approve(spender, value)

Prepares approve(address spender, uint256 value) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). No amount of Ether can be sent with this function.

State mutability: non_payable

Function Parameter Types

  • spender: :address
  • value: {:uint, 256}

Return Types (when called with Ethers.call/2)

  • :bool

balance_of(account)

@spec balance_of(Ethers.Types.t_address()) :: Ethers.TxData.t()

Prepares balanceOf(address account) call parameters on the contract.

This function should only be called for result and never in a transaction on its own. (Use Ethers.call/2)

State mutability: view

Function Parameter Types

  • account: :address

Return Types (when called with Ethers.call/2)

  • {:uint, 256}

constructor()

@spec constructor() :: binary()

Prepares contract constructor values for deployment.

To deploy a contracts use Ethers.deploy/2 and pass the result of this function as :encoded_constructor option.

Parameters

decimals()

@spec decimals() :: Ethers.TxData.t()

Prepares decimals() call parameters on the contract.

This function should only be called for result and never in a transaction on its own. (Use Ethers.call/2)

State mutability: view

Return Types (when called with Ethers.call/2)

  • {:uint, 8}

name()

@spec name() :: Ethers.TxData.t()

Prepares name() call parameters on the contract.

This function should only be called for result and never in a transaction on its own. (Use Ethers.call/2)

State mutability: view

Return Types (when called with Ethers.call/2)

  • :string

symbol()

@spec symbol() :: Ethers.TxData.t()

Prepares symbol() call parameters on the contract.

This function should only be called for result and never in a transaction on its own. (Use Ethers.call/2)

State mutability: view

Return Types (when called with Ethers.call/2)

  • :string

total_supply()

@spec total_supply() :: Ethers.TxData.t()

Prepares totalSupply() call parameters on the contract.

This function should only be called for result and never in a transaction on its own. (Use Ethers.call/2)

State mutability: view

Return Types (when called with Ethers.call/2)

  • {:uint, 256}

transfer(to, value)

Prepares transfer(address to, uint256 value) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). No amount of Ether can be sent with this function.

State mutability: non_payable

Function Parameter Types

  • to: :address
  • value: {:uint, 256}

Return Types (when called with Ethers.call/2)

  • :bool

transfer_from(from, to, value)

Prepares transferFrom(address from, address to, uint256 value) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). No amount of Ether can be sent with this function.

State mutability: non_payable

Function Parameter Types

  • from: :address
  • to: :address
  • value: {:uint, 256}

Return Types (when called with Ethers.call/2)

  • :bool