Skip to content

Lesson 7: Error: invalid address (argument="address", value=undefined, code=INVALID_ARGUMENT, version=address/5.7.0) #6095

Answered by haaarshit
tusharr1411 asked this question in Q&A
Discussion options

You must be logged in to vote

@tusharr1411
Got the problem you are using const ethUsdPriceFeedAddress inside else block which is storing address in a constant variable which does not have scope outside the else block that's why it is working fine on localhost but not on test net
So remove the const

  else{
	const ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"];
	console.log(ethUsdPriceFeedAddress);
	}

..

  else{
		ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"];
		console.log(ethUsdPriceFeedAddress);
	}

I hope this will solve your problem

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

Answer selected by tusharr1411
@tusharr1411
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants