Skip to content

TypeError: ethers.getContract is not a function | I tried all the solutions in the internet but no luck :( #5832

Answered by pallab-nandi
pallab-nandi asked this question in Q&A
Discussion options

You must be logged in to vote

Well After a long long research on the error I finally came to an answer. And this will works with for everyone of those who are using new version of hardhat and ethersJs.
basically on hardhat.config.js file do this thing require at the above. So every code will work just fine:

require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-verify");
require('hardhat-gas-reporter');
require("hardhat-deploy");
require('@nomicfoundation/hardhat-ethers');
require('hardhat-deploy-ethers');

/*
your other configurations
*/

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@shikhar229169
Comment options

@pallab-nandi
Comment options

Answer selected by pallab-nandi
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ugur17
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants