# Issue ERC20 Token

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FukbMt866rEfqbte5biB5%2FIssue%20ERC20%20Token.png?alt=media&#x26;token=ffe841fd-5072-4a71-81dc-4ea6637c6ed7" alt=""><figcaption></figcaption></figure>

## Overview

ERC-20 is the technical standard for fungible tokens created on the EVM-compatible blockchain. An ERC20 token contract keeps track of *fungible* tokens: any token is exactly equal to any other token; no tokens have special rights or behavior associated with them. This makes ERC20 tokens useful for things like a **medium of exchange currency**, **voting rights**, **staking**, and more.&#x20;

As we know, both OpenZeppelin and ConsenSys maintain the standard library of ERC contract classes. Simply put, ERC20 is nothing more than a class with methods and members that run the logic of what we usually call cryptocurrency. However, it has a broader meaning because it also has applications in other use cases.&#x20;

Having explained why we imported the OpenZeppelin library and what ERC20 means, let's move on to learning how to create and deploy an ERC20 token with the OpenZepplin library.&#x20;

{% hint style="info" %}
**Note**

Additionally, OpenZeppelin offers some [ERC20 extension contracts](https://docs.openzeppelin.com/contracts/4.x/api/token/erc20#extensions). Please review the details if you are interested.
{% endhint %}

## Pre-requisites <a href="#pre-requisites" id="pre-requisites"></a>

* Install Metamask
* Configure  KuCoin Community Chain Testnet on Metamask
* Get Testnet token

## Compile and Deploy ERC20 Token

### Open Remix IDE: <https://remix.ethereum.org/>

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FBwZINIwrU1M9qcDVfJRi%2Fimage.png?alt=media&#x26;token=7f873fe1-9dab-4fe8-8520-39a99463fdd6" alt=""><figcaption></figcaption></figure>

### Create the contract

* Create a new `Token.sol` contract and copy the below contract code to `Token.sol`

```solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.9;

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

contract KIP20Token is ERC20 {
    constructor(uint256 totalSupply) ERC20("DemoToken", "DET") {
        // create totalSupply of tokens for the deployer
        _mint(msg.sender, totalSupply);
    }
}
```

### &#x20;Compile the contract

* switch to the compile page
* Select proper compiler
* Select `KIP20Token(Token.sol)` contract
* And then click `Compile Token.sol`

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FIamHGX1CPgVzD1dCgYzJ%2Fimage.png?alt=media&#x26;token=6c078860-126c-478c-9535-e4d684fef6b1" alt=""><figcaption></figcaption></figure>

### Compile the contract

* Click the button to switch to compile button
* Select `Injected Provider-MetaMask`
* Select `KIP20Token-Token.sol`
* Fill in many tokens you want to mint and click **`Deploy`** button

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FwYChhY21NDnb1aFAaQdK%2Fimage.png?alt=media&#x26;token=e518ed44-3b73-4552-8fbc-874e49793b89" alt=""><figcaption></figcaption></figure>

* Click **`Confirm`** button to sign and broadcast the transaction to KCC Testnet

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FOcLYnmNVrBAUsFM8ez1Q%2Fimage.png?alt=media&#x26;token=a33a30f6-2d85-4421-bb81-88221d123444" alt=""><figcaption></figcaption></figure>

### Add custom token to MetaMask

* Copy the deployed contract address

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FNNT5cNL3OY4lOagWG4US%2Fimage.png?alt=media&#x26;token=ea22c6ae-b304-4ba4-b91e-001e0bdb0d6d" alt=""><figcaption></figcaption></figure>

* Click **`Import Tokens`**

![](https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FNoDxonwqLnjpm5x2DECk%2Fimage.png?alt=media\&token=52769f94-9748-4ee5-8cfc-a5a8467a7664)

* Paste the contract address to the `Token contract address`
* And the `Token symbol` and `Token decimal` will auto tilled by MetaMask
* Finally, Click the **`Add custom token`**

![](https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FNO7Pb7sUgSjIGLib8E8P%2Fimage.png?alt=media\&token=37cd16cf-0499-4ca7-9ed1-1f41a1e5bd67)

* Click the **`Import tokens`** button

![](https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FGQPYxW5cOjo42LRxPRsK%2Fimage.png?alt=media\&token=ec3e2462-7cb0-45af-beee-ca28255dc64e)

* When you reopen the MetaMask next time, you will see the token and amount

![](https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FgIhClmrOzHNdhNikK7Nq%2Fimage.png?alt=media\&token=fba3d368-f4f5-40f9-8aa9-a0446686374b)

## Conclusion[​](https://docs.bnbchain.org/docs/hardhat-new#conclusion) <a href="#conclusion" id="conclusion"></a>

This tutorial guides you through the basics of creating and deploying an ERC20 token contract based on the OpenZepplin library using the Remix IDE on the KCC Testnet. It should be noted that the exact same instructions and sequence will also work on KCC Mainnet.
