// contracts/Token.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract TestToken is ERC20 {
constructor(uint256 initialSupply) ERC20("Test Token", "MNA") {
_mint(msg.sender, initialSupply);
}
}npm install @openzeppelin/contracts// hardhat.config.js
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-etherscan");
module.exports = {
networks: {
// Add network configurations here (e.g., for local development, testnets, or mainnet).
VANAR_TESTNET:{
url: "RPC_VANAR_VANGAURD",
accounts: ["PRIVATE_KEY_OF_THE_DEPLOYER"],
chainId: 7860
}
},
etherscan: {
apiKey: "YOUR_ETHERSCAN_API_KEY", // Replace with your Etherscan API key
},
vanar: {
apiKey: "YOUR_VANAR_API_KEY", // Replace with your VANAR API key
}
solidity: "0.8.0",
};mkdir my-erc20-token
// scripts/deployERC20.js
const { ethers, upgrades } = require("hardhat");
async function main() {
const maxSupply = 1000000 * (10 ** 18); // To mint 1,000,000 tokens
const [deployer] = await ethers.getSigners();
console.log("Deploying TestToken from account:", deployer.address);
const TestToken = await ethers.getContractFactory("TestToken");
const testToken = await TestToken.deploy(maxSupply); // Initial supply
console.log("TestToken deployed to:", testToken.address);
await testToken.deployed();
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
npx hardhat run scripts/deployERC20.js --network <network_name>