ERC-20 tokens are the most basic and essential concept in Ethereum. This tutorial focuses on deploying smart contracts written in Solidity to different public chains. It is hoped that everyone can learn to deploy smart contracts on the public chain without requiring specific contract concepts to interact. This tutorial takes deployment on the Goerli public chain as an example.
Switch to the target network where you want to mint tokens in your wallet.
Remix IDE address
Create a new file and paste the following OpenZeppelin ERC-20 contract link:
- After saving the file, you will see a bunch of files imported into Remix. Find the ERC20 PresetMinterPauser.sol file in the presets. This file is written by OpenZeppelin according to the ERC20 standard with minter functionality. After deploying this file, you will become the owner of the contract and thus have the permission and ability to mint tokens.
- Go to the [Deployment] tab in Remix, select "Injected Provider - Metamask" in [Environment], and select "ERC20 PresetMinterPauser.sol" in [Contract].
- Click on the drop-down menu at [Contract], fill in your token name and symbol ("TEST" and "TST" for example), and click "transact".
- Confirm the transaction that pops up.
- The Remix console will show that the contract is deployed successfully, and you can see the successful deployment information in [Deployed Contracts].
- Click here to copy contract address at [Deployed Contract]
Click "Import Tokens" in the wallet, select "Custom token", import the copied contract address, then click "Add custom token" and confirm the import.
You can see in the wallet that the balance of the issued tokens is 0. At this time, you need to return to Remix to execute the token issuance.
Click on the drop-down menu at [Deployed Contracts] of Remix, find "mint" and click on it.
- Fill in your wallet address in "address", and the number of tokens to be issued in "uint256". Note that the unit here is wei. If you mint 1000 test tokens, you need to enter "1000000000000000000000" (the number of "0" is 18+3);
- Click "transact" and confirm the pop-up transaction window from your wallet. After the transaction is confirmed, you will see 1000 test tokens in the wallet.