I'm encountering difficulties deploying a smart contract using Hardhat. In my deployment script, I'm using ethers.getContractFactory().deploy()
to deploy the BinaryvilleRobotsNFT contract. However, the deployment process seems to be failing, as I'm not receiving any output for the contract address. Additionally, I've attempted to retrieve deployment-related information using getDeployedCode()
from other stack exchange answers, but without success.
I need guidance on troubleshooting this issue. Are there any common pitfalls or configurations that might be causing the deployment to fail? I'd appreciate any insights or suggestions on how to diagnose and resolve this problem effectively.
mint-script-js
const { ethers } = require("hardhat");
async function main() {
const BinaryvilleRobotsNFT = await ethers.getContractFactory("BinaryvilleRobotsNFT");
const robotNFT = await BinaryvilleRobotsNFT.deploy();
// const receipt = await robotNFT.getDeployedCode()
// Extract contract address from the receipt
const contractAddress = robotNFT.getAddress();
console.log("BinaryvilleRobotsNFT deployed to:", contractAddress);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Error:
BinaryvilleRobotsNFT deployed to: undefined // when I did some research on stack exchange
BinaryvilleRobotsNFT deployed to: Promise { <pending> } // when I use getdeployedCode()