lesson 6: address is showing as undefined #6108
heheboii11
started this conversation in
General
Replies: 3 comments 1 reply
-
try console.log(contract address: ${simplestorage.target}) |
Beta Was this translation helpful? Give feedback.
0 replies
-
worked bro thanks but can i know the reason why i have to use target |
Beta Was this translation helpful? Give feedback.
1 reply
-
_transactionHashPollingInterval: undefined |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
/imports
const { ethers, run, network } = require("hardhat")
//async func
async function main() {
const simplestoragefactory = await ethers.getContractFactory("SimpleStorage")
const simplestorage = await simplestoragefactory.deploy()
//const transaction_receipt = await simplestorage.deployed
const transaction_receipt = await simplestorage
.deploymentTransaction()
.wait(1)
console.log(simplestorage)
console.log(transaction_receipt)
console.log(
contract address: ${simplestorage.address}
)console.log(network.config)
if (network.config == 11155111 && process.env.ETHERSCAN_API) {
await simplestorage.deploymentTransaction.wait(1)
await verify(simplestorage.address, [])
}
const currentvalue = await simplestorage.store(7)
await currentvalue.wait(1)
const fav_number = await simplestorage.retrieve()
console.log(
current fav number: ${fav_number}
)// else(process.env.ETHERSCAN_API) {
// await verify(simplestorage.address,[])
// }
}
async function verify(contractAddress, args) {
console.log("deploying your contract......")
try {
await run("verify;verify", {
address: contractAddress,
constructorArguments: args,
})
} catch (e) {
if (e.message.toLowerCase().includes("already verfied")) {
console.log("already verified")
} else {
console.log(e)
}
}
}
// //main
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
while running the script the address is showing as undefined can anyone say what is wrong ?
Beta Was this translation helpful? Give feedback.
All reactions