Interfaces and Librariese
Interfaces
An interface is a contract sugar type with restrictions. This type cannot be instantiated; it can only define the functions prototypes for a contract. This is useful as a generic interface.
No contract storage variables can exist (however constants are allowed)
No function can have a body or implementation
Libraries
Libraries are a special type of contract which can be reused in multiple contracts. Functions declared in a library can be called with the library.function()
syntax. When the library has been imported or declared, any contract can use its functions simply by using its name.
Last updated