Fungible Tokens

ERC-20 on TEN

The ERC-20 standard, while originally proposed for Ethereum, is also applicable to TEN's Layer 2. It provides an API for tokens within Smart Contracts and offers functionalities to:

  • Transfer tokens between accounts on TEN

  • Retrieve the current token balance of an account on TEN

  • Determine the total supply of the token on the TEN network

  • Approve third-party accounts to spend a specific amount of tokens on TEN

A Smart Contract on TEN that implements the following methods and events adheres to the ERC-20 standard:

Methods:

  • name(): Returns the name of the token.

  • symbol(): Returns the symbol of the token.

  • decimals(): Returns the number of decimals the token uses.

  • totalSupply(): Returns the total token supply.

  • balanceOf(address _owner): Returns the token balance of the specified address.

  • transfer(address _to, uint256 _value): Transfers tokens to a specified address.

  • transferFrom(address _from, address _to, uint256 _value): Transfers tokens from one address to another.

  • approve(address _spender, uint256 _value): Approves a third-party account to spend a specified amount of tokens.

  • allowance(address _owner, address _spender): Returns the amount of tokens approved by an owner for a spender.

Events:

  • Transfer(address indexed _from, address indexed _to, uint256 _value): Triggered when tokens are transferred.

  • Approval(address indexed _owner, address indexed _spender, uint256 _value): Triggered when approve function is called.

Examples

Further Reading

Last updated