0

I can understand the reason of why there is a IERC721, because it's standard.

BUT I can not understand why lots of project's contract is itself's interface, like

contract Woolf is IWoolf {} contract Lostpoets is Ilostpoets {}

Can't they just write in one contract?

1 Answer 1

0

dApps can use interfaces for the same reasons as standards – they have methods that need to be used throughout their project. Because methods in an interface must be implemented in any contract that inherits it, they are used like a template. Maybe their project is upgradeable or can be extended with other contracts. Interfaces facilitate this kind of extensibility.

Edit: Here's an article that goes more in-depth on the use of interfaces. Particularly, this point:

Knowing that a smart contract is based on a specific interface makes it easy [to] understand what the contract can do, and know how to interact with the contract. It removes the need of understanding the complexity behind the actual functions themselves.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.