Complete the code to import the Hardhat runtime environment.
const hre = require('[1]');
The Hardhat runtime environment is imported using require('hardhat').
Complete the code to get the contract factory for deployment.
const Contract = await hre.ethers.getContract[1]('MyContract');
To deploy a contract, you get its factory using getContractFactory.
Fix the error in the deployment code to wait for the contract to be deployed.
const contract = await Contract.deploy();
await contract.[1]();After calling deploy(), you wait for deployment with deployed().
Fill both blanks to log the deployed contract address and exit the script.
console.log('Contract deployed to:', contract.[1]); process.[2](0);
The deployed contract address is accessed with address. To end the script, use process.exit(0).
Fill all three blanks to handle errors and run the main deployment function.
async function main() {
// deployment code
}
main()
.[1](() => process.exit(0))
.[2]((error) => {
console.error(error);
process.[3](1);
});Promises use then for success and catch for errors. To exit with error code, use process.exit(1).
