1

I deployed the contract on hardhat also deployed a few other chains like ganache, goerli. Whenever I deploy I save the deployment address to a file and later when I call functions I use that address. For hardhat, although I could deploy successfully, when I call it I am getting "WARNING: Calling an account which is not a contract" this warning on the hardhat node logs.

I know there is another question and the user was suggested to correct the address, I mean he was using Mainnet address instead of hardhat address. In my case I am already using the correct address to call the contract. I am not sure why I am getting this. By the way, I have been using this code(both deployment and client) and previously I wasn't getting this error, and could see logs and event emissions from the smart contract function. Currently, I also do not get the relevant codes such as gas used etc. for the deployment.

I checked everything many times. Can someone help me to fix this please?

I am suspecting that I might be starting a new instance of the hardhat when I run the application_client in a new terminal but I do not want it. I am using the network parameter as below..

npx hardhat run --network hardhat .\scripts\frontend\application_frontend.ts

Many thanks in advance.. Ferda

2 Answers 2

0

you should deploy the contract with

npx hardhat run scripts/deploy.ts --network localhost

not

npx hardhat run scripts/deploy.ts --network hardhat
1

Hardhat network is an ephemeral network you create. If you are deploying the contract to hardhat and then interacting with it in another script, then likely the deployment is gone. The script is interacting with a network fork that predates your contract deployment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.