123456789101112131415161718192021222324 |
- import { ethers } from "hardhat";
- async function main() {
- const [signer] = await ethers.getSigners();
- const contractAddress = "0x389CF3447C2867f767303d670193ee54343B20d7"; // Replace with your deployed contract address
- const MyToken = await ethers.getContractFactory("MyRewardToken");
- const myToken = MyToken.attach(contractAddress);
- // Check balance of the signer
- const balance = await myToken.balanceOf(signer.getAddress());
- console.log(`Balance of`, signer.getAddress(), ethers.formatEther(balance));
- // Mint new tokens (if you're the owner)
- const mintTx = await myToken.mint(signer.address, ethers.parseEther("100"));
- await mintTx.wait();
- console.log("Minted 100 tokens to", signer.getAddress());
- }
- main().catch((error) => {
- console.error(error);
- process.exitCode = 1;
- });
|