Focus mode

Smart Contract Development with Solidity

Interfaces

Code from video: https://solidity-by-example.org/interface/ 

You can access the video content in Turkish prepared by İTÜ Blockchain here:  https://www.youtube.com/watch?v=QZDvZD-lczM&list=PLby2HXktGwN4Cof_6a8YwlMrboX8-hs73&index=17 

Interfaces allow contracts (for example, token contracts) that have different working logic but do the same job to have a common standard, so that someone who wants to work with these contracts writes a single code according to this standard instead of writing code specific to each contract.

You can interact with other contracts by declaring an Interface.

Interfaces:

  • Cannot have any functions implemented
  • Can inherit from other interfaces
  • Declared functions must be external
  • Cannot declare state variables
  • Cannot declare a constructor

Standards such as ERC20, ERC721, ERC1155 are actually defined as an interface.

Resources:

You can find detailed further information from Solidity Official documentation (in English): https://docs.soliditylang.org/en/v0.8.15/contracts.html#interfaces 

https://github.com/itublockchain/web3-bootcamp/tree/master/1x14_Interfaces


Comments

You need to enroll in the course to be able to comment!