PolySmartChain
English
English
  • PSC Development Documentation
  • Overview
    • PolySmartChain Introduction
    • PSC Token
    • PolySmartChain Network
  • Blockchain Foundation
    • Types of Blockchain
    • Consensus Mechanism
    • GAS
    • Block
    • Account
    • WEB2 and WEB3
    • DAPP
    • Transaction
  • Economics
    • PSC Token Economics
    • PSC Token Effectiveness
  • Developer
    • Virtual Machine(EVM)
    • Deploy the First Contract
    • Release PRC-20 Token
    • Release PRC-721 Token
  • Node
    • RPC Node
    • Deploy
    • private chain
    • Developer Tools
    • Infrastructure
    • Smart Contract Libraries
  • Explorer
    • Explorer
  • Wallet
    • Supported Wallets
    • Using Metamask
    • Using TokenPocket
    • Using Imtoken
    • ImToken quick add network
  • Poly Bridge
    • PolyBridge Introduction
    • PolyBridge No-EVM Operation Tutorial
      • WDC to PSC(WDCSpace)
      • TRON to PSC(TronLink)
    • PolyBridge EVM Operation Tutorial
      • BNB Chain to PSC(MetaMask)
      • BNB Chain to PSC(Imtoken)
      • BNB Chain to PSC(TokenPocket)
    • PolyBridge Contracts
    • PolyBridge FAQ
  • DAPP
    • Swanswap
      • How to buy PSC tokens in Swanswap
      • How to Add PSC-USDT Liquidity in Swanswap
    • NFT Auction
      • Claim PolyJetClub
      • View PolyJetClub in the MetaMask Wallet
    • Social
      • Register Social
    • Mining Pool
      • Stake LP Token to Mining Pool
      • Mining Pool FAQ
    • Stake-in-farmV2
    • PolyDao Proposal Description
      • PolyDao Proposal FAQ
  • Resource
    • Resource
    • Contract
Powered by GitBook
On this page
  1. Developer

Release PRC-20 Token

PreviousDeploy the First ContractNextRelease PRC-721 Token

Last updated 2 years ago

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 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:

Remix