I need some basic interface understanding. In my contract I implement two interfaces with the same function signature:

interface IFirst {function someCall(address sender) external;}
interface ISecond {function someCall(address sender) external;}

contract MyContract is IFirst, ISecond {    
    function someCall(address sender) external override {...}

Because my contract can be called from other contracts e.g. A and B like this:

A: IFirst(myContractAddress).someCall(0x...);
B: ISecond(myContractAddress).someCall(0x...);

Isn't it just enough to implement the first Interface because it already ensures the existance of the correct someCall function?

But..is it then necessary to implement the interface at all if I just make sure the function someCall with the correct signature exists in my contract?

1 Answer 1


You're right, you can use one same interface for multiple contracts.

On a side note - you can actually use one interface for multiple instances inside same contract if for whatever reason two different contracts share same method names and method parameters, but with different functionality behind them:

pragma solidity 0.8.0;

contract TestContract {
    Interface interface_instance_one = Interface(<CONTRACT_ADDRESS_ONE>);
    Interface interface_instance_two = Interface(<CONTRACT_ADDRESS_TWO>);

interface Interface {
    function someCall(address sender) external;
  • 1
    I am not sure I understand. The question was not about if I can use the same interface in multiple contracts. It was about if I have to implement multiple interfaces with the same function name and signature, or if its enough to implement only one interface.
    – flo
    Jan 11 at 9:57
  • Yes you can go with only one interface, what I added is like an additional comment to see that interfaces are a bit flexible. I edited my answer to be more clear. Jan 11 at 9:58
  • Ok many thanks :) Could you maybe explain, why I have to implement an interface at all, instead of just having the function in my contract externally accessible? Does it have to have the override flag?
    – flo
    Jan 11 at 10:04
  • Interfaces are usually being used when you want to interact with smart contract which is already existing on the blockchain. Let's say you have a ERC20 contract ( let's call it token X ) which is live for a while and this contract already have a history of addresses and balances. Then you decide that you want to create additional contract only for the addresses who hold token X like a staking app or a governance app or whatever app. To be continued in my next comment .. Jan 11 at 10:21
  • 1
    Here come the interfaces - in order your additional contract to have access to Token X holders and balances you will need to include Token X interface inside the additional contract like this Interface token_x = Interface(<TOKEN_X_CONTRACT_ADDRESS>);. With this piece of code you're creating instance of Token X and by passing the Token X contract addresses you are sure that the additional contract will be calling exactly Token X contract to receive the needed data. Jan 11 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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