when I run hardhat on forked testnet and try to run test script that includes
dai = await ethers.getContractAt("IERC20", DAI)
I get this error:
NomicLabsHardhatPluginError: 0x6B175474E89094C44Da98b954EedeAC495271d0F is not a contract account.
I tried different addresses but nothing seems to work.
this is my hardhat config.js
I use quicknode as url
networks: {
hardhat: {
hardfork: "merge",
// If you want to do some forking set `enabled` to true
forking: {
url: `${process.env.QUICKNODE_API_KEY_MUMBAI}`,
//blockNumber: FORKING_BLOCK_NUMBER,
enabled: true,
},
chainId: 31337,
},
localhost: {
chainId: 31337,
},
And ran it as follows: npx hardhat node –network hardhat and it works fine
Best Answer
I found the problem, it seems DAI is not implemented on the testnet polygon mumbai so I had to change the API key to mainnet polygon and change the address of the DAI