Skip to content

Lesson 4: Declaration Error: Undeclared Identifier #2257

Answered by othaime-en
rarddd asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @rarddd there's a couple issues with your code as it is. The error you are getting here require (msg.value.getConversionRate() >= minimumUsd, "Didn't send enough"); is because you are trying to use the .getConversionRate() as if it were a library function attached to the type uint256 which in your case, you haven't attached any library function on the uint256 type.
So to make this work, you're gonna have to do a couple things.

  1. You need to rewrite your FundMe.sol and move all the price conversion functionalities (getPrice(), getConversionRate() ) into another file in the form of a library
  2. Then import that library file into your FundMe.sol
  3. And attach the library functions to the type u…

Replies: 5 comments 4 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
1 reply
@rarddd
Comment options

Comment options

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

Comment options

You must be logged in to vote
2 replies
@othaime-en
Comment options

@rarddd
Comment options

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