I understand how to call another contracts function. My question is, if I want to use an interface like in this question over call(): Call function on another contract
contract Name {
mapping(address=>string) public text;
string public test;
function register(string _text) {
text[msg.sender] = _text;
}
}
contract Proxy {
address watch_addr = 0xEB1e2c19bd833b7f33F9bd0325B74802DF187935;
address user_addr = msg.sender;
function register(string _text) {
Name name = Name(watch_addr);
name.register(_text);
}
}
I know you don't need to have the function definition so having only this from Contract Name would work fine:
contract Name {
function register(string _text) {}
}
What if contract Name had other functions defined in it too? Would the interface contract being used need to implement all the functions in contract Name, or only the function being used by the Proxy contract?
Also if the function we wanted to call from contract Name had a modifer, say onlyOwner
, would the interface version need to too?
Thanks for any help.