What exactly is this functionality of an interface in Solidity? #5587
-
Hello, I started this course and looks amazing with a lot of useful things. Now I'm at lesson 4 where you explain about the interface AggregatorV3Interface. And I don't understand what you are doing here. I came from Java and I know a little bit of JS. I'm refering at that function:
So, I don't understand what exactly is this: And also I don't understand why this I watched some videos about interfaces in Solidity and it seems the same like interfaces in Java. Do you have some videos about interfaces where is explained this functionality? And I try to modify the interface AggregatorV3Interface, I deleted some methods and I changed the name with AggInt like this:
And then I modified the getVersion() function like this:
And it still return 4. But if change the name of the function, versionApp() instead of version() then it doesn't work, I get an error. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@software-dev2010 Interfaces allow contracts to interact with other contracts in a standardized and predictable manner. They define a set of function declarations that other contracts can adhere to when interacting with the contract that implements the interface. This enables contracts to communicate and collaborate effectively. Here the address is wrapped around the AggregatorV3Interface. Which is the name of the Interface where functions and signautres (not logic inside if) are defined but the actual functionality/logic are defined at the address.
If you change the address it won't work because those functions are not implemented at that address Here you use Things to keep in mind
Hope this makes sense |
Beta Was this translation helpful? Give feedback.
@software-dev2010
In Solidity, an interface is a way to define a contract's external-facing functions and their signatures without implementing the actual functionality. It acts as a blueprint for other contracts to follow, specifying the required functions and their input/output parameters.
Interfaces allow contracts to interact with other contracts in a standardized and predictable manner. They define a set of function declarations that other contracts can adhere to when interacting with the contract that implements the interface. This enables contracts to communicate and collaborate effectively.
Here the address is wrapped around the AggregatorV3Interface. Which is the name of the Inte…