1

Please see my deploy.js.The code fails at line 23 with await fund.deployed();

const hre = require("hardhat")
const { fundConfig } = require("../helper.config");

async function main() {
    let usdcTokenAddress;
    if (hre.network.config.chainId == 31337) {
        // Deploying on localhost...
        // Deploy the Mock USDCStablecoin contract
        const usdcTokenContractFactory = await hre.ethers.getContractFactory("USDCStablecoin");
        usdcTokenContract = await usdcTokenContractFactory.deploy();
        await usdcTokenContract.deployed();
        console.log("MockUSDCStablecoin contract deployed to:", usdcTokenContract.address);
        usdcTokenAddress = usdcTokenContract.address;
    } else {
        // Retrieve USDC Address from Goerli
        const chainId = hre.network.config.chainId;
        usdcTokenAddress = fundConfig.network[chainId].usdcTokenAddress;
    }
    const Fund = await hre.ethers.getContractFactory("Fund");
    const fund = await Fund.deploy(usdcTokenAddress);

    await fund.deployed(); // <--- HERE

    console.log("Fund deployed to:", fund.address);

    // Verify the contract
    if (hre.network.config.chainId != 31337) {
        await fund.deployTransaction.wait(10);
        await hre.run("verify:verify", {
            address: fund.address,
            constructorArguments: [usdcTokenAddress]
        });
    }
}

main()
    .then(() => process.exit(0))
    .catch((error) => {
        console.error(error);
        process.exit(1);
    });

This is the error I get.

HardhatError: HH110: Invalid JSON-RPC response received: {"jsonrpc":"2.0","id":18}
    at parseJsonResponse (.../contract/node_modules/hardhat/src/internal/util/jsonrpc.ts:47:11)
    at HttpProvider._fetchJsonRpcResponse (.../contract/node_modules/hardhat/src/internal/core/providers/http.ts:206:31)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at HttpProvider.request (.../contract/node_modules/hardhat/src/internal/core/providers/http.ts:84:29)
    at EthersProviderWrapper.send (.../contract/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)

I get this once I run npx hardhat run scripts/deploy.js --network goerli , and yes npx hardhat compile, npx hardhat test, npx hardhat run scripts/deploy.js all works

The contract even got deployed https://goerli.etherscan.io/tx/0xd72af54eaf53ec00d75f2a31d103ba8e1dce43541b679e3329c7ca34394ee154 (btw manually verified - as the script terminated with the error)

Then I created a new Alchemy project - I tried then on mumbai - also same error, but again it was still deployed. For a sanity check if the project setup in Alchemy was wrong.

Here are some screenshots from the Alchemy Dashboard...

You can see the transaction goes through

enter image description here

Here is the error inside the Alchemy Dashboard. Does not provide helpful information

enter image description here

enter image description here

1 Answer 1

0

The next day, I tried again and it worked. I didn't change a single line inside the deploy.js nor did I change environment variables, api-keys etc.

Must be a transient internal error.

If you encounter the same thing, please be patient and try later again.

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.