I'm prototyping an application that needs to call another deployed function in order to work properly & while prototyping I had a weird error appear on Remix IDE
stating that TypeError: Functions in interfaces must be declared external
, yet when I go to solidity lang spec towards the bottom is states that public: visible externally and internally (creates a getter function for storage/state variables)
for public functions.
My reading this I would assume I'd be able to make an interface as such to represent the functions I'd like to call as such.
// Contract to Call
interface HelloInterface {
function set(uint x) public;
function get() public view returns (uint);
}
contract Main {
HelloInterface helloContract;
address hwAddress = 0xf8e81D47203A594245E36C48e151709F0C19fBe8;
function setHelloInt(uint v) external {
helloContract = HelloInterface(hwAddress).set(v);
}
}
Can I only call functions that are labeled external in solidty or do I have to model my call structure a different way? I've come across CALL
| DELEGATECALL
| CALLCODE
but haven't look into them yet.
Should I change the HelloInterface
to a contract instead & create the functions to call?