So I’m on Project - Building a Decentralized Exchange, Building Wallet section. So I just started.
I’m confused that Filip doesn’t explain what an Interface is. I’m also confused that his contract compiles at all. Because mine required to be abstract, otherwise I had errors that all the functions from IERC20 Interface were not implemented. (EDIT: ok Filip is not actually inheriting from the Interface, he’s just importing it. So that’s why mine errored out about missing implementations)
I did use some Interfaces in C# in Unity and I remember whenever you inherit from an Interface, you have to implement whatever is in the interface - so that error makes sense.
So few questions:
Why even use Interfaces in solidity since you will have to do your own implementations anyways? Why not instead of an Interface just use a contract with virtual functions?
Also why are we using this
IERC20(address), is this sth that an Interface requires? That you have to pass in an address of the caller?
When calling wallet functions that call the interface functions… What am I actually calling? Because interface functions are empty and we are not implementing them here. But ERC20 does implement them. So can I just call the functions straight from ERC20 instead of IERC20? It’s just I don’t understand why even bother with the Interface at all?