-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckBalance.js
More file actions
32 lines (27 loc) · 915 Bytes
/
checkBalance.js
File metadata and controls
32 lines (27 loc) · 915 Bytes
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
const { ethers } = require("hardhat");
async function main() {
const [account] = await ethers.getSigners();
console.log("Checking balance for account:", account.address);
const addresses = {
holesky: "0x4461b34d90aDDc7C42Ba2436fEA7f69c9355D62C", // Holesky
baseSepolia: "0x4883ea19C731Eb9Da7A6E1Cf23AA8B7A6f6313c3", // Base Sepolia
};
const networkName = hre.network.name;
const contractAddress = addresses[networkName];
if (!contractAddress) {
throw new Error(`No contract address defined for network: ${networkName}`);
}
const MyOFT = await ethers.getContractAt("MyOFT", contractAddress, account);
const balance = await MyOFT.balanceOf(account.address);
console.log(
`Balance on ${networkName}:`,
ethers.utils.formatUnits(balance, 18),
"MOT"
);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});