Recall & Review
beginner
What is the main purpose of a Hardhat deployment script?
A Hardhat deployment script automates the process of deploying smart contracts to a blockchain network, making it easier and repeatable.
Click to reveal answer
beginner
In a Hardhat deployment script, what does the function
hre.ethers.getContractFactory do?It creates a contract factory object that allows you to deploy new instances of a smart contract.
Click to reveal answer
beginner
Why do we use
await when deploying contracts in Hardhat scripts?Because deploying contracts is an asynchronous operation that takes time,
await ensures the script waits for deployment to finish before moving on.Click to reveal answer
intermediate
What is the role of the
main function in a Hardhat deployment script?The
main function contains the deployment logic and is executed to deploy contracts. It is usually wrapped in a try-catch block to handle errors.Click to reveal answer
intermediate
How can you pass constructor arguments to a contract during deployment in a Hardhat script?
You pass constructor arguments as parameters to the
deploy method of the contract factory, e.g., Contract.deploy(arg1, arg2).Click to reveal answer
What does
hre stand for in Hardhat deployment scripts?✗ Incorrect
hre is the Hardhat Runtime Environment, which provides access to Hardhat's functionalities in scripts.
Which keyword is used to wait for a contract deployment to complete in a Hardhat script?
✗ Incorrect
await pauses the script until the asynchronous deployment finishes.
How do you handle errors in a Hardhat deployment script?
✗ Incorrect
try-catch blocks catch errors during deployment and allow graceful handling.
What command runs a Hardhat deployment script?
✗ Incorrect
The command npx hardhat run executes deployment scripts using Hardhat.
Where do you usually specify the network to deploy to in Hardhat?
✗ Incorrect
The network is configured in the Hardhat config file, which the deployment script uses.
Explain the steps to write a basic Hardhat deployment script for a smart contract.
Think about how you prepare, deploy, and handle errors in the script.
You got /5 concepts.
Describe how constructor arguments are passed during contract deployment in Hardhat scripts.
Focus on the deploy method call and its parameters.
You got /3 concepts.