-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminting.js
More file actions
32 lines (23 loc) · 1.2 KB
/
Copy pathminting.js
File metadata and controls
32 lines (23 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import hardhat from "hardhat";
const { ethers } = hardhat;
async function main() {
const CONTRACT_ADDRESS = "0x07784D79326D5D0c33C6e721691C3Da5439e742c"; // Replace with your deployed contract address
const MINT_TO_ADDRESS = "0xFA723ba7d35Df699AB76100D903754945D334c99"; // Replace with the address to mint tokens to
const MINT_AMOUNT = ethers.parseUnits("1000", 18); // Replace "1000" with the number of tokens to mint
// Get a signer (must be the contract owner)
const [owner] = await ethers.getSigners();
// Attach to the deployed contract
const HPMXToken = await ethers.getContractFactory("HPMXToken");
const hpmxToken = HPMXToken.attach(CONTRACT_ADDRESS);
console.log(`Minting ${MINT_AMOUNT} tokens to ${MINT_TO_ADDRESS}...`);
// Call the mint function
const tx = await hpmxToken.connect(owner).mint(MINT_TO_ADDRESS, MINT_AMOUNT);
console.log("Transaction hash:", tx.hash);
// Wait for the transaction to complete
const receipt = await tx.wait();
console.log("Minting complete. Gas used:", receipt.gasUsed.toString());
}
main().catch((error) => {
console.error("Error in minting:", error);
process.exitCode = 1;
});