I'm learning about Solidity.
I would like to write a complex scenario of demo to test the power of Solidity and smart contracts.
My doubts are about interaction between smart contracts.
If there are many smart contracts, what is the best way to interact between them?
Examples of scenarios:
- I have a ContactA with its functions.
- When something happened in a ContractA something have to trigger in ContractB (in this example HelloWord.sol).
pragma solidity ^0.6.0;
contract HelloWord
{
string hello= "Hi buddy";
function getSaluto () public view returns (string memory saluto ){
return hello;
}
}
Another file with another Contract:
pragma solidity ^0.6.0;
import "HelloWord.sol";
contract ContractA is HelloWord
{
event LogString(
string errore,
string saluto
);
receive() external payable {
emit LogString("errore receive saluto " , HelloWord.getSaluto() ); //call to HelloWord function
}
}
It works but, is this the best way to interact with another contract?
Another scenario whit different contract that I don't know how implements:
- If i have to call another contract not related with ContractA (because in not inherited) how to call it in a contraxt o from a client application?
Thanks a lot.