ethers.getContractFactory returns a promise, so it needs await.
Step 2: Verify other awaits
Token.deploy() and token.deployed() correctly use await.
Final Answer:
Missing await before ethers.getContractFactory -> Option A
Quick Check:
Always await getContractFactory [OK]
Hint: Always await getContractFactory call [OK]
Common Mistakes:
Forgetting await on getContractFactory
Confusing which calls need await
Assuming deploy() is synchronous
5. You want to deploy two contracts, Token and Marketplace, where Marketplace needs the Token address in its constructor. Which is the correct way to write the deployment script?
hard
A. Deploy Marketplace first, then deploy Token passing marketplace.address
B. Deploy Token first, then deploy Marketplace passing token.address
C. Deploy both contracts simultaneously without passing addresses
D. Deploy Token and Marketplace separately without constructor arguments
Solution
Step 1: Understand constructor dependency
Marketplace requires Token's address, so Token must be deployed first to get its address.
Step 2: Deploy in correct order
Deploy Token, then deploy Marketplace passing token.address to its constructor.
Step 3: Reject incorrect options
Deploying Marketplace first or simultaneously won't provide Token's address; omitting constructor args breaks dependency.
Final Answer:
Deploy Token first, then deploy Marketplace passing token.address -> Option B
Quick Check:
Deploy dependencies first, then dependent contracts [OK]
Hint: Deploy dependencies first, pass addresses to dependent contracts [OK]