const hre = require("hardhat");

async function main() {
const [deployer] = await hre.ethers.getSigners();

console.log("Deploying contracts with the account:", deployer.address);

console.log("Account balance:", (await deployer.getBalance()).toString());

const Token = await hre.ethers.getContractFactory("TestCoin"); //Replace with name of your smart contract
const token = await Token.deploy();

console.log("Token address:", token.address);
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});

Jun 18, 2023, 9:37 PM
This is scripts/deploy.js file
is there any problem in getBalance function?
who can explain me how to deploy bsc smart contract into mainnet and testnet by hardhat??
Jun 18, 2023, 9:57 PM
https://hardhat.org/tutorial/deploying-to-a-live-network#_7-deploying-to-a-live-network
The deployer object doesnt have a getBalance function. Try logging it out to the console to check it
Jun 19, 2023, 2:35 AM
Deployer doesnt have the getBalance function use typescript insteed js
Jun 19, 2023, 6:34 AM

© 2024 Draquery.com All rights reserved.