I am writing a script for a smart contract that I'll deploy using hardhat. I'm confused on the difference between .deploy() and .deployed(), what does each one do?
const main = async () => {
const waveContractFactory = await hre.ethers.getContractFactory('WavePortal');
const waveContract = await waveContractFactory.deploy();
await waveContract.deployed();
console.log('Contract addy:', waveContract.address);
...
deploy() will trigger this deployment of the contract and deployed() checks if the contract is already available on the blockchain and if the deployment is still ongoing will wait for the deployment transaction to be mined.