Skip to content

Lesson 7: TypeError: Cannot read properties of undefined (reading 'priceFeed') #1135

Answered by zeroxvee
ManuWeb3 asked this question in Q&A
Discussion options

You must be logged in to vote

We can get priceFeed address by 2 ways:

  1. If s_priceFeed variable in FundMe.sol is public, then await fundMe.s_priceFeed() would work and will return the address, because solidity compiler creates getter functions for every public variables.

  2. Or you should create a getter function yourself for priceFeed, which we did in the course by definining it as

    function getPriceFeed() public view returns (AggregatorV3Interface) {
        return s_priceFeed;
    }
    

Replies: 2 comments 15 replies

Comment options

You must be logged in to vote
8 replies
@krakxn
Comment options

@ManuWeb3
Comment options

@krakxn
Comment options

@ManuWeb3
Comment options

@krakxn
Comment options

Comment options

You must be logged in to vote
7 replies
@alymurtazamemon
Comment options

@ManuWeb3
Comment options

@ManuWeb3
Comment options

@alymurtazamemon
Comment options

@ManuWeb3
Comment options

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