ethers-simple-storage-fcc
ethers-simple-storage-fcc copied to clipboard
Resolving Error : Update to ethers.js Retrieving Contract.Address
I don't know if this can help anyone but I got stuck because contract.address is giving me an error in terminal. Can be an update of ethers? Anyway to solve this problem, we can use the contractAddress property on the deployed contract receipt like this:
const contract = await contractFactory.deploy();
const receipt = await contract.deploymentTransaction().wait(1);
console.log("Contract Address : " + receipt.contractAddress);
Nice work!
You could also try this:
console.log(`Contract deployed to ${contract.target}`);
contract.address => contract.target
You can try this code, also work:
console.log(`Contract deployed to ${await contract.getAddress()}`)
contract.address => await contract.getAddress()