As far as I understand if a caller uses just one function from a callee contract it only needs to know the signature of this function, not the whole interface.
Callee.sol (Kovan):
contract Callee{
uint public anyNumber;
function theOnlyFunctionCallerNeeds (uint someData) external {
anyNumber = someData;
}
function justSomeRandomFunction(uint someOtherData) public view returns (uint){
return anyNumber + someOtherData + 42;
}
}
Caller.sol (Kovan):
interface Callee{
function theOnlyFunctionCallerNeeds (uint);
}
contract Caller{
Callee callee;
uint public anyNumber;
function Caller(address calleeAddr) public {
callee = Callee(calleeAddr);
}
function usingCallee(uint callerData) external {
callee.theOnlyFunctionCallerNeeds(callerData);
}
}
It works on testnet (Kovan) but I cannot find it anywhere in the docs. So my question is can I use this pattern to write upgradable contracts (so I could easily change Callee contract except for one function)? Is there anything to be considered?