4

Let's assume the following:

  • There is a master contract A, an interface contract IB, and a slave contract B
  • A implements IB to allow upgrading B without redeploying A

Question:

Does IB need to have all functions of B, or only the ones used by A?

1
  • Interfaces don't implement contracts: contracts implement interfaces. What is the inheritance chain here? A->IB->B ? Seems odd and IB doesn't have to implement anything. Or is it an interface I with contracts A and B implementing I? What goes in I would be what you require both A and B to implement: A and B can each have extra functions.
    – eth
    Commented Feb 10, 2017 at 6:15

1 Answer 1

4

According to my experience in the following code

https://gist.github.com/anonymous/c23f944b139a76693abbae261ad577b8

it is enough implementing those ones you are using. In the example:

/// ---- dataStorage interface
contract dataStorage {
    function getBalanceOf(address _account) constant returns (uint256 balance);
    function setBalanceOf(address _account, uint256 _value);
}
2

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.