rpc – HardHat Deploy Script Works on Testnet But Not on Forked Hardhat Network

buidlerethers.jsforksrpc

The error that I am getting when running this is:

Error: Invalid RpcBlockWithTransactions or null

I have a contract called PriceConsumerV3 and it makes a view function call on a contract. I am attempting to use hardhats forking functionality, but whenever I run this script from the forked version, (or even just the regular hardhat runtime environment) I get the error above.

However, when I use the kovan network as defined in my hardhat.config.js which uses an RPC_URL the script deploys and works fine.

async function main() {
    const PriceConsumerV3 = await ethers.getContractFactory("PriceConsumerV3")
    const priceConsumerV3 = await PriceConsumerV3.deploy()
    await priceConsumerV3.deployed()
    console.log("priceConsumerV3 deployed to: ", priceConsumerV3.address)
    ethPrice = await priceConsumerV3.getLatestPrice()
    console.log("Price data for ETH: ", ethPrice.toString())
}

Any thoughts?

Best Answer

So I found out the issue was with kovan. You can currently only fork mainnet.

Related Topic