Lesson 7: Questions about how the constructor works in this lesson #2693
-
I'm trying to understand the following points:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey @pacelliv if you remember in the initial lesson where we created |
Beta Was this translation helpful? Give feedback.
-
1: I don't understand from where the constructor takes the parameter priceFeedAddress.
2: priceFeed is a variable or a contract ?
|
Beta Was this translation helpful? Give feedback.
Hey @pacelliv if you remember in the initial lesson where we created
FundMe.sol
we hardcoded thepriceFeedAddress
inside the contract like this,AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
especially inside thepriceConverter.sol
. With this setup,priceFeed
becomes sort of a contract instance (since it is tied to the interface AggregatorV3Interface) where you can call all the functions related to the contract at the given address (0x8A753747A1Fa494EC906cE90E9f37563A8AF630e
). However, hardcoding the address like this is not really efficient because if the address changes after we have deployed our contract, we'd have to deploy a new …