Release PRC-20 Token

Before you start, you will need to prepare the following:

  1. MetaMask Wallet

  2. Have at least 1 PSC

Start using Remix

Now you can start Remix to proceed. You need to create a new file to save the Solidity smart contract. Click the + button below File Explorers and enter the file name "MyToken.sol" in the pop-up window.

Next, paste the following smart contract into the edit box of the pop-up window.

pragma solidity ^0.7.0;

import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.2.0-solc-0.7/contracts/token/ERC20/ERC20.sol';

// This ERC-20 contract mints the specified amount of tokens to the contract creator.
contract MyToken is ERC20 {
  constructor(uint256 initialSupply) ERC20("MyToken", "MYTOK") {
    _mint(msg.sender, initialSupply);
  }
}

This is a simple version of the ERC-20 contract written based on the latest OpenZeppelin ERC-20 template. The contract uses MYTOK as the symbol forMyTokenand minting the initial Token for the contract creator.

Next, guide to Compile in the side options and click on the Compile MyToken.sol button.

You will see that Remix has downloaded all OpenZeppelin dependencies and finished compiling the contract.

When you select the Injected Web3 option, you need to authorize Remix to connect to your MetaMask account.

Then go back to the Remix screen and you will see that the account you want to deploy is already authorized to login via MetaMask. Next to the Deploy button, enter the Token amount, let's say we want to deploy 10 million Tokens, but since the default number of digits in this contract is 18 decimal places, you need to enter 10000000000000000000000000 in the input box.

MetaMask will then pop up a window asking you to confirm the transaction for this deployment contract.

After you click Confirm, the deployment will be completed and you will see your transactions on MetaMask. At the same time, the contracts will also appear in Remix under Deployed Contracts.

Once you have successfully deployed the contract, you can interact with the smart contract via Remix.

Scroll down the page, find Deployed Contracts, click on name, symbol, and totalSupply, and MyToke, MYTOK, and 10000000000000000000000000will appear respectively.If you copy the contract address and paste it into the balanceOf field, you will see the full balance of the account at the user's ERC-20 address. Click on the button next to the contract name and address to copy the contract address.

Now, open MetaMask and add the ERC-20 Token you just deployed, make sure you have copied the contract address on Remix before doing so. Go back to MetaMask, as shown below, and click Add Token. Make sure that the account you are working with is the account where the contract has been deployed.

Paste the copied contract address into the Custom Token field, while the Token Symbol and Decimals of Precision fields will be automatically populated.

After clicking Add Token, you will see that 8 million MyTok have been successfully added to your account:

Last updated