Replies: 1 comment
-
just replace if (network.config.chainId === 11155111 && process.env.ETHERSCAN_API_KEY) {
await SimpleStorageFactory.deployTransaction.wait(6)
await verify(SimpleStorageFactory.getAddress(), [])
}
//Interact with contract
const currentValue = await SimpleStorageFactory.retrieve()
console.log(`Current Value is ${currentValue}`)
//Update the current value
const transactionResponse = await SimpleStorageFactory.store(7)
await transactionResponse.wait(1)
const updatedValue = await SimpleStorageFactory.retrieve()
console.log(`Updated Value is ${updatedValue}`)
} |
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.
-
I am currently on lesson 6 where you deploy to hardhat, and are implementing the Verify function. When I deploy, this is the response I get. ReferenceError: simpleStorage is not defined
Here is the code:
// imports
const { ethers, run, network } = require("hardhat")
// async main
async function main() {
// const SimpleStorageFactory = await ethers.getContractFactory(
// "SimpleStorage",
// )
// console.log("Deploying contract...")
// const simpleStorage = await SimpleStorageFactory.deploy()
// await simpleStorage.deployed()
// console.log(
Deployed contract to: ${simpleStorage.address}
)}
//verify contract on Etherscan
async function verify(contractAddress, args) {
console.log("Verifying contract...")
try {
await run("verify:verfiy", {
address: contractAddress,
constructorArguments: args,
})
}
// main
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
The reason the async function main() looks different than in the lesson is because it was suggested in another discussion to fix an error. However, I did switch it back to the original code from the lesson and it still did not work.
Beta Was this translation helpful? Give feedback.
All reactions