0

I want to interact with the contracts in the mainnet, i used hardhat fork to fork the arbitrum mainnet, forking is done but after that my contracts getting deployed according to the script and the command is completely executed.

Now deploying the contract is done but i want to test a script which is in other file, when i try to run it, it gives call revert exception.

I say forking is working because i tried to put the same test script in the deployment scripts it worked!

May be i am wrong,I think its because the fork that i made and deployed my contracts to has finished and exited and when i try to interact with it after the that deployment script is done, its giving this error. So i thought if we separate the hardhat fork into separate terminal like npx hardhat node --localhost it might work where i can run the test scripts since the blockchain state will be there. How to get the hardhat fork into separate terminal like npx hardhat node--localhost?

here is screenshot of forking screenshot of forking

Here is screenshot of test not working screenshot of test not working

If it doesn't solve this problem please suggest a solution.

1 Answer 1

0

In a terminal you can do this:

npx hardhat node --fork http://arb-mainnet.g.alchemy.com/v2/<key>

It should open a network, leave it open until you finish testing everything.

Then you can run your scripts like this:

npx hardhat run scripts/yourScript.js --network localhost

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.