-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathburn.js
More file actions
31 lines (22 loc) · 1.11 KB
/
Copy pathburn.js
File metadata and controls
31 lines (22 loc) · 1.11 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
import hardhat from "hardhat";
const { ethers } = hardhat;
async function main() {
const CONTRACT_ADDRESS = "0x07784D79326D5D0c33C6e721691C3Da5439e742c"; // Replace with your deployed contract address
const BURN_AMOUNT = ethers.parseUnits("500", 18); // Replace "500" with the number of tokens to burn
// Get a signer (must be the account that holds the tokens to burn)
const [owner] = await ethers.getSigners();
// Attach to the deployed contract
const HPMXToken = await ethers.getContractFactory("HPMXToken");
const hpmxToken = HPMXToken.attach(CONTRACT_ADDRESS);
console.log(`Burning ${BURN_AMOUNT} tokens from the owner's account (${owner.address})...`);
// Call the burn function
const tx = await hpmxToken.connect(owner).burn(BURN_AMOUNT);
console.log("Transaction hash:", tx.hash);
// Wait for the transaction to complete
const receipt = await tx.wait();
console.log("Burning complete. Gas used:", receipt.gasUsed.toString());
}
main().catch((error) => {
console.error("Error in burning:", error);
process.exitCode = 1;
});