Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Build and Deploy ERC20 Token in 3 Steps
Idris Olubisi💡
Idris Olubisi💡

Posted on • Originally published atblog.idrisolubisi.com

     

Build and Deploy ERC20 Token in 3 Steps

Approximately 90% of US and European banks have begun investigating blockchain's possibilities, with financial institutions alone investing $552 million in blockchain-based projects.

Apart from documenting financial transactions, blockchain may also store medical information, reach binding agreements, trace the flow of commodities, keep personal credit records, track the provenance of artwork, verify payments across a supply chain, and much more.

Cryptocurrencies have recently gained popularity, providing limitless opportunities for businesses, individuals, and DAOs.

This post will teach us how to build and deploy the ERC20 token in 3 steps.

What is ERC20 Token?

The ERC-20 token is one of the essential Ethereum tokens. ERC-20 has emerged as the technical standard for token implementation on the Ethereum blockchain; it contains a set of rules that all Ethereum-based tokens must follow.

The ERC-20 introduces a standard forFungible Tokens, which means they have a characteristic that makes each token identical to another in terms of type and value.

An ERC-20 token, for example, functions similarly to ETH, meaning that one token is and will always be equal to all other Tokens... Eth Org

Step 1: Build an ERC20 Token Smart Contract with Solidity using the remix IDE

We'll learn how to utilizehttps://remix.ethereum.org/, a free, easy-to-use IDE with a solidity-compatible IntelliJ feature and decent compile-time errors, to build and deploy an ERC20 Token Smart Contract.

Next, we will navigate to theRemix site and create a new file calledMyToken.sol as shown below.

Build and Deploy ERC20 Token in 5 Steps

Let's update theMyToken.sol file with the following code snippet.

// SPDX-License-Identifier: MITpragmasolidity^0.8.4;// Using the openzepplin contract standardimport"@openzeppelin/contracts/token/ERC20/ERC20.sol";import"@openzeppelin/contracts/access/Ownable.sol";// Token contractcontractOlanetsoftTokenisERC20,Ownable{constructor()ERC20("OlanetsoftToken","OLT"){_mint(msg.sender,500*10**decimals());}functionmint(addressto,uint256amount)publiconlyOwner{_mint(to,amount);}}
Enter fullscreen modeExit fullscreen mode

In the code snippet above, we:

  • Import the OpenZeppelin ERC20 contract
  • Initialize the Token, inheriting from the ERC20.sol contract
  • Declare a new contract calledOlanetsoftToken, using the Solidity keyword contract, while inheriting the ERC20 OpenZeppelin's contract using theis keyword.
  • Create an initial amount of tokens500 for the deployer.
  • Give access to Privileged accounts to create more supply using themint function.

Next, we will compile our contract and get it ready for deployment.

Build and Deploy ERC20 Token

Step 2: Deploy ERC20 Token Smart Contract

In this step, we will deploy our smart contract to the Polygon Mumbai testnet. Deployment is not restricted to only Mumbai testnet, as we can deploy to any of our preferred chains.

Build and Deploy ERC20 Token

Next, we will select the contract to deploy.

Build and Deploy ERC20 Token

Finally, we can deploy our ERC20 token.

Build and Deploy ERC20 Token

Build and Deploy ERC20 Token

Voila 🥳

Build and Deploy ERC20 Token

Step 3: Verify and Import Token using Metamask

Let us import and verify the token we just deployed. We will head over to Metamask or by just clicking on the icon as shown below.

Build and Deploy ERC20 Token

Build and Deploy ERC20 Token

View on the block explorer.

Build and Deploy ERC20 Token

We will be redirected to the Mumbai Polygonsite where we can verify the transaction with contract details.

Next, we will import our token.

Build and Deploy ERC20 Token

Build and Deploy ERC20 Token

Import token.

Build and Deploy ERC20 Token

View token.

Build and Deploy ERC20 Token

Conclusion

This post addresses how to build and deploy the ERC20 Token in 3 steps as part of the token series I created. Watch this space for the upcoming ones.

I'd love to connect with you atTwitter |LinkedIn |GitHub |Portfolio

See you in my next blog article. Take care!!!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Developer Relations Engineer | Software Engineer | Technical Writer | Content Creator | Speaker
  • Location
    Lagos, Nigeria
  • Work
    Developer Relation Engineer
  • Joined

More fromIdris Olubisi💡

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp