▶️PERC20 (Private ERC20) Deploy, Mint and Transfer.
Task Details: Craft an ERC20 contract that mints at least 100 tokens with Hardhat (in 7 Steps)
Make sure you have installed SwisstronikJS by running npm i @swisstronik/swisstronik.js
Make an .env file for store your PK (Private Key) to access your wallet.
Ensure you have enough funds token to doing the task.
Make 3 file (deploy.js, mint.js and transfer.js) inside the script folder
Open the
deploy.jsfile 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;
});And then let's write our
mint.jsscript
And the last write our
transfer.jsscript
Don't forget to compile the contract
Execute the following command in your terminal to run the deploy script using the Swisstronik network
Execute the following command in your terminal to run the mint script using the Swisstronik network
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?