Lesson 7: unit test - getpriceFeed() #818
Replies: 3 comments 4 replies
-
@GaneshDonikena Because for all public variables, solidity generates by default a getter function. So when you call that outside of a contract, you call its getter function instead of the variable itself. |
Beta Was this translation helpful? Give feedback.
-
Thanks @ali-thegilfoyle but i think priceFeed is a contract by putting address into AggregatorV3Interface we preparing a contract, named it as 'priceFeed'. How can a contract become a function suddenly? is priceFeed a function or contract? |
Beta Was this translation helpful? Give feedback.
-
@krakxn so you are saying priceFeed a getter function. I feel priceFeed is a AggregatorV3Interface copy just like object in python. I also believe interfaces are contracts with not fully functions just headings. @ali-thegilfoyle |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, I got a doubt a why we should use 'getPriceFeed()' instead of 'getPriceFeed'?. Why we should use parenthesis?.
'''
describe("constructor", function () {
it("sets the aggregator addresses correctly", async () => {
const response = await fundMe.getPriceFeed()
assert.equal(response, mockV3Aggregator.address)
})
})
'''
Beta Was this translation helpful? Give feedback.
All reactions