Skip to content

Lesson 10: getEntranceFee is returning undefined. #685

Answered by jeetb
Tosinkoa asked this question in Q&A
Discussion options

You must be logged in to vote

The error happens because the contract is deployed on a different chainId and your metamask wallet is trying to access the contract on a different chainId. If you've been following along with the course, then you should have these 2 local testnets:

  1. Hardhat-Localhost with chainId 31337
  2. Localhost 8545 with chainId 1337

So, check your hardhat-config and helper-hardhat-config files to check your chainId. If it is 31337, then set your metamask network to Hardhat-Localhost (or whatever you decided to name it) and if it is 1337, set your metamask to Localhost 8545. Bottom line, make sure that the chainId in your config files matches with the chainId of the network your metamask is on. In my ca…

Replies: 12 comments 21 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@jeetb
Comment options

@mauro1972
Comment options

@jeetb
Comment options

@PatrickAlphaC
Comment options

@jeetb
Comment options

Comment options

You must be logged in to vote
5 replies
@imartin25
Comment options

@jeetb
Comment options

@imartin25
Comment options

@jeetb
Comment options

@Blockchain-Oracle
Comment options

Answer selected by PatrickAlphaC
Comment options

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

Comment options

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

@kashifkhan2022
Comment options

Comment options

You must be logged in to vote
3 replies
@kashifkhan2022
Comment options

@Rampalamp
Comment options

@kashifkhan2022
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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