Skip to main content

ERC20 Example


Required Prior Knowledge

This guide assumes you are familiar with tokens in blockchain, Ethereum Request for Comments (ERCs)(also known as Ethereum Improvement Proposals (EIP)) , NFTs, Smart Contracts and have already tinkered with Solidity. ERC20 is a standard for fungible tokens and is defined in the EIP-20 Token Standard by Ethereum.

About ERC20

With the ERC20 standard, you can create your own tokens and transfer them to the EVM on IOTA Smart Contracts without fees.

You can use the Remix IDE to deploy any regular Solidity Smart Contract.

Set the environment to Injected Web3 and connect Remix with your MetaMask wallet. If you haven’t already, please follow the instructions on how to connect your MetaMask with the public Testnet..

1. Create a Smart Contract

Create a new Solidity file, for example, ERC20.sol in the contracts folder of your Remix IDE and add this code snippet:

pragma solidity ^0.8.7;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract ExampleERC20Token is ERC20 {
constructor() ERC20("ExampleERC20Token", "EET") {
_mint(msg.sender, 1000000 * 10 ** decimals());

This imports all functions from the OpenZeppelin smart contract and creates a new ERC20 token with your name and Symbol. OpenZeppelin provides many audited smart contracts and is a good point to start and learn.

You can change the token name ExampleERC20Token and the token symbol EET.

2. Compile Your Smart Contract

Go to the second tab and compile your smart contract with the Compile ERC20.sol button.

Compile ERC20.sol

3. Deploy Your Smart Contract

  1. Go to the next tab and select Injected Web3 as your environment. Ensure that your MetaMask is installed and set up correctly.

  2. Choose your ´ExampleERC20Token´ smart contract in the contract dropdown.

  3. Press the "Deploy" button. Your MetaMask wallet will pop up, and you will need to accept the deployment.

Deploy ERC20.sol

  1. Your MetaMask browser extension will open automatically - press confirm.

Confirm in MetaMask

4. Add Your Token to MetaMask

  1. Get the contract address from the transaction after the successful deployment. You can click on the latest transaction in your MetaMask Activity tab. If you have configured your MetaMask correctly, the IOTA EVM Explorer will open the transaction.
  2. Copy the contract address and import your token into MetaMask.

Copy contract address

5. Have some Fun!

Now you should see your token in MetaMask. You can send them to your friends without any fees or gas costs.

Copy contract address

You also can ask in the Discord Chat Server to send them around and discover what the community is building on IOTA Smart Contracts.