▶️PERC20 (Private ERC20) Deploy, Mint and Transfer.

Task Details: Craft an ERC20 contract that mints at least 100 tokens with Hardhat (in 7 Steps)

  1. Make an .env file for store your PK (Private Key) to access your wallet.

  2. Ensure you have enough funds token to doing the task.

  3. Make 3 file (deploy.js, mint.js and transfer.js) inside the script folder

  4. Open the deploy.js file and write our script

const { ethers } = require("hardhat");

async function main() {
  const perc20 = await ethers.deployContract("PERC20Sample");
  await perc20.deployed();

  console.log(`PERC20 was deployed to ${perc20.address}`);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
  1. And then let's write our mint.js script

  1. And the last write our transfer.js script

  1. Don't forget to compile the contract

  1. Execute the following command in your terminal to run the deploy script using the Swisstronik network

  1. Execute the following command in your terminal to run the mint script using the Swisstronik network

  1. Execute the following command in your terminal to run the transfer script using the Swisstronik network

Upon successful execution, your terminal should display the latest message you've defined in the contract 🎉

Last updated

Was this helpful?